diff --git a/app/adminapi/lists/custom/CustomLists.php b/app/adminapi/lists/custom/CustomLists.php index 7ee67a9d9..d3433adee 100644 --- a/app/adminapi/lists/custom/CustomLists.php +++ b/app/adminapi/lists/custom/CustomLists.php @@ -20,6 +20,8 @@ use app\common\lists\ListsSearchInterface; use app\common\model\auth\Admin; use app\common\model\custom\Custom; use app\common\model\custom\CustomFollow; +use app\common\model\GeoArea; +use app\common\model\GeoCity; use app\common\model\GeoProvince; /** @@ -64,28 +66,16 @@ class CustomLists extends BaseAdminDataLists implements ListsSearchInterface $item['custom_type_text'] = $item->custom_type_text; $admin = Admin::field('id,name')->where('id',$item['add_user'])->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']; - } + $city = GeoCity::field('city_name')->where('city_code',$item['city'])->findOrEmpty(); + $area = GeoArea::field('area_name')->where('area_code',$item['area'])->findOrEmpty(); + $customFollow = CustomFollow::field('date,next_follow_date')->where('custom_id', $item['id'])->order('id', 'desc')->limit(1)->findOrEmpty(); + $item['next_follow_date'] = $customFollow['next_follow_date']; + $item['last_follow_date'] = $customFollow['date']; $item['follow_total'] = CustomFollow::where('custom_id', $item['id'])->count(); $item['add_user_name'] = $admin['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']); return $item; })