Commit 66dbed48 by mushishixian

fix

parent 43dbd620
Showing with 7 additions and 6 deletions
......@@ -86,7 +86,7 @@ class IntracodeModel extends Model
}
//获取采购员和对应的编码
public function getChannelUsersEncode()
public function getChannelUsersEncode($includeResign = true)
{
$redis = new RedisModel();
$result = json_decode($redis->get('department_user_encode_list'), true);
......@@ -102,13 +102,13 @@ class IntracodeModel extends Model
$userChannel = $departmentService->getUserByDepartmentId(8);
$users = array_merge(array_merge($usersMarket, $usersOperation), $userChannel);
$userIds = array_column($users, 'userId');
$users = $this->getEncodeByUserIds($userIds);
$users = $this->getEncodeByUserIds($userIds, $includeResign);
$result = [];
foreach ($users as $code) {
$result[$code['code_id']] = $code['name'] . '(' . $code['code_id'] . ')';
}
$redis->set('department_user_encode_list', json_encode($result));
$redis->expire('department_user_encode_list', 600);
$redis->expire('department_user_encode_list', 10);
return $result;
}
......@@ -123,11 +123,12 @@ class IntracodeModel extends Model
return $result;
}
public function getEncodeByUserIds($userIds = [])
public function getEncodeByUserIds($userIds = [], $includeResign = true)
{
$code = $this->where('admin_id', '>', 0)->join('user_info', 'lie_intracode.admin_id', '=', 'user_info.userId')
$query = $this->where('admin_id', '>', 0)->join('user_info', 'lie_intracode.admin_id', '=', 'user_info.userId')
->whereIn('user_info.userId', $userIds)
->select('code_id', 'admin_id', 'name', 'email', 'mobile')->get();
->select('code_id', 'admin_id', 'name', 'email', 'mobile');
$code = $includeResign ? $query->get() : $query->where('user_info.status', '!=', 4)->get();
if ($code) {
$code = $code->toArray();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment