wugg 2 years ago
parent
commit
a48069506c
1 changed files with 13 additions and 5 deletions
  1. 13 5
      app/admin/controller/TagGood.php

+ 13 - 5
app/admin/controller/TagGood.php

@@ -40,11 +40,15 @@ class TagGood extends BaseController{
         $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']):15;
         $type = isset($this->post['type'])&&$this->post['type']!=''?intval($this->post['type']):'';
+        $status = isset($this->post['status'])&&$this->post['status']!==''?intval($this->post['status']):'';
         $condition =[["is_del","=",0]];
         if($type!=''){
             $condition[]=["type","=",$type];
         }
-         $tagName =isset($post['tag_name'])&&$post['tag_name']!='' ? trim($post['tag_name']):"";
+        if($status!==''){
+            $condition[]=["status","=",$status];
+        }
+         $tagName =isset($this->post['tag_name'])&&$this->post['tag_name']!='' ? trim($this->post['tag_name']):"";
         if($tagName!=''){
           $condition[]=["tag_name","like","%$tagName%"];
         }
@@ -52,7 +56,7 @@ class TagGood extends BaseController{
         $total=ceil($count/$size);
         $page = $page>=$total ? intval($total):$page;
         $list =Db::name("order_tag")->where($condition)->page($page,$size)->order("addtime desc")->select()->toArray();
-        return error_show(1004,"获取成功",["list"=>$list,"count"=>$count]);
+        return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
     }
     //根据条件筛选合适的标签数据
     public function query(){
@@ -61,12 +65,16 @@ class TagGood extends BaseController{
         if($type!=''){
             $condition[]=["type","=",$type];
         }
-         $tagName =isset($post['tag_name'])&&$post['tag_name']!='' ? trim($post['tag_name']):"";
+         $tagName =isset($this->post['tag_name'])&&$this->post['tag_name']!='' ? trim($this->post['tag_name']):"";
         if($tagName!=''){
           $condition[]=["tag_name","like","%$tagName%"];
+        }
+        $status = isset($this->post['status'])&&$this->post['status']!==''?intval($this->post['status']):'';
+         if($status!==''){
+            $condition[]=["status","=",$status];
         }
          $list =Db::name("order_tag")->where($condition)->order("addtime desc")->select()->toArray();
-        return error_show(1004,"获取成功",$list);
+        return app_show(0,"获取成功",$list);
     }
     //启禁用状态
     public function status(){
@@ -92,7 +100,7 @@ class TagGood extends BaseController{
         if($id==''){
             return error_show(1004,"参数 id 不能为空");
         }
-        $taginfo =Db::name("order_tag")->find(["id"=>$id]);
+        $taginfo =Db::name("order_tag")->where(["id"=>$id,"is_del"=>0])->find();
         if($taginfo==false){
              return error_show(1004,"标签数据不存在");
         }