dong025 2 tygodni temu
rodzic
commit
5cc17682ca
1 zmienionych plików z 11 dodań i 6 usunięć
  1. 11 6
      app/api/controller/GroupUser.php

+ 11 - 6
app/api/controller/GroupUser.php

@@ -95,9 +95,8 @@ class GroupUser extends Base
     //组员列表
     public function group_list(GroupUserModel $userModel)
     {
-        
-        $list = $userModel->where('status', 'normal')->where('pid', $this->userinfo['id'])->select();
-
+        $todayTime = strtotime('today');
+        $list = $userModel->where('status', 'normal')->where('pid', $this->userinfo['id'])->where('createtime','>=', $todayTime)->select();
         return $this->success('ok', $list);
     }
 
@@ -156,7 +155,11 @@ class GroupUser extends Base
                     $add_data['avatar']=$avatar;
                     $res=$groupUserModel->save($add_data);
                     if($res) return $this->success('添加成功',$res);
+                }else{
+                    return $this->error('头像上传失败');
                 }
+            }else{
+                return $this->error('请上传头像');
             }
         } catch (ValidateException $e) {
             return $this->error($e->getError());
@@ -170,30 +173,32 @@ class GroupUser extends Base
         $param = $this->request->post();
         try {
             validate(UserValidate::class)->scene('edit_group_user')->check($param);
+            $user = $userModel->find($this->userinfo['id']);
             $edit_data=$groupUserModel->find($param['id']);
+            if($edit_data['pid']!=$this->userinfo['id']) return $this->error('无该用户');
             
             $todayTime = strtotime('today');
 
             //判断手机号和身份证号是否注册今天是否添加到该团队
             $where_item_id_card = [];
+            $where_item_id_card[]=['id', '!=',$edit_data['id']];
             $where_item_id_card[]=['pid', '=',$this->userinfo['id']];
             $where_item_id_card[]=['id_card', '=',$param['id_card']];
-            $where_item_id_card[]=['id_card', '<>',$edit_data['id_card']];
             $where_item_id_card[]=['createtime', '>=',$todayTime];
             
             $group_user_data = $groupUserModel->where($where_item_id_card)->find();
             if(!empty($group_user_data)) return $this->error('该身份证号已添加',$param['id_card']);
             
             $where_item_mobile = [];
+            $where_item_mobile[]=['id', '!=',$edit_data['id']];
             $where_item_mobile[]=['pid', '=',$this->userinfo['id']];
             $where_item_mobile[]=['mobile', '=',$param['mobile']];
-            $where_item_mobile[]=['mobile', '<>',$edit_data['mobile']];
             $where_item_mobile[]=['createtime', '>=',$todayTime];
 
             $group_user_data = $groupUserModel->where($where_item_mobile)->find();
             if(!empty($group_user_data)) return $this->error('该手机号已添加');
 
-            $user = $userModel->find($this->userinfo['id']);
+            
             
             $pid=$user['id'];
             $time=time();