123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?php
- namespace app\controller;
- use app\BaseController;
- use app\service\EnterprisesService;
- use app\service\UserService;
- use app\validate\Page;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use think\exception\ValidateException;
- use think\response\Json;
- use think\annotation\Route;
- use think\annotation\route\Middleware;
- use hg\apidoc\annotation as Apidoc;
- /**
- * @Apidoc\Title("网格监管人员信息")
- * @Apidoc\Group("gridperson")
- * @Apidoc\Sort(2)
- */
- class Gridperson extends BaseController
- {
- use ResponseJson;
- /**
- * @Apidoc\Author("yang")
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- * @Apidoc\Title("获取网格人员信息")
- * @Apidoc\Tag("网格人员查询")
- * @Apidoc\Method ("POST")
- * @Route("/getgridpersoninfolist",method="POST")
- * @Middleware({"jwt"})
- */
- public function getGridPersonInfoList(): Json{
- $page = $this->request->post();
- try {
- validate(Page::class)->check($page);
- }catch (ValidateException $e){
- $page["page"]=1;
- $page["size"] = 10;
- }
- try {
- return $this->JsonSucess(UserService::getUserInfoList($page, getXzqdmSub()));
- } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) {
- return $this->JsonError($dbE);
- }
- }
-
- /**
- * @Apidoc\Author("yang")
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- * @Apidoc\Title("网格人员信息添加")
- * @Apidoc\Tag("网格人员")
- * @Apidoc\Method ("POST")
- * @Route("/addgridperson",method="POST")
- * @Middleware({"jwt"})
- */
- public function addGridPerson(): Json{
- $data = $this->request->post();
- try {
- //validate(gridPersonInfo::class)->check($data);
- $data['creation_time'] = date('Y-m-d h:i:s', time());
- return $this->JsonSucess(UserService::saveUserInfo($data));
- }catch (ValidateException $e){
- return $this->JsonError($e->getError());
- }
- }
- /**
- * @Apidoc\Author("yang")
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- * @Apidoc\Title("通过id获取网格人员信息")
- * @Apidoc\Tag("网格人员")
- * @Apidoc\Method ("GET")
- * @Route("/getgridpersonbyid",method="GET")
- * @Middleware({"jwt"})
- */
- public function getGridPersoninfoById(): Json{
- $data = $this->request->get();
- try {
- //validate(gridPersonInfo::class)->check($data);
- return $this->JsonSucess(UserService::getgridpersonInfoById($data['id']));
- }catch (ValidateException $e){
- return $this->JsonError($e->getError());
- }
- }
- /**
- * @Apidoc\Author("yang")
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- * @Apidoc\Title("网格人员信息修改")
- * @Apidoc\Tag("网格人员")
- * @Apidoc\Method ("POST")
- * @Route("/editgridperson",method="POST")
- * @Middleware({"jwt"})
- */
- public function editGridPersoninfoById(): Json{
- $data = $this->request->post();
- try {
- //validate(gridPersonInfo::class)->check($data);
- $data['last_update_time'] = date('Y-m-d h:i:s', time());
- return $this->JsonSucess(UserService::editUserInfoById($data['id'],$data));
- }catch (ValidateException $e){
- return $this->JsonError($e->getError());
- }
- }
- /**
- * @Apidoc\Author("yang")
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- * @Apidoc\Title("通过id删除网格人员信息")
- * @Apidoc\Tag("网格人员")
- * @Apidoc\Method ("GET")
- * @Route("/deletegridperson",method="GET")
- * @Middleware({"jwt"})
- */
- public function deleteGridPersoninfoById(): Json{
- $data = $this->request->get();
- try {
- //validate(gridPersonInfo::class)->check($data);
- $data['last_update_time'] = date('Y-m-d h:i:s', time());
- return $this->JsonSucess(UserService::deleteUserInfoById($data['id']));
- }catch (ValidateException $e){
- return $this->JsonError($e->getError());
- }
- }
- }
|