64 lines
2.0 KiB
PHP
64 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace app\adminapi\controller\contract;
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
use app\common\enum\notice\NoticeEnum;
|
|
use app\common\model\contract\VehicleContract;
|
|
|
|
class VehicleContractController extends BaseAdminController
|
|
{
|
|
|
|
// private string $url = 'http://www.lst.local';
|
|
private string $url = 'http://logistics.lihaink.cn';
|
|
|
|
//风控中心上传合同
|
|
public function uploadContract() {
|
|
//获取参数
|
|
$params = $this->request->post(['id','file']);
|
|
if(empty($params['id']) || empty($params['file'])){
|
|
return $this->fail('参数错误');
|
|
}
|
|
//获取合同信息
|
|
$contract = VehicleContract::where('id',$params['id'])->find();
|
|
if($contract->isEmpty()){
|
|
return $this->fail('合同信息错误');
|
|
}
|
|
//更新本地
|
|
$la_result = VehicleContract::where('id', $params['id'])->update(['file' => $params['file'],'status'=>1]);
|
|
//判断合同类型
|
|
if(!empty($la_result['contract_logistic_id'])){
|
|
//更新物流系统
|
|
curl_post($this->url.'/api/updateContract',[],[
|
|
'id' => $la_result['contract_logistic_id'],
|
|
'file' => $params['file'],
|
|
'status' => 1
|
|
]);
|
|
}
|
|
//发送短信
|
|
$sms = [
|
|
'mobile' => $contract['company_a_phone'],
|
|
'name' => $contract['company_a_name'],
|
|
'scene' => 'WQTZ'
|
|
];
|
|
$this->rentNoticeSms($sms);
|
|
return $this->success('上传成功', [], 1, 1);
|
|
}
|
|
|
|
//发送通知短信
|
|
public function rentNoticeSms($params) {
|
|
try {
|
|
$scene = NoticeEnum::getSceneByTag($params['scene']);
|
|
if (empty($scene)) {
|
|
throw new \Exception('场景值异常');
|
|
}
|
|
$result = event('Notice', [
|
|
'scene_id' => $scene,
|
|
'params' => $params
|
|
]);
|
|
return $result[0];
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
} |