新增关注、取消关注问诊医生
This commit is contained in:
@@ -586,6 +586,63 @@ class PatientDoctorService extends BaseService
|
||||
return success($order_evaluation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增关注医生
|
||||
* @return array
|
||||
*/
|
||||
public function addDoctorFollow(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$doctor_id = $this->request->route('doctor_id');
|
||||
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$res = PatientFollow::getExists($params);
|
||||
if ($res){
|
||||
// 已关注,重复请求
|
||||
return success();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['patient_id'] = $user_info['client_user_id'];
|
||||
$data['doctor_id'] = $doctor_id;
|
||||
$patient_follow = PatientFollow::addPatientFollow($data);
|
||||
if (empty($patient_follow)){
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消关注医生
|
||||
* @return array
|
||||
*/
|
||||
public function deleteDoctorFollow(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$doctor_id = $this->request->route('doctor_id');
|
||||
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$res = PatientFollow::getExists($params);
|
||||
if (!$res){
|
||||
// 未关注,执行取消关注
|
||||
return success();
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
PatientFollow::deletePatientFollow($params);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页服务过患者的医生
|
||||
* 限制条数
|
||||
|
||||
Reference in New Issue
Block a user