wugg 2 years ago
parent
commit
38329bc60e
1 changed files with 12 additions and 12 deletions
  1. 12 12
      app/admin/controller/CatPlat.php

+ 12 - 12
app/admin/controller/CatPlat.php

@@ -85,14 +85,14 @@ use think\App;class CatPlat extends Base{
      */
     public  function edit(){
         $post = $this->post;
-         $catid =isset($post['id'])&&$post['id']!=="" ? intval($post['id']):"";
-        if($catid==""){
-           return error_show(1004,"参数 id 不能为空");
-        }
-        $cat = Db::name("cat_plat")->where(["id"=>$catid,"is_del"=>0])->find();
-        if($cat==false){
-            return error_show(1004,"未找到平台分类信息");
-        }
+//         $catid =isset($post['id'])&&$post['id']!=="" ? intval($post['id']):"";
+//        if($catid==""){
+//           return error_show(1004,"参数 id 不能为空");
+//        }
+//        $cat = Db::name("cat_plat")->where(["id"=>$catid,"is_del"=>0])->find();
+//        if($cat==false){
+//            return error_show(1004,"未找到平台分类信息");
+//        }
         $cat_id =isset($post['cat_id'])&&$post['cat_id']!=="" ? intval($post['cat_id']):"";
         if($cat_id==""){
             return error_show(1004,"参数 cat_id 不能为空");
@@ -115,9 +115,9 @@ use think\App;class CatPlat extends Base{
         if($rate==""){
            return error_show(1004,"参数 rate 不能为空");
         }
-        $ist = Db::name("cat_plat")->where([["cat_id","=",$cat_id],["platform_id","=",$plat_id],["id","<>",$catid],["is_del","=",0]])->find();
-        if($ist!=false){
-            return error_show(1004,"该平台下已存在此分类");
+        $ist = Db::name("cat_plat")->where([["cat_id","=",$cat_id],["platform_id","=",$plat_id],["is_del","=",0]])->find();
+        if($ist==false){
+            return error_show(1004,"未找到平台下分类");
         }
         $order_rate =isset($post['order_rate'])&&$post['order_rate']!=="" ? floor($post['order_rate']):"";
         if($order_rate==""){
@@ -150,7 +150,7 @@ use think\App;class CatPlat extends Base{
             "fund_code"=>$fund_code,
             "updatetime"=>date("Y-m-d H:i:s")
         ];
-        $int = Db::name("cat_plat")->where($cat)->update($data);
+        $int = Db::name("cat_plat")->where($ist)->update($data);
         return $int ? app_show(0,"更新成功"): error_show(1003,"更新失败");
     }
         /**列表