From 21320b3ea4012973f3d9dd8f23aac630e35d3728 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 16 Mar 2023 20:04:53 +0800 Subject: [PATCH] 2 --- app/Controller/CallBackController.php | 20 -------- app/Controller/UserController.php | 13 +++-- app/Model/DoctorPharmacistCert.php | 69 +++++++++++++++++++++++++++ app/Services/ImService.php | 2 +- app/Services/UserDoctorService.php | 4 ++ app/Services/UserPatientService.php | 11 ++++- extend/Ca/Ca.php | 21 ++++++-- extend/TencentIm/Message.php | 3 +- extend/TencentIm/RecentContact.php | 12 +++++ 9 files changed, 123 insertions(+), 32 deletions(-) create mode 100644 app/Model/DoctorPharmacistCert.php diff --git a/app/Controller/CallBackController.php b/app/Controller/CallBackController.php index f47d86d..0dee305 100644 --- a/app/Controller/CallBackController.php +++ b/app/Controller/CallBackController.php @@ -678,26 +678,6 @@ class CallBackController extends AbstractController Log::getInstance()->error("Im回调数据处理失败:存储数据库失败"); return $this->wxPayErrorReturn("存储数据库失败"); } - - // 存储redisList - if (!empty($order_inquiry) && !empty($request_params['CloudCustomData'])){ - if (!empty($order_inquiry['doctor_id'])){ - $data = array(); - $data['order_inquiry_id'] = $order_inquiry['order_inquiry_id']; - $data['to_user_id'] = $request_params['To_Account']; - $data['patient_name'] = $order_inquiry['patient_name']; - $data['patient_sex'] = $order_inquiry['patient_sex']; - $data['patient_age'] = $order_inquiry['patient_age']; - $data['inquiry_status'] = $order_inquiry['inquiry_status']; - $data['message_send_time'] = $request_params['RequestTime']; - $data['message_seq'] = $request_params['MsgSeq']; - $data['message_type'] = $request_params['MsgBody'][0]['MsgType']; - $data['last_message_content'] = $request_params['MsgBody'][0]['MsgContent']; - - $imService = new ImService(); - $imService->addRecentContactRecordCache($order_inquiry['doctor_id'],$order_inquiry['inquiry_type'],$order_inquiry['user_id'],$data); - } - } } catch (\Exception $e) { // 验证失败 Log::getInstance()->error("Im回调数据处理失败:" . $e->getMessage()); diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index c7b0c9b..111975a 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -21,6 +21,7 @@ use Extend\TencentIm\Friend; use Extend\TencentIm\Group; use Extend\TencentIm\Message; use Extend\TencentIm\Profile; +use Extend\TencentIm\RecentContact; use Extend\VerifyDun\BankCard; use Extend\VerifyDun\IdCard; use Extend\Wechat\Wechat; @@ -273,10 +274,10 @@ class UserController extends AbstractController dump($result); -// $ImService = new ImService(); + $ImService = new ImService(); - // 发送消息 +// // 发送消息 // 自定义消息 // $cloud_custom_data = array(); // $cloud_custom_data['order_inquiry_id'] = "494837308861095936"; @@ -285,14 +286,16 @@ class UserController extends AbstractController // // // 消息内容 // $message_content_data = array(); -// $message_content_data['message_type'] = 2; -// $message_content_data['content'] = "--问诊结束--"; +// $message_content_data['message_type'] = 1; +// $message_content_data['content'] = "--测试--"; // $message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。"; // $message_content = [ // 'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE), // ]; // // $ImService->sendMessage("491925054435950592", "492404831991414785", $message_content, "TIMCustomElem", $cloud_custom_data); - +// +// $RecentContact = new RecentContact(); +// $result = $RecentContact->getRecentContactPage(); } } \ No newline at end of file diff --git a/app/Model/DoctorPharmacistCert.php b/app/Model/DoctorPharmacistCert.php new file mode 100644 index 0000000..ac0c5e4 --- /dev/null +++ b/app/Model/DoctorPharmacistCert.php @@ -0,0 +1,69 @@ +exists(); + } + + /** + * 获取信息-单条 + * @param array $params + * @param array $fields + * @return object|null + */ + public static function getOne(array $params, array $fields = ['*']): object|null + { + return self::where($params)->first($fields); + } + + /** + * 获取数据-多 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params = [], array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } +} diff --git a/app/Services/ImService.php b/app/Services/ImService.php index c699601..7b7cfbb 100644 --- a/app/Services/ImService.php +++ b/app/Services/ImService.php @@ -253,7 +253,7 @@ class ImService extends BaseService $arg['From_Account'] = $from_user_id; // 发送方user_id 如系统发送,无需填写 } $arg['To_Account'] = $to_user_id; // 接收方user_id - $arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback',]; + $arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback',"ForbidAfterSendMsgCallback"]; $arg['SendMsgControl'] = ['NoUnread']; $arg['MsgBody'] = [ diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index d399dee..7fd6153 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -255,6 +255,10 @@ class UserDoctorService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "已绑定银行卡"); } + if ($user_doctor['iden_auth_status'] != 1) { + return fail(HttpEnumCode::HTTP_ERROR, "请先身份认证"); + } + // 获取医生详情数据 $params = array(); $params['doctor_id'] = $user_doctor['doctor_id']; diff --git a/app/Services/UserPatientService.php b/app/Services/UserPatientService.php index 255c0bf..33217a3 100644 --- a/app/Services/UserPatientService.php +++ b/app/Services/UserPatientService.php @@ -6,6 +6,7 @@ use App\Constants\HttpEnumCode; use App\Model\Coupon; use App\Model\OrderInquiry; use App\Model\PatientHistoryInquiry; +use App\Model\User; use App\Model\UserCoupon; use App\Model\UserPatient; use App\Utils\Mask; @@ -80,7 +81,6 @@ class UserPatientService extends BaseService 'patient_id', 'user_id', 'user_name', - 'mobile', 'avatar', ]; $params = array(); @@ -90,8 +90,15 @@ class UserPatientService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "非法用户"); } + $params = array(); + $params['user_id'] = $user_patient['user_id']; + $user = User::getOne($params); + if (empty($user)){ + return fail(HttpEnumCode::HTTP_ERROR, "非法用户"); + } + // 手机号 - $user_patient['mobile'] = Mask::maskPhoneStr($user_patient['mobile']); + $user_patient['mobile'] = Mask::maskPhoneStr($user['mobile']); // 头像 $user_patient['avatar'] = addAliyunOssWebsite($user_patient['avatar']); diff --git a/extend/Ca/Ca.php b/extend/Ca/Ca.php index 6e86db2..5ec24c9 100644 --- a/extend/Ca/Ca.php +++ b/extend/Ca/Ca.php @@ -26,14 +26,18 @@ class Ca $this->client = $this->container->get(Client::class); } - // 获取云证书 - public function getCloudCert(array $data){ + /** + * 获取云证书 + * @param array $data + * @return mixed + */ + public function getCloudCert(array $data): mixed + { $option = [ 'form_params' => [ 'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义 'entityType' => "Personal",// 用户类型,可选值[Personal/Organizational] 'pin' => $data['user_id'], // 证书PIN码 -// 'pin' => "123", // 证书PIN码 'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码) ] ]; @@ -50,6 +54,17 @@ class Ca } } + // 获取云证书签名 + public function getCertSign(array $data){ + $option = [ + 'form_params' => [ + 'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义 + 'entityType' => "Personal",// 用户类型,可选值[Personal/Organizational] + 'pin' => $data['user_id'], // 证书PIN码 + 'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码) + ] + ]; + } /** * 获取签名 diff --git a/extend/TencentIm/Message.php b/extend/TencentIm/Message.php index 75ce884..75458dc 100644 --- a/extend/TencentIm/Message.php +++ b/extend/TencentIm/Message.php @@ -4,6 +4,7 @@ namespace Extend\TencentIm; use App\Constants\HttpEnumCode; use App\Exception\BusinessException; +use App\Utils\Log; use GuzzleHttp\Exception\GuzzleException; use Hyperf\Snowflake\IdGeneratorInterface; use Hyperf\Utils\ApplicationContext; @@ -88,7 +89,7 @@ class Message extends Base try { // 合并发送参数 $arg = array_merge($this->arg,$arg); - + Log::getInstance()->info(json_encode($arg,JSON_UNESCAPED_UNICODE)); $options = [ "json"=> $arg ]; diff --git a/extend/TencentIm/RecentContact.php b/extend/TencentIm/RecentContact.php index 289c8a1..ab687db 100644 --- a/extend/TencentIm/RecentContact.php +++ b/extend/TencentIm/RecentContact.php @@ -9,6 +9,18 @@ class RecentContact extends Base { // 分页拉取会话列表 public function getRecentContactPage(){ + $options = [ + "json"=> [ + "Operator_Account"=>"491925054435950592", + "Peer_Account"=>"492404831991414785", + "MaxCnt"=>50, + "MinTime"=> 1678872105, + "MaxTime"=> time(), + ] + ]; + $path = $this->config['base_url'] . "v4/openim/admin_getroammsg?" . $this->buildRequestParams(); + $result = $this->postRequest($path,$options); + dump($result);die; } } \ No newline at end of file