This commit is contained in:
weiz 2024-01-20 15:56:37 +08:00
parent cab785f42b
commit e8909c74cf
2 changed files with 7 additions and 7 deletions

View File

@ -40,7 +40,7 @@ class CustomFollowLists extends BaseAdminDataLists implements ListsSearchInterfa
public function setSearch(): array public function setSearch(): array
{ {
return [ return [
'%like%' => ['name', 'contacts', 'executor'], '%like%' => ['name', 'executor'],
'=' => ['custom_id','types'] '=' => ['custom_id','types']
]; ];
} }
@ -63,15 +63,16 @@ class CustomFollowLists extends BaseAdminDataLists implements ListsSearchInterfa
$custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id'); $custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
$where[] = ['custom_id','in',$custom_ids]; $where[] = ['custom_id','in',$custom_ids];
} }
return CustomFollow::field('id,custom_id,name,contacts,date,types,executor,description,coordinate,next_follow_date,add_user,update_user,create_time,update_time') return CustomFollow::field('id,custom_id,name,date,types,executor,description,coordinate,next_follow_date,add_user,update_user,create_time,update_time')
->where($this->searchWhere)->where($where) ->where($this->searchWhere)->where($where)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function($item){ ->select()->each(function($item){
$item['types_text'] = $item->types_text; $item['types_text'] = $item->types_text;
$custom = Custom::field('name')->where('id',$item['custom_id'])->findOrEmpty(); $custom = Custom::field('name,master_name')->where('id',$item['custom_id'])->findOrEmpty();
$admin = Admin::where('id','in',[$item['add_user'],$item['update_user']])->column('name','id'); $admin = Admin::where('id','in',[$item['add_user'],$item['update_user']])->column('name','id');
$item['custom_name'] = $custom['name']; $item['custom_name'] = $custom['name'];
$item['custom_master_name'] = $custom['master_name'];
$item['add_user'] = $admin[$item['add_user']]; $item['add_user'] = $admin[$item['add_user']];
$item['update_user'] = $admin[$item['update_user']]; $item['update_user'] = $admin[$item['update_user']];
return $item; return $item;

View File

@ -44,7 +44,6 @@ class CustomFollowLogic extends BaseLogic
CustomFollow::create([ CustomFollow::create([
'custom_id' => $params['custom_id'], 'custom_id' => $params['custom_id'],
'name' => $params['name'], 'name' => $params['name'],
'contacts' => $params['contacts'] ?? '',
'date' => strtotime($params['date']), 'date' => strtotime($params['date']),
'types' => $params['types'], 'types' => $params['types'],
'description' => $params['description'] ?? '', 'description' => $params['description'] ?? '',
@ -79,7 +78,6 @@ class CustomFollowLogic extends BaseLogic
CustomFollow::where('id', $params['id'])->update([ CustomFollow::where('id', $params['id'])->update([
'custom_id' => $params['custom_id'], 'custom_id' => $params['custom_id'],
'name' => $params['name'], 'name' => $params['name'],
'contacts' => $params['contacts'] ?? '',
'date' => strtotime($params['date']), 'date' => strtotime($params['date']),
'types' => $params['types'], 'types' => $params['types'],
'description' => $params['description'] ?? '', 'description' => $params['description'] ?? '',
@ -122,9 +120,10 @@ class CustomFollowLogic extends BaseLogic
*/ */
public static function detail($params): array public static function detail($params): array
{ {
$data = CustomFollow::field('id,custom_id,name,contacts,date,types,description,annex,coordinate,next_follow_date,executor')->findOrEmpty($params['id']); $data = CustomFollow::field('id,custom_id,name,date,types,description,annex,coordinate,next_follow_date,executor')->findOrEmpty($params['id']);
$custom = Custom::field('name')->where('id',$data['custom_id'])->findOrEmpty(); $custom = Custom::field('name,master_name')->where('id',$data['custom_id'])->findOrEmpty();
$data['custom_name'] = $custom['name']; $data['custom_name'] = $custom['name'];
$data['custom_master_name'] = $custom['master_name'];
return $data->toArray(); return $data->toArray();
} }
} }