This commit is contained in:
weiz 2023-11-11 09:34:43 +08:00
parent dbc3a7d26d
commit 5bb069e1a2
1 changed files with 20 additions and 45 deletions

View File

@ -7,15 +7,22 @@
class CompanyController extends BaseAdminController class CompanyController 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 public function lists(): Json
{ {
$params=$this->request->get(['page_no','page_size','company_name','area_name','street_name','area_manager','company_type','is_contract']); $params=$this->request->get(['page_no','page_size','company_name','area_name','street_name','area_manager','company_type','is_contract']);
$result = curl_post(env('project.worker_domain').'/middleapi/company/lists',$params,[ $result = curl_post(env('project.worker_domain').'/middleapi/company/lists',$params,$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -29,11 +36,7 @@
if(empty($params['id'])){ if(empty($params['id'])){
return $this->fail('id不能为空'); return $this->fail('id不能为空');
} }
$result = curl_post(env('project.worker_domain').'/middleapi/company/detail',$params,[ $result = curl_post(env('project.worker_domain').'/middleapi/company/detail',$params,$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -65,11 +68,7 @@
if(empty($params['company_name']) || empty($params['organization_code']) || empty($params['company_type']) || empty($params['master_name']) || empty($params['master_phone'])){ if(empty($params['company_name']) || empty($params['organization_code']) || empty($params['company_type']) || empty($params['master_name']) || empty($params['master_phone'])){
return $this->fail('缺少必要参数'); return $this->fail('缺少必要参数');
} }
$result = curl_post(env('project.worker_domain').'/middleapi/company/create',http_build_query($params),[ $result = curl_post(env('project.worker_domain').'/middleapi/company/create',http_build_query($params),$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -83,11 +82,7 @@
if(empty($params['id']) || empty($params['company_name']) || empty($params['organization_code']) || empty($params['company_type']) || empty($params['master_name']) || empty($params['master_phone'])){ if(empty($params['id']) || empty($params['company_name']) || empty($params['organization_code']) || empty($params['company_type']) || empty($params['master_name']) || empty($params['master_phone'])){
return $this->fail('缺少必要参数'); return $this->fail('缺少必要参数');
} }
$result = curl_post(env('project.worker_domain').'/middleapi/company/edit',http_build_query($params),[ $result = curl_post(env('project.worker_domain').'/middleapi/company/edit',http_build_query($params),$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -101,11 +96,7 @@
if(empty($params['id'])){ if(empty($params['id'])){
return $this->fail('id不能为空'); return $this->fail('id不能为空');
} }
$result = curl_post(env('project.worker_domain').'/middleapi/company/enterpriseCertification',$params,[ $result = curl_post(env('project.worker_domain').'/middleapi/company/enterpriseCertification',$params,$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -119,11 +110,7 @@
if(empty($params['id']) || empty($params['party_a']) || empty($params['contract_type'])){ if(empty($params['id']) || empty($params['party_a']) || empty($params['contract_type'])){
return $this->fail('缺少必要参数'); return $this->fail('缺少必要参数');
} }
$result = curl_post(env('project.worker_domain').'/middleapi/company/generateContract',$params,[ $result = curl_post(env('project.worker_domain').'/middleapi/company/generateContract',$params,$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -137,11 +124,7 @@
if(empty($params['id'])){ if(empty($params['id'])){
return $this->fail('缺少必要参数'); return $this->fail('缺少必要参数');
} }
$result = curl_post(env('project.worker_domain').'/middleapi/company/subsidiaryCompany',$params,[ $result = curl_post(env('project.worker_domain').'/middleapi/company/subsidiaryCompany',$params,$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -151,11 +134,7 @@
//公司类型 //公司类型
public function companyType(): Json public function companyType(): Json
{ {
$result = curl_post(env('project.worker_domain').'/middleapi/company/companyType',[],[ $result = curl_post(env('project.worker_domain').'/middleapi/company/companyType',[],$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }
@ -165,11 +144,7 @@
//合同类型 //合同类型
public function contractType(): Json public function contractType(): Json
{ {
$result = curl_post(env('project.worker_domain').'/middleapi/company/contractType',[],[ $result = curl_post(env('project.worker_domain').'/middleapi/company/contractType',[],$this->reqHeader);
"appid:".env('app.app_id'),
"timestamp:".time(),
"sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret'))
]);
if($result['code'] == 0){ if($result['code'] == 0){
return $this->fail($result['msg']); return $this->fail($result['msg']);
} }