Commit 160b215c by mushishixian

修复采购员显示问题

parent efe5920b
...@@ -66,7 +66,7 @@ class SupplierTransformer ...@@ -66,7 +66,7 @@ class SupplierTransformer
{ {
$canViewAllChannelUser = checkPerm('ViewAllChannelUser'); $canViewAllChannelUser = checkPerm('ViewAllChannelUser');
$intracodeModel = new IntracodeModel(); $intracodeModel = new IntracodeModel();
$userCodes = $intracodeModel->getSampleEncode(); $userCodes = $intracodeModel->getAllSampleEncode();
$data = []; $data = [];
$channelUidList = explode(',', $channelUid); $channelUidList = explode(',', $channelUid);
$channelUidList = array_unique($channelUidList); $channelUidList = array_unique($channelUidList);
......
...@@ -11,6 +11,7 @@ class IntracodeModel extends Model ...@@ -11,6 +11,7 @@ class IntracodeModel extends Model
protected $table = 'lie_intracode'; protected $table = 'lie_intracode';
protected $primaryKey = 'code_id'; protected $primaryKey = 'code_id';
//不包含离职
public function getEncode() public function getEncode()
{ {
$redis = new RedisModel(); $redis = new RedisModel();
...@@ -33,6 +34,27 @@ class IntracodeModel extends Model ...@@ -33,6 +34,27 @@ class IntracodeModel extends Model
return $codeList; return $codeList;
} }
//包含离职的
public function getAllEncode()
{
$redis = new RedisModel();
$codeList = json_decode($redis->get('EncodedList_supplier'), true);
if (!$codeList) {
$codeList = $this->where('admin_id', '>', 0)->join('user_info', 'lie_intracode.admin_id', '=', 'user_info.userId')
->select('code_id', 'admin_id', 'name', 'email')->get();
if ($codeList) {
$codeList = $codeList->toArray();
foreach ($codeList as $k => &$v) {
if (empty($v['name'])) {
$v['name'] = $v['email'];
}
}
$redis->set('EncodedList_supplier', json_encode($codeList));
$redis->expire('EncodedList_supplier', 60 * 10);//缓存10分钟
}
}
return $codeList;
}
//获取简单的内部用户数据 //获取简单的内部用户数据
public function getSampleEncode() public function getSampleEncode()
...@@ -45,6 +67,17 @@ class IntracodeModel extends Model ...@@ -45,6 +67,17 @@ class IntracodeModel extends Model
return $result; return $result;
} }
//获取简单的内部用户数据(包含离职)
public function getAllSampleEncode()
{
$codeList = $this->getAllEncode();
$result = [];
foreach ($codeList as $code) {
$result[$code['code_id']] = $code['name'] . '(' . $code['code_id'] . ')';
}
return $result;
}
//获取采购员和对应的编码 //获取采购员和对应的编码
public function getChannelUsersEncode() public function getChannelUsersEncode()
{ {
......
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