From 86b17eafb56a7fe93d4484f5bf399d240aa0804b Mon Sep 17 00:00:00 2001 From: weiz <weiz@lihai.com> Date: Sat, 11 Nov 2023 14:18:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E6=9C=BA?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BusinessController.php | 83 +++++++++++++++++++ app/middleapi/service/ApiSignService.php | 4 +- 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 app/middleapi/controller/BusinessController.php 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 @@ +<?php + + namespace app\middleapi\controller; + + use app\adminapi\validate\category_business\CategoryBusinessValidate; + use app\common\controller\BaseLikeAdminController; + use app\common\logic\category_business\CategoryBusinessLogic; + use app\common\model\category_business\CategoryBusiness; + use think\response\Json; + + class BusinessController extends BaseLikeAdminController + { + //商机分类列表 + public function lists(): Json + { + if(!$this->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' => '签名已失效']; } //比对签名 From 324fa8c42279aa704700f809311066c60c5ad7a0 Mon Sep 17 00:00:00 2001 From: weiz <weiz@lihai.com> Date: Sat, 11 Nov 2023 15:36:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=BC=80=E6=94=BE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ArchivesController.php | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 app/middleapi/controller/ArchivesController.php diff --git a/app/middleapi/controller/ArchivesController.php b/app/middleapi/controller/ArchivesController.php new file mode 100644 index 000000000..7f08a62a0 --- /dev/null +++ b/app/middleapi/controller/ArchivesController.php @@ -0,0 +1,68 @@ +<?php + + namespace app\middleapi\controller; + + use app\adminapi\logic\informationg\UserInformationgLogic; + use app\adminapi\validate\informationg\UserInformationgValidate; + use app\common\controller\BaseLikeAdminController; + use app\common\model\informationg\UserInformationg; + use app\common\model\informationg\UserInformationgDemand; + use think\response\Json; + + class ArchivesController extends BaseLikeAdminController + { + //档案列表 + public function lists(): Json + { + if(!$this->request->isPost()){ + return $this->fail('请求方式错误'); + } + $params = $this->request->post(['page_no','page_size','name']); + $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'].'%']; + } + $lists = UserInformationg::where($where) + ->field(['id','create_user_id','company_id','area_id','area_id area_name','street_id','street_id street_name','village_id','village_id village_name', 'brigade_id','brigade_id brigade_name', 'address', 'name', 'phone', 'sex', 'age','update_time','create_time','status']) + ->append(['extend']) + ->order(['id' => 'desc']) + ->page($pageNo, $pageSize) + ->select() + ->toArray(); + $informationIdArray = []; + foreach($lists as $k=>$v) { + $informationIdArray[] = $v['id']; + } + $data = UserInformationgDemand::whereIn('information_id', $informationIdArray)->order('id', 'desc')->select(); + $aianalyseArray = []; + foreach($data as $kk=>$vv) { + if (!empty($vv['ai_aianalyse'])) { + $aianalyseArray[$vv['information_id']][] = $vv['id']; + } + } + foreach($lists as $k=>$v) { + $lists[$k]['aianalyse_status'] = 0; + if (!empty($aianalyseArray[$v['id']])) { + $lists[$k]['aianalyse_status'] = 1; + } + } + $count = UserInformationg::where($where)->count(); + $result = [ + 'lists' => $lists, + 'count' => $count, + 'page_no' => $pageNo, + 'page_size' => $pageSize + ]; + return $this->success('请求成功',$result); + } + + //档案详情 + public function detail(): Json + { + $params = (new UserInformationgValidate())->post()->goCheck('detail'); + $result = UserInformationgLogic::detail($params); + return $this->data($result); + } + } \ No newline at end of file