From 10e7fe3a914da6d4de114a2552f84f60e290db27 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 23 Nov 2023 13:36:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9C=A8=E7=BA=BF=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/getCaCertCommand.php | 193 ------------------------- app/Model/User.php | 7 +- app/Model/UserDoctor.php | 18 +-- app/Model/UserPharmacist.php | 3 +- app/Services/UserPharmacistService.php | 7 +- 5 files changed, 19 insertions(+), 209 deletions(-) delete mode 100644 app/Command/getCaCertCommand.php diff --git a/app/Command/getCaCertCommand.php b/app/Command/getCaCertCommand.php deleted file mode 100644 index 143b539..0000000 --- a/app/Command/getCaCertCommand.php +++ /dev/null @@ -1,193 +0,0 @@ -setDescription('Ca证书申请'); - } - - public function handle() - { - $this->line('开始'); - - // 获取全部医生 - $params = array(); - $params['status'] = 1; - $params['idcard_status'] = 1; - $params['iden_auth_status'] = 1; - $user_doctors = UserDoctor::getList($params); - if (empty($user_doctors)){ - $this->line('结束,无医生需处理'); - return; - } - - // 获取医院数据 - $params = array(); - $params['is_system'] = 1; - $params['type'] = 2; - $user_ca_cert = UserCaCert::getOne($params); - if (empty($user_ca_cert)){ - $CaOnline = new CaOnline(); - - // 申请医院证书 - $data = array(); - $data['user_id'] = "5345345461"; - $data['mobile'] = "18601047315"; - $data['org_name'] = "成都金牛欣欣相照互联网医院有限公司"; - $data['org_number'] = "91510106MABTJY4K9R"; - - $result = $CaOnline->getCloudCert($data,'Organizational'); - - $data = array(); - $data['is_system'] = 1; - $data['type'] = 2; - $data['cert_base64'] = $result['certBase64']; - $data['cert_chain_p7'] = $result['certP7']; - $data['cert_serial_number'] = $result['certSerialnumber']; - $data['ca_pin'] = "5345345461"; - $doctor_pharmacist_cert = UserCaCert::addUserCaCert($data); - if (empty($doctor_pharmacist_cert)){ - $this->line('错误:医院证书错误'); - return; - } - } - - foreach ($user_doctors as $user_doctor){ - try { - // 获取医生ca证书数据 - $params = array(); - $params['user_id'] = $user_doctor['user_id']; - $user_ca_cert = UserCaCert::getOne($params); - if (!empty($user_ca_cert)){ - continue; - } - - // 获取用户数据 - $params = array(); - $params['user_id'] = $user_doctor['user_id']; - $user = User::getOne($params); - if (empty($user)){ - continue; - } - - $params = array(); - $params['user_id'] = $user_doctor['user_id']; - $user_doctor_info = UserDoctorInfo::getOne($params); - if (empty($user_doctor_info)){ - continue; - } - - $CaOnline = new CaOnline(); - - $data = array(); - $data['user_id'] = $user_doctor['user_id']; - $data['mobile'] = $user['mobile']; - $data['card_name'] = $user_doctor_info['card_name']; - $data['card_num'] = $user_doctor_info['card_num']; - $data['orgDept'] = $user_doctor['department_custom_name']; - $result = $CaOnline->getCloudCert($data); - - $data = array(); - $data['user_id'] = $user_doctor['user_id']; - $data['type'] = 2; - $data['cert_base64'] = $result['certBase64']; - $data['cert_chain_p7'] = $result['certP7']; - $data['cert_serial_number'] = $result['certSerialnumber']; - $data['ca_pin'] = $user_doctor['user_id']; - $doctor_pharmacist_cert = UserCaCert::addUserCaCert($data); - if (empty($doctor_pharmacist_cert)){ - $this->line('错误'); - return; - } - - $this->line('成功'); - }catch (\Exception $e){ - $this->line('错误:' . $e->getMessage()); - continue; - } - } - - // 获取药师数据 - $params = array(); - $params['status'] = 1; - $params['is_online'] = 1; - $user_pharmacist = UserPharmacist::getOne($params); - if (empty($user_pharmacist)){ - $this->line('结束,无药师需处理'); - return; - } - - // 获取医生ca证书数据 - $params = array(); - $params['user_id'] = $user_pharmacist['user_id']; - $user_ca_cert = UserCaCert::getOne($params); - if (!empty($user_ca_cert)){ - $this->line('结束,无药师需处理'); - return; - } - - // 获取用户数据 - $params = array(); - $params['user_id'] = $user_pharmacist['user_id']; - $user = User::getOne($params); - if (empty($user)){ - $this->line('结束,药师用户数据错误'); - return; - } - - $params = array(); - $params['user_id'] = $user_pharmacist['user_id']; - $user_pharmacist_info = UserPharmacistInfo::getOne($params); - if (empty($user_pharmacist_info)){ - $this->line('结束,无药师需处理'); - return; - } - - $CaOnline = new CaOnline(); - - $data = array(); - $data['user_id'] = $user_pharmacist_info['user_id']; - $data['mobile'] = $user['mobile']; - $data['card_name'] = $user_pharmacist_info['card_name']; - $data['card_num'] = $user_pharmacist_info['card_num']; - $result = $CaOnline->getCloudCert($data); - - $data = array(); - $data['user_id'] = $user_pharmacist_info['user_id']; - $data['type'] = 2; - $data['cert_base64'] = $result['certBase64']; - $data['cert_chain_p7'] = $result['certP7']; - $data['cert_serial_number'] = $result['certSerialnumber']; - $data['ca_pin'] = $user_pharmacist_info['user_id']; - $doctor_pharmacist_cert = UserCaCert::addUserCaCert($data); - if (empty($doctor_pharmacist_cert)){ - $this->line('错误'); - return; - } - - $this->line('全部结束'); - } -} diff --git a/app/Model/User.php b/app/Model/User.php index 40bc14d..beea059 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -23,9 +23,10 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $age 年龄 * @property int $sex 性别(0:未知 1:男 2:女) * @property string $avatar 头像 - * @property string $login_ip 登陆ip + * @property int $is_online 是否在线(0:不在线 1:在线) * @property string $last_login_at 最后登陆时间 - * @property string $created_by 创建者id(后台用户表id null:自己注册) + * @property string $login_ip 登陆ip + * @property string $created_by 创建者id(后台用户表id,前台用户表id) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -41,7 +42,7 @@ class User extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'avatar', 'login_ip', 'last_login_at', 'created_by', 'created_at', 'updated_at']; + protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'avatar', 'is_online', 'last_login_at', 'login_ip', 'created_by', 'created_at', 'updated_at']; protected string $primaryKey = "user_id"; diff --git a/app/Model/UserDoctor.php b/app/Model/UserDoctor.php index 3515e15..a5652bc 100644 --- a/app/Model/UserDoctor.php +++ b/app/Model/UserDoctor.php @@ -32,7 +32,7 @@ use Hyperf\Utils\Arr; * @property int $is_bind_bank 是否已绑定结算银行卡(0:否 1:是) * @property int $is_recommend 是否首页推荐(0:否 1:是) * @property string $avatar 头像 - * @property int $doctor_title 医生职称(1:主任中医师 2:主任医师 3:副主任中医师 4:副主任医师 5:主治医师 6:住院医师) + * @property int $doctor_title 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师) * @property int $department_custom_id 科室id-自定义 * @property string $department_custom_name 科室名称(如未自己输入,填入标准科室名称) * @property string $department_custom_mobile 科室电话 @@ -41,21 +41,21 @@ use Hyperf\Utils\Arr; * @property string $praise_rate 好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5) * @property string $avg_response_time 平均响应时间(分钟制) * @property int $number_of_fans 被关注数量 - * @property int $is_online 是否在线(0:不在线 1:在线) * @property int $is_img_expert_reception 是否参加专家图文接诊(0:否 1:是) * @property int $is_img_welfare_reception 是否参加公益图文问诊(0:否 1:是) * @property int $is_img_quick_reception 是否参加快速图文接诊(0:否 1:是) * @property int $is_platform_deep_cooperation 是否平台深度合作医生(0:否 1:是) * @property int $is_enterprise_deep_cooperation 是否企业深度合作医生(0:否 1:是) + * @property int $is_sys_diagno_cooperation 是否先思达合作医生(0:否 1:是) * @property string $qr_code 分享二维码 * @property string $be_good_at 擅长 * @property string $brief_introduction 医生简介 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 - * @property-read \Hyperf\Database\Model\Collection|DoctorExpertise[] $DoctorExpertise - * @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[] $DoctorInquiryConfig - * @property-read Hospital $Hospital - * @property-read \Hyperf\Database\Model\Collection|OrderInquiry[] $OrderInquiry + * @property-read \Hyperf\Database\Model\Collection|DoctorExpertise[]|null $DoctorExpertise + * @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[]|null $DoctorInquiryConfig + * @property-read Hospital|null $Hospital + * @property-read \Hyperf\Database\Model\Collection|OrderInquiry[]|null $OrderInquiry */ class UserDoctor extends Model { @@ -69,7 +69,7 @@ class UserDoctor extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_online', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at']; + protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_time', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_time', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'is_sys_diagno_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at']; protected string $primaryKey = "doctor_id"; @@ -180,8 +180,8 @@ class UserDoctor extends Model // 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) $params["iden_auth_status"] = 1; - // 是否在线(0:不在线 1:在线) - $params["is_online"] = 1; +// // 是否在线(0:不在线 1:在线) +// $params["is_online"] = 1; // // 是否参加专家图文接诊(0:否 1:是) // $params["is_img_expert_reception"] = 1; diff --git a/app/Model/UserPharmacist.php b/app/Model/UserPharmacist.php index 7034343..ea6def1 100644 --- a/app/Model/UserPharmacist.php +++ b/app/Model/UserPharmacist.php @@ -16,7 +16,6 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $union_id 微信开放平台唯一标识 * @property string $wx_session_key 微信会话密钥 * @property int $status 状态(0:禁用 1:正常 2:删除) - * @property int $is_online 是否在线(0:不在线 1:在线) * @property string $avatar 头像 * @property int $pharmacist_title 职称 * @property int $department_custom_id 科室id-自定义 @@ -39,7 +38,7 @@ class UserPharmacist extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['pharmacist_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'is_online', 'avatar', 'pharmacist_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'medical_institution', 'worker_date', 'created_at', 'updated_at']; + protected array $fillable = ['pharmacist_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'avatar', 'pharmacist_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'medical_institution', 'worker_date', 'created_at', 'updated_at']; protected string $primaryKey = "pharmacist_id"; diff --git a/app/Services/UserPharmacistService.php b/app/Services/UserPharmacistService.php index 871e4bf..d44b523 100644 --- a/app/Services/UserPharmacistService.php +++ b/app/Services/UserPharmacistService.php @@ -68,10 +68,13 @@ class UserPharmacistService extends BaseService $data = array(); $data['is_online'] = $is_online; + if ($is_online == 1){ + $data['last_login_at'] = date('Y-m_d,H:i:s',time()); + } $params = array(); - $params['pharmacist_id'] = $user_pharmacist['pharmacist_id']; - UserPharmacist::editUserPharmacist($params, $data); + $params['user_id'] = $user_info['user_id']; + User::editUser($params, $data); return success(); }