wugg 3 years ago
parent
commit
3d5985f317
1 changed files with 7 additions and 6 deletions
  1. 7 6
      app/admin/controller/Share.php

+ 7 - 6
app/admin/controller/Share.php

@@ -107,9 +107,9 @@ class Share extends BaseController
         $data=[
             "action_collect"=>$collect,
             "share_user"=>$user,
-            "to_user"=>$touser,
-            "to_group"=>$togroup,
-            "action"=>$action,
+            "to_user"=>$touser==0?"":$touser,
+            "to_group"=>$togroup==0?'':$togroup,
+            "action"=>$action==0?'':$action,
             "status"=>1,
             "addtime"=>date("Y-m-d H:i:s"),
             "updatetime"=>date("Y-m-d H:i:s")
@@ -163,9 +163,9 @@ class Share extends BaseController
         $data=[
             "action_collect"=>$collect,
             "share_user"=>$user,
-            "to_user"=>$touser,
-            "to_group"=>$togroup,
-            "action"=>$action,
+            "to_user"=>$touser==0?"":$touser,
+            "to_group"=>$togroup==0?'':$togroup,
+            "action"=>$action==0?'':$action,
             "updatetime"=>date("Y-m-d H:i:s")
         ];
         $result= Db::name("role_share")->where("id","=",$id)->update($data);
@@ -217,6 +217,7 @@ class Share extends BaseController
             }
         }
         $info['to_group']==0 ? $info['to_group']='':"";
+        $info['to_user']==0 ? $info['to_user']='':"";
         $togroup= $info['to_group']!="" ?Db::name("role_group")->where("id","=",$info["to_group"])->find()
             :['group_name'=>""];
         $info['share_user_name']=$share_name;