Pārlūkot izejas kodu

用户列表接口增加0号线用户筛选条件

sunxbiao 1 gadu atpakaļ
vecāks
revīzija
abd43bbce7

+ 2 - 0
app/common/dao/user/UserDao.php

@@ -164,6 +164,8 @@ class UserDao extends BaseDao
164 164
             $query->where('userRich.stockholder' , $where['stockholder']);
165 165
         })->when( (isset($where['subIdentify']) && $where['subIdentify']!='') , function ($query) use ($where) {
166 166
             $query->where('areaManage.type' ,  $where['subIdentify']);
167
+        })->when(isset($where['uid']) , function ($query) use ($where) {
168
+            $query->whereIn('User.uid' ,  $where['uid']);
167 169
         });
168 170
         $company = input('company','');
169 171
         $identify = input('identify','');

+ 12 - 0
app/common/repositories/user/UserRepository.php

@@ -450,6 +450,18 @@ class UserRepository extends BaseRepository
450 450
 
451 451
     public function getList(array $where, $page, $limit)
452 452
     {
453
+        if (!empty($where['zero_line_uid'])) {
454
+            $sql = "select getUserLevelId({$where['zero_line_uid']}) as uids";
455
+            //\think\facade\Log::info("lplpDB".$sql);
456
+            try {
457
+                $spread_user_list = Db::query($sql);
458
+            } catch (\Exception $exception) {
459
+                $spread_user_list = '';
460
+            }
461
+            $spread_user_list = explode(",", trim($spread_user_list[0]['uids'], '$,'));
462
+            $where['uid'] = $spread_user_list;
463
+        }
464
+        unset($where['zero_line_uid']);
453 465
         if(isset($where['user_card']) && $where['user_card'] !=''){
454 466
             $user_card = $where['user_card'];
455 467
             $query = $this->dao->search($where)->with(['spread' => function ($query) {

+ 2 - 1
app/controller/admin/user/User.php

@@ -100,7 +100,8 @@ class User extends BaseController
100 100
             'stockholder',
101 101
             'subIdentify',
102 102
             'user_group',
103
-            'is_show'
103
+            'is_show',
104
+            'zero_line_uid'
104 105
         ]);
105 106
 
106 107
         [$page, $limit] = $this->getPage();