新增医生证书申请命令执行
This commit is contained in:
parent
eb7cd1bedc
commit
d835d118b7
@ -8,6 +8,8 @@ use App\Model\User;
|
||||
use App\Model\UserCaCert;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Model\UserPharmacist;
|
||||
use App\Model\UserPharmacistInfo;
|
||||
use Extend\Ca\CaOnline;
|
||||
use Hyperf\Command\Command as HyperfCommand;
|
||||
use Hyperf\Command\Annotation\Command;
|
||||
@ -127,6 +129,65 @@ class getCaCertCommand extends HyperfCommand
|
||||
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_doctor['user_id'];
|
||||
$user = User::getOne($params);
|
||||
if (empty($user)){
|
||||
$this->line('结束,药师用户数据错误');
|
||||
return;
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['user_id'] = $user_doctor['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('全部结束');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user