update
This commit is contained in:
parent
8ef091c323
commit
46620b3dca
@ -19,6 +19,7 @@ use app\adminapi\lists\BaseAdminDataLists;
|
|||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
use app\common\model\auth\Admin;
|
use app\common\model\auth\Admin;
|
||||||
use app\common\model\custom\Custom;
|
use app\common\model\custom\Custom;
|
||||||
|
use app\common\model\custom\CustomFollow;
|
||||||
use app\common\model\GeoProvince;
|
use app\common\model\GeoProvince;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,13 +94,33 @@ class CustomLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
// return $item;
|
// return $item;
|
||||||
// })
|
// })
|
||||||
// ->toArray();
|
// ->toArray();
|
||||||
return Custom::field('id,name,custom_type,province,master_name,master_position,master_telephone,master_phone,notes,add_user,create_time')
|
return Custom::field('id,name,custom_type,province,notes,master_name,master_position,master_telephone,master_phone,master_notes,add_user,create_time')
|
||||||
->where($this->searchWhere)->limit($this->limitOffset, $this->limitLength)
|
->where($this->searchWhere)->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function($item){
|
||||||
$item['custom_type_text'] = $item->custom_type_text;
|
$item['custom_type_text'] = $item->custom_type_text;
|
||||||
$admin = Admin::field('id,name')->where('id',$item['add_user'])->findOrEmpty();
|
$admin = Admin::field('id,name')->where('id',$item['add_user'])->findOrEmpty();
|
||||||
$province = GeoProvince::field('province_name')->where('province_code',$item['province'])->findOrEmpty();
|
$province = GeoProvince::field('province_name')->where('province_code',$item['province'])->findOrEmpty();
|
||||||
|
$item['last_follow_date'] = '-';
|
||||||
|
$customFollow = CustomFollow::where('custom_id', $item['id'])->order('id', 'desc')->limit(1)->findOrEmpty();
|
||||||
|
if (!$customFollow->isEmpty()) {
|
||||||
|
$interval = date_diff(date_create($customFollow['date']), date_create(date('Y-m-d H:i:s')));
|
||||||
|
if($interval->days <= 0) {
|
||||||
|
$item['last_follow_date'] = '今天';
|
||||||
|
}else if ($interval->days <= 3) {
|
||||||
|
$item['last_follow_date'] = $interval->days . '天内';
|
||||||
|
} else if ($interval->days <= 7) {
|
||||||
|
$item['last_follow_date'] = '1周内';
|
||||||
|
} else if ($interval->days <= 30) {
|
||||||
|
$item['last_follow_date'] = '30天内';
|
||||||
|
} else if ($interval->days <= 60) {
|
||||||
|
$item['last_follow_date'] = '60天内';
|
||||||
|
} else {
|
||||||
|
$item['last_follow_date'] = '超过60天内';
|
||||||
|
}
|
||||||
|
$item['next_follow_date'] = $customFollow['next_follow_date'];
|
||||||
|
}
|
||||||
|
$item['follow_total'] = CustomFollow::where('custom_id', $item['id'])->count();
|
||||||
$item['add_user_name'] = $admin['name'];
|
$item['add_user_name'] = $admin['name'];
|
||||||
$item['province_name'] = $province['province_name'];
|
$item['province_name'] = $province['province_name'];
|
||||||
unset($item['province'],$item['add_user']);
|
unset($item['province'],$item['add_user']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user