Merge pull request 'update' (#102) from zhangwei into dev

Reviewed-on: #102
This commit is contained in:
weiz 2024-01-02 16:38:04 +08:00
commit 0c8f3c37b6

View File

@ -20,6 +20,8 @@ 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\custom\CustomFollow;
use app\common\model\GeoArea;
use app\common\model\GeoCity;
use app\common\model\GeoProvince; use app\common\model\GeoProvince;
/** /**
@ -64,28 +66,16 @@ class CustomLists extends BaseAdminDataLists implements ListsSearchInterface
$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'] = '-'; $city = GeoCity::field('city_name')->where('city_code',$item['city'])->findOrEmpty();
$customFollow = CustomFollow::where('custom_id', $item['id'])->order('id', 'desc')->limit(1)->findOrEmpty(); $area = GeoArea::field('area_name')->where('area_code',$item['area'])->findOrEmpty();
if (!$customFollow->isEmpty()) { $customFollow = CustomFollow::field('date,next_follow_date')->where('custom_id', $item['id'])->order('id', 'desc')->limit(1)->findOrEmpty();
$interval = date_diff(date_create($customFollow['date']), date_create(date('Y-m-d H:i:s'))); $item['next_follow_date'] = $customFollow['next_follow_date'];
if($interval->days <= 0) { $item['last_follow_date'] = $customFollow['date'];
$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['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'];
$item['city_name'] = $province['city_name'];
$item['area_name'] = $province['area_name'];
unset($item['province'],$item['add_user']); unset($item['province'],$item['add_user']);
return $item; return $item;
}) })