From dbc3a7d26df18f5cad1bca9b2aed30dabc3380f1 Mon Sep 17 00:00:00 2001 From: weiz Date: Fri, 10 Nov 2023 17:04:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8E=E5=8F=B0=E5=90=88?= =?UTF-8?q?=E5=90=8C=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/company/CompanyController.php | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 app/adminapi/controller/company/CompanyController.php diff --git a/app/adminapi/controller/company/CompanyController.php b/app/adminapi/controller/company/CompanyController.php new file mode 100644 index 00000000..05e21a8b --- /dev/null +++ b/app/adminapi/controller/company/CompanyController.php @@ -0,0 +1,178 @@ +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,[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + 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('id不能为空'); + } + $result = curl_post(env('project.worker_domain').'/middleapi/company/detail',$params,[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //删除公司 + public function delete(): Json + { + $params=$this->request->post(['id']); + if(empty($params['id'])){ + return $this->fail('缺少必要参数'); + } + $result = curl_post(env('project.worker_domain').'/middleapi/company/delete',$params,[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //添加公司 + public function create(): Json + { + $params=$this->request->post(); + if(empty($params['company_name']) || empty($params['organization_code']) || empty($params['company_type']) || empty($params['master_name']) || empty($params['master_phone'])){ + return $this->fail('缺少必要参数'); + } + $result = curl_post(env('project.worker_domain').'/middleapi/company/create',http_build_query($params),[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //修改公司 + public function edit(): Json + { + $params=$this->request->post(); + 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('缺少必要参数'); + } + $result = curl_post(env('project.worker_domain').'/middleapi/company/edit',http_build_query($params),[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //公司认证 + public function enterpriseCertification(): Json + { + $params=$this->request->post(['id']); + if(empty($params['id'])){ + return $this->fail('id不能为空'); + } + $result = curl_post(env('project.worker_domain').'/middleapi/company/enterpriseCertification',$params,[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //生成合同 + public function generateContract(): Json + { + $params=$this->request->post(['id','party_a','contract_type']); + if(empty($params['id']) || empty($params['party_a']) || empty($params['contract_type'])){ + return $this->fail('缺少必要参数'); + } + $result = curl_post(env('project.worker_domain').'/middleapi/company/generateContract',$params,[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //下属公司 + public function subsidiaryCompany(): Json + { + $params=$this->request->get(['id','page_no','page_size']); + if(empty($params['id'])){ + return $this->fail('缺少必要参数'); + } + $result = curl_post(env('project.worker_domain').'/middleapi/company/subsidiaryCompany',$params,[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //公司类型 + public function companyType(): Json + { + $result = curl_post(env('project.worker_domain').'/middleapi/company/companyType',[],[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + + //合同类型 + public function contractType(): Json + { + $result = curl_post(env('project.worker_domain').'/middleapi/company/contractType',[],[ + "appid:".env('app.app_id'), + "timestamp:".time(), + "sign:".makeSign(['appid'=>env('app.app_id'),'timestamp'=>time()],env('app.app_secret')) + ]); + if($result['code'] == 0){ + return $this->fail($result['msg']); + } + return json($result); + } + } \ No newline at end of file