wugg 3 years ago
parent
commit
032a531a81
3 changed files with 133 additions and 0 deletions
  1. 2 0
      app/admin/controller/Consult.php
  2. 125 0
      app/admin/controller/Exclusive.php
  3. 6 0
      app/admin/route/app.php

+ 2 - 0
app/admin/controller/Consult.php

@@ -570,6 +570,7 @@ class Consult extends Base
         if($budget_price===""){
             return error_show(1003,"参数budget_price不能为空");
         }
+        $pgNo = isset($this->post['pgNo'])&& $this->post['pgNo']!="" ? trim($this->post['pgNo']):"";
         $use_desc = isset($this->post['use_desc'])&& $this->post['use_desc']!="" ? trim($this->post['use_desc']):"";
         if($use_desc==""){
             return error_show(1003,"参数use_desc不能为空");
@@ -638,6 +639,7 @@ class Consult extends Base
                 "total_weight"=>$total_weight===""? $num*$specs_weight :$total_weight,
                 "budget_price"=>$budget_price,
                 "num"=>$num,
+                "pgNo"=>$pgNo,
                 "use_desc"=>$use_desc,
                 "remark"=>$remark,
                 "status"=>1,

+ 125 - 0
app/admin/controller/Exclusive.php

@@ -0,0 +1,125 @@
+<?php
+
+
+namespace app\admin\controller;
+
+
+use think\App;
+use think\facade\Db;
+
+class Exclusive extends Base
+{
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+    }
+
+    public function list(){
+        $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']) :"1";
+        $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']) :"10";
+        $where =[["is_del","=",0]];
+        $cat_name=isset($this->post['name']) && $this->post['name'] !==""? trim($this->post['name']) :"";
+        if($cat_name!==""){
+            $where[]=['name',"like","%$cat_name%"];
+        }
+        $pid=isset($this->post['pid']) && $this->post['pid'] !==""? intval($this->post['pid']) :"";
+        if($pid!==""){
+            $where[]=['pid',"=",$pid];
+        }
+        $status=isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']) :"";
+        if($status!==""){
+            $where[]=['status',"=",$status];
+        }
+        $count = Db::name("exclusive")->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('exclusive')->where($where)->page($page, $size)->select();
+        return app_show(0, "获取成功", ['list' =>$list, 'count' => $count]);
+    }
+
+    public function add(){
+        $name = isset($this->post['name'])&&$this->post['name']!=""? trim($this->post['name']):"";
+        if($name==""){
+            return error_show(1004,"参数name不能为空");
+        }
+        $pid =isset($this->post['pid'])&&$this->post['pid']!=="" ? intval($this->post['pid']):0;
+        $level=1;
+        $search = $name;
+        if($pid!==0){
+            $parent= Db::name("exclusive")->where(["id"=>$pid,"is_del"=>0])->find();
+            if($parent==false){
+                return error_show(1003,"父级数据未找到");
+            }
+            $search=$parent['search']."/".$name;
+            $level=$parent['level']+1;
+        }
+        $token = isset($this->post['token'])&&$this->post['token']!="" ? trim($this->post['token']):"";
+        $user =GetUserInfo($token);
+        if(empty($user)||$user['code']!=0){
+            return error_show($user['code'],$user['msg']);
+        }
+        $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
+        $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
+
+        $data=[
+            "name"=>$name,
+            "pid"=>$pid,
+            "level"=>$level,
+            "search"=>$search,
+            "createrid"=>$createrid,
+            "creater"=>$creater,
+            "status"=>0,
+            "is_del"=>0,
+            "addtime"=>date("Y-m-d H:i:s"),
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $in =Db::name("exclusive")->insert($data);
+        if($in){
+            return app_show(0,"新建成功");
+        }else{
+            return error_show(1003,"新建失败");
+        }
+    }
+
+    public function  status(){
+            $id=isset($this->post['id'])&&$this->post['id']!=="" ? intval($this->post['id']):"";
+            if($id===""){
+                return error_show(1004,"参数id不能为空");
+            }
+            $exclusive=Db::name("exclusive")->where(["id"=>$id,"is_del"=>0])->find();
+            if($exclusive==false){
+                return error_show(1004,"未找到数据");
+            }
+            $msg = $exclusive['status']==0? "启用":"禁用";
+            $exclusive['status'] = $exclusive['status']==0?1:0;
+            $exclusive['updatetime'] =date("Y-m-d H:i:s");
+            $in =Db::name("exclusive")->save($exclusive);
+            if($in){
+                return app_show(0,"{$msg}成功");
+            }else{
+                return error_show(1004,"{$msg}失败");
+            }
+    }
+
+    public function query(){
+        $where =[["is_del","=",0]];
+        $cat_name=isset($this->post['name']) && $this->post['name'] !==""? trim($this->post['name']) :"";
+        if($cat_name!==""){
+            $where[]=['name',"like","%$cat_name%"];
+        }
+        $pid=isset($this->post['pid']) && $this->post['pid'] !==""? intval($this->post['pid']) :"";
+        if($pid!==""){
+            $where[]=['pid',"=",$pid];
+        }
+        $status=isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']) :"";
+        if($status!==""){
+            $where[]=['status',"=",$status];
+        }
+        $level=isset($this->post['level']) && $this->post['level'] !==""? intval($this->post['level']) :"";
+        if($level!==""){
+            $where[]=['level',"=",$level];
+        }
+        $list = Db::name("exclusive")->where($where)->select();
+        return app_show(0,"获取成功",$list);
+    }
+}

+ 6 - 0
app/admin/route/app.php

@@ -438,4 +438,10 @@ Route::rule("plandheck","admin/Project/planCheck");
 Route::rule("projectrate","admin/Project/changeRate");
 Route::rule("projectfeeddel","admin/Project/feeddel");
 
+Route::rule("exclulist","admin/Exclusive/list");
+Route::rule("excluadd","admin/Exclusive/add");
+Route::rule("exclustatus","admin/Exclusive/status");
+Route::rule("excluquery","admin/Exclusive/qurey");
+Route::rule("excludel","admin/Exclusive/delete");
+