用户重新发送短信

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

@ -186,4 +186,18 @@ class UserController extends BaseApiController
}
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

@ -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());
}
}
}
}