From 5dc6a1379ff85ae89d4351703b32173c2b8cbf53 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Thu, 21 Apr 2022 11:57:12 +0800 Subject: [PATCH] setter --- app/controller/manager/Area.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/controller/manager/Area.php b/app/controller/manager/Area.php index 932d13e..f512487 100644 --- a/app/controller/manager/Area.php +++ b/app/controller/manager/Area.php @@ -76,4 +76,22 @@ class Area extends Base return $this->json(4000, '非法请求'); } + /** + * 排序 + * @return Json + */ + public function sort() + { + if (!$this->request->isPost()) { + return $this->json(4000, '非法请求'); + } + $id = $this->request->param('id/d', 0); + $sort = $this->request->param('sort/d', 0); + if (!$info = AreaModel::findById($id)) { + return $this->json(4001, '记录不存在'); + } + $info->save(["sort"=>$sort]); + return $this->json(); + } + } \ No newline at end of file