add
This commit is contained in:
parent
caad2f60cf
commit
7bc116cddf
|
@ -239,23 +239,25 @@ class TaskController extends BaseAdminController
|
||||||
public function addTask()
|
public function addTask()
|
||||||
{
|
{
|
||||||
$params = $this->request->param(); // user_id title content
|
$params = $this->request->param(); // user_id title content
|
||||||
|
foreach ($params['director_uid'] as $director_uid) {
|
||||||
|
$arr = [
|
||||||
|
'template_id' => 0,
|
||||||
|
'scheduling_plan_id' => 0,
|
||||||
|
'company_id' => $params['company_id'],
|
||||||
|
'title' => $params['title'],
|
||||||
|
'money' => 0,
|
||||||
|
'type' => 0,
|
||||||
|
'status' => $params['status'],
|
||||||
|
'content' => $params['content'],
|
||||||
|
'start_time' => time(),
|
||||||
|
'end_time' => strtotime($params['end_time']),
|
||||||
|
'director_uid' => $director_uid, // 指派给负责人
|
||||||
|
'create_time' => time(),
|
||||||
|
'update_time' => time(),
|
||||||
|
];
|
||||||
|
$task_id = (new Task())->insertGetId($arr);
|
||||||
|
}
|
||||||
|
|
||||||
$arr = [
|
|
||||||
'template_id' => 0,
|
|
||||||
'scheduling_plan_id' => 0,
|
|
||||||
'company_id' => $params['company_id'],
|
|
||||||
'title' => $params['title'],
|
|
||||||
'money' => 0,
|
|
||||||
'type' => 0,
|
|
||||||
'status' => $params['status'],
|
|
||||||
'content' => $params['content'],
|
|
||||||
'start_time' => time(),
|
|
||||||
'end_time' => strtotime($params['end_time']),
|
|
||||||
'director_uid' => $params['director_uid'], // 指派给负责人
|
|
||||||
'create_time' => time(),
|
|
||||||
'update_time' => time(),
|
|
||||||
];
|
|
||||||
$task_id = (new Task())->insertGetId($arr);
|
|
||||||
return $this->success('添加成功', ['task_id' => $task_id]);
|
return $this->success('添加成功', ['task_id' => $task_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||||
*/
|
*/
|
||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end', 'province', 'city', 'area', 'street', 'village'];
|
$allowSearch = ['keyword','channel', 'create_time_start', 'create_time_end', 'province', 'city', 'area', 'street', 'village'];
|
||||||
return array_intersect(array_keys($this->params), $allowSearch);
|
return array_intersect(array_keys($this->params), $allowSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +56,16 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||||
*/
|
*/
|
||||||
public function lists(): array
|
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";
|
$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)
|
$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'])
|
->append(['role_name'])
|
||||||
->with(['company'])
|
->with(['company'])
|
||||||
->withAttr('role_name', function ($value, $data){
|
->withAttr('role_name', function ($value, $data){
|
||||||
|
@ -71,7 +77,6 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||||
->order('id desc')
|
->order('id desc')
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
foreach ($lists as &$item) {
|
foreach ($lists as &$item) {
|
||||||
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
|
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
|
||||||
$inviteUserStatistics = ShopRequestLogic::getInviteUserInfo(['promotion_code' => $item['invite_code']]);
|
$inviteUserStatistics = ShopRequestLogic::getInviteUserInfo(['promotion_code' => $item['invite_code']]);
|
||||||
|
@ -92,7 +97,13 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||||
*/
|
*/
|
||||||
public function count(): int
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue