1、文件:app/Http/Services/enterprise/assess/EnterpriseAssessPlanServices.php
2、方法:getPlanUserList
整体替换这个方法:
/**
* 获取
* @param int $id
* @param int $entId
* @param array $where
* @return array
* @throws \Illuminate\Contracts\Container\BindingResolutionException
* @throws \ReflectionException
*/
public function getPlanUserList(int $id, int $entId, array $where)
{
/** @var EnterpriseAssessPlanUserServices $planService */
$planService = app()->make(EnterpriseAssessPlanUserServices::class);
$planUserId = $planService->setEntValue($entId)->column(['planid' => $id], 'test_uid');
/** @var UserEnterpriseServices $userEntService */
$userEntService = app()->make(UserEnterpriseServices::class);
if (!$planUserId) {
$planUserId = [0];
}
if ($where['uni']) {
$where['ids'] = $planUserId;
} else {
$where['notid'] = $planUserId;
}
if (!is_array($where['frame_id']) && $where['frame_id']) {
$where['frame_id'] = [$where['frame_id']];
}
unset($where['uni']);
[$page, $limit] = $this->getPageValue();
$list = $userEntService->getAssessPlanModel($where, $entId)
->select([
'enterprise_user_card.name', 'enterprise_user_card.position',
'user_enterprise.id', 'user_enterprise.card_id', 'user_enterprise.uid'
])
->with(['frame'])
->forPage($page, $limit)
->get()
->toArray();
$positions = array_column($list, 'position');
/** @var EnterpriseRankJobServices $entJobService */
$entJobService = app()->make(EnterpriseRankJobServices::class);
$jobList = $entJobService->setEntValue($entId)->column(['id' => $positions], 'name', 'id');
/** @var EnterpriseFrameServices $enterpriserService */
$enterpriserService = app()->make(EnterpriseFrameServices::class);
foreach ($list as &$item) {
$item['position_name'] = $jobList[$item['position']] ?? '';
if (!$item['frame']) {
$item['frame']['super'] = [];
}
$supUserId = $enterpriserService->getAdminUserId($entId, $item['id']);
if (!$supUserId) {
$item['frame']['super'][] = [
'card' => [
'name' => '--'
],
];
} else {
$userInfo = $userEntService->getUserInfo($supUserId, ['card_id']);
$item['frame']['super'][] = [
'card' => [
'name' => $userInfo['card']['name']
],
];
}
}
$count = $userEntService->getAssessPlanModel($where, $entId)->count();
return $this->listData($list, $count);
}
替换方法后记得重启守护进程!!!
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}