data_center/app/adminapi/controller/contract/VehicleContractController.php

89 lines
2.5 KiB
PHP

<?php
namespace app\adminapi\controller\contract;
use app\adminapi\controller\BaseAdminController;
use think\response\Json;
class VehicleContractController extends BaseAdminController
{
protected array $reqHeader = [];
public function initialize()
{
parent::initialize();
$this->reqHeader = [
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
];
}
//三轮车合同列表
public function lists(): Json
{
$params = $this->request->get(['page_no','page_size','company_name','contract_no','status']);
$result = curl_post(env('project.worker_domain').'/middleapi/vehicle/lists',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
//三轮车合同详情
public function detail(): Json
{
$params = $this->request->get(['id']);
if(empty($params['id'])){
return $this->fail('参数错误');
}
$result = curl_post(env('project.worker_domain').'/middleapi/vehicle/detail',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
//上传三轮车合同
public function uploadContract(): Json
{
$params = $this->request->post(['id','file','cars']);
if(empty($params['id']) || empty($params['file'])){
return $this->fail('缺少必要参数');
}
$result = curl_post(env('project.worker_domain').'/middleapi/vehicle/uploadContract',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
//发起三轮车合同
public function initiatingContract(): Json
{
//获取参数
$params = $this->request->post(['id']);
if(empty($params['id'])){
return $this->fail('缺少必要参数');
}
$result = curl_post(env('project.worker_domain').'/middleapi/vehicle/initiatingContract',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
//重新发送三轮车合同短信
public function sendSmsAgain(): Json
{
//获取参数
$params = $this->request->post(['id']);
if(empty($params['id'])){
return $this->fail('参数错误');
}
$result = curl_post(env('project.worker_domain').'/middleapi/vehicle/sendSmsAgain',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
}