78 lines
2.2 KiB
PHP
78 lines
2.2 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace app\adminapi\controller\archives;
|
||
|
|
||
|
use app\adminapi\controller\BaseAdminController;
|
||
|
use think\response\Json;
|
||
|
|
||
|
class BusinessController 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','name','status']);
|
||
|
$result = curl_post(env('project.worker_domain').'/middleapi/business/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/business/detail',$params,$this->reqHeader);
|
||
|
if($result['code'] == 0){
|
||
|
return $this->fail($result['msg']);
|
||
|
}
|
||
|
return json($result);
|
||
|
}
|
||
|
|
||
|
//新增商机分类
|
||
|
public function create(): Json
|
||
|
{
|
||
|
$params = $this->request->post(['name','pid','sort','status']);
|
||
|
$result = curl_post(env('project.worker_domain').'/middleapi/business/create',$params,$this->reqHeader);
|
||
|
if($result['code'] == 0){
|
||
|
return $this->fail($result['msg']);
|
||
|
}
|
||
|
return json($result);
|
||
|
}
|
||
|
|
||
|
//编辑商机分类
|
||
|
public function edit(): Json
|
||
|
{
|
||
|
$params = $this->request->post(['id','name','pid','sort','status']);
|
||
|
$result = curl_post(env('project.worker_domain').'/middleapi/business/edit',$params,$this->reqHeader);
|
||
|
if($result['code'] == 0){
|
||
|
return $this->fail($result['msg']);
|
||
|
}
|
||
|
return json($result);
|
||
|
}
|
||
|
|
||
|
//删除商机分类
|
||
|
public function delete(): Json
|
||
|
{
|
||
|
$params = $this->request->post(['id']);
|
||
|
$result = curl_post(env('project.worker_domain').'/middleapi/business/delete',$params,$this->reqHeader);
|
||
|
if($result['code'] == 0){
|
||
|
return $this->fail($result['msg']);
|
||
|
}
|
||
|
return json($result);
|
||
|
}
|
||
|
}
|