diff --git a/app/middleapi/controller/BusinessController.php b/app/middleapi/controller/BusinessController.php new file mode 100644 index 000000000..182531573 --- /dev/null +++ b/app/middleapi/controller/BusinessController.php @@ -0,0 +1,83 @@ +request->isPost()){ + return $this->fail('请求方式错误'); + } + $params = $this->request->post(['page_no','page_size','name','status']); + $pageNo = !empty($params['page_no']) ? $params['page_no'] : 1; + $pageSize = !empty($params['page_size']) ? $params['page_size'] : 20; + $where = []; + if(!empty($params['name'])){ + $where[] = ['name','like','%'.$params['name'].'%']; + } + if(!empty($params['status'])){ + $where[] = ['status','=',$params['status']]; + } + $data = CategoryBusiness::where($where)->field(['id', 'name', 'pid', 'sort', 'status'])->order(['id' => 'desc'])->select()->toArray(); + $count = CategoryBusiness::where($where)->count(); + $result = [ + 'lists' => linear_to_tree($data, 'children'), + 'count' => $count, + 'page_no' => $pageNo, + 'page_size' => $pageSize + ]; + return $this->success('请求成功',$result); + } + + //商机分类详情 + public function detail(): Json + { + if(!$this->request->isPost()){ + return $this->fail('请求方式错误'); + } + $params = $this->request->post(['id']); + if(empty($params['id'])){ + return $this->fail('参数错误'); + } + $data = CategoryBusiness::where('id',$params['id'])->findOrEmpty(); + return $this->success('请求成功',$data->toArray()); + } + + //新增商机分类 + public function create(): Json + { + $params = (new CategoryBusinessValidate())->post()->goCheck('add'); + $result = CategoryBusinessLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(CategoryBusinessLogic::getError()); + } + + //编辑商机分类 + public function edit(): Json + { + $params = (new CategoryBusinessValidate())->post()->goCheck('edit'); + $result = CategoryBusinessLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(CategoryBusinessLogic::getError()); + } + + //删除商机分类 + public function delete(): Json + { + $params = (new CategoryBusinessValidate())->post()->goCheck('delete'); + CategoryBusinessLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + } \ No newline at end of file diff --git a/app/middleapi/service/ApiSignService.php b/app/middleapi/service/ApiSignService.php index 674573c0a..bf2eeef17 100644 --- a/app/middleapi/service/ApiSignService.php +++ b/app/middleapi/service/ApiSignService.php @@ -23,8 +23,8 @@ class ApiSignService //检验sign是否正确 public static function verifySign($data,$appSecret): array { - // 验证请求, 2分钟失效 - if (time() - $data['timestamp'] > 20) { + // 验证请求, 10秒钟失效 + if (time() - $data['timestamp'] > 10) { return ['code' => 0, 'msg' => '签名已失效']; } //比对签名