wugg 3 years ago
parent
commit
3e57d298c9
3 changed files with 20 additions and 2 deletions
  1. 2 1
      app/admin/controller/Goodup.php
  2. 4 1
      app/admin/controller/Resign.php
  3. 14 0
      app/common.php

+ 2 - 1
app/admin/controller/Goodup.php

@@ -20,7 +20,8 @@ class Goodup extends BaseController
         $where =[["is_del","=",0]];
         $cat_id = isset($this->post['cat_id']) && $this->post['cat_id'] !=="" ? intval($this->post['cat_id']):"";
         if($cat_id!==""){
-            $where[]=['cat_id',"=",$cat_id];
+            $cat_ids=catChild($cat_id);
+            $where[]=['cat_id',"in",$cat_ids];
         }
         $good_name = isset($this->post['good_name']) && $this->post['good_name'] !=="" ? trim($this->post['good_name']):"";
         if($good_name!==""){

+ 4 - 1
app/admin/controller/Resign.php

@@ -138,7 +138,10 @@ class Resign extends BaseController
         if($good==false){
             return error_show(1004,"未找到商品数据");
         }
-        $lastime = isset($this->post['lastime'])&&$this->post['lastime']!="" ? $this->post['lastime']:date("Y-m-d H:i:s");
+        $lastime = isset($this->post['lastime'])&&$this->post['lastime']!="" ? $this->post['lastime']:"";
+        if($lastime===""){
+            return error_show(1004,"参数lastime不能为空");
+        }
         $data = GetUserInfo($token);
         if((!empty($data) && $data['code']!=0) ||empty($data) ){
             return error_show($data['code'],$data['message']);

+ 14 - 0
app/common.php

@@ -426,6 +426,20 @@ function made($var,$data=[]){
         return made($str['pid'],$data);
     }
 }
+function catChild($var,&$data=[]){
+    $str = Db::name('cat')->where(['id'=>$var])->find();
+    if($str==false){
+        return;
+    }
+    $data[]=$var;
+   $lsit = Db::name("cat")->where(["pid"=>$var,"status"=>1,"is_del"=>0])->column("id");
+   if(!empty($lsit)){
+       foreach ($lsit as $value){
+           catChild($value,$data);
+       }
+   }
+   return $data;
+}
 
 
 function makeExcluse($var,$data=[]){