用户重新发送短信

This commit is contained in:
mkm 2023-08-03 14:39:12 +08:00
parent f6d8c783d8
commit 5243005944
2 changed files with 49 additions and 9 deletions

View File

@ -169,21 +169,35 @@ class UserController extends BaseApiController
public function initiate_contract()
{
$params = $this->request->param();
$admin_id=Db::name('user')->where('id',$this->userId)->value('admin_id');
$result = CommonUserLogic::initiate_contract($params,$admin_id);
if($result==true){
$admin_id = Db::name('user')->where('id', $this->userId)->value('admin_id');
$result = CommonUserLogic::initiate_contract($params, $admin_id);
if ($result == true) {
return $this->success('发起成功,等待平台风控部上传合同');
}
return $this->fail(CommonUserLogic::getError());
return $this->fail(CommonUserLogic::getError());
}
// /**生成合同 */
public function Draftingcontracts()
{
$params = $this->request->param();
$result = CommonUserLogic::Draftingcontracts($params);
if($result==true){
if ($result == true) {
return $this->success('生成合同成功');
}
return $this->fail(CommonUserLogic::getError());
return $this->fail(CommonUserLogic::getError());
}
//**发送短信 */
public function postsms()
{
$params = $this->request->param();
$params['mobile']=$this->userInfo['mobile'];
$params['nickname']=$this->userInfo['nickname'];
$res = CommonUserLogic::postsms($params);
if ($res == true) {
return $this->success('发送成功', [], 1, 1);
} else {
return $this->fail(CommonUserLogic::getError());
}
}
}

View File

@ -54,7 +54,7 @@ class UserLogic extends BaseLogic
// $user->sex = $user->getData('sex');
$user['qualification'] = json_decode($user->qualification, true);
// if ($user->is_contract == 1) {
$user['contract'] = Contract::where(['type' => 2, 'party_b' => $userId])->with(['partyA', 'contractType'])->find();
$user['contract'] = Contract::where(['type' => 2, 'party_b' => $userId])->with(['partyA', 'contractType'])->find();
// }
return $user->toArray();
}
@ -143,7 +143,7 @@ class UserLogic extends BaseLogic
$result = self::detail($params['id']);
if ($result && $result['contract'] && $result['contract']['file'] != '') {
if($result['contract']['check_status']==3){
if ($result['contract']['check_status'] == 3) {
return self::setError('你已经生成过合同,请问重复生成');
}
$data = [
@ -153,7 +153,7 @@ class UserLogic extends BaseLogic
];
$res = app(JunziqianController::class)->Signing($data, $result['contract']['id']);
if ($res->success == true) {
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data,'check_status'=>3]);
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data, 'check_status' => 3]);
$data = array(
"applyNo" => $res->data, //TODO *
"fullName" => $result['nickname'], //TODO *
@ -187,4 +187,30 @@ class UserLogic extends BaseLogic
return self::setError('生成合同成功失败,联系管理员');
}
}
//**发送短信 */
public static function postsms($params)
{
$find = Db::name('contract')->where('party_b', $params['id'])
->withAttr('contract_type_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
})
->find();
if ($find) {
//发送短信
$sms = [
'mobile' => $params['mobile'],
'name' => $params['nickname'],
'type' => '《' . $find['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id=' . $find['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return true;
} else {
return self::setError(SmsLogic::getError());
}
}
}
}