This commit is contained in:
chenbo 2024-02-03 14:19:42 +08:00
parent caad2f60cf
commit 7bc116cddf
2 changed files with 33 additions and 20 deletions

View File

@ -239,7 +239,7 @@ class TaskController extends BaseAdminController
public function addTask()
{
$params = $this->request->param(); // user_id title content
foreach ($params['director_uid'] as $director_uid) {
$arr = [
'template_id' => 0,
'scheduling_plan_id' => 0,
@ -251,11 +251,13 @@ class TaskController extends BaseAdminController
'content' => $params['content'],
'start_time' => time(),
'end_time' => strtotime($params['end_time']),
'director_uid' => $params['director_uid'], // 指派给负责人
'director_uid' => $director_uid, // 指派给负责人
'create_time' => time(),
'update_time' => time(),
];
$task_id = (new Task())->insertGetId($arr);
}
return $this->success('添加成功', ['task_id' => $task_id]);
}

View File

@ -56,10 +56,16 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
*/
public function lists(): array
{
$params = $this->params;
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract,group_id,invite_code";
$lists = User::withSearch($this->setSearch(), $this->params)
->when(!empty($params['nickname']),function($query)use($params){
$query->where('nickname', 'like', '%' . $this->params['nickname'] . '%');
})
->when(!empty($params['group_id']),function($query)use($params){
$query->where('group_id', $params['group_id']);
})
->append(['role_name'])
->with(['company'])
->withAttr('role_name', function ($value, $data){
@ -71,7 +77,6 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
->order('id desc')
->select()
->toArray();
foreach ($lists as &$item) {
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
$inviteUserStatistics = ShopRequestLogic::getInviteUserInfo(['promotion_code' => $item['invite_code']]);
@ -92,7 +97,13 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
*/
public function count(): int
{
return User::withSearch($this->setSearch(), $this->params)->count();
$params = $this->params;
return User::withSearch($this->setSearch(), $this->params) ->when(!empty($params['nickname']),function($query)use($params){
$query->where('nickname', 'like', '%' . $this->params['nickname'] . '%');
})
->when(!empty($params['group_id']),function($query)use($params){
$query->where('group_id', $params['group_id']);
})->count();
}