|
@@ -108,6 +108,9 @@ class CustomService
|
|
|
$where[] = ['check_status', '=', 1];
|
|
|
}
|
|
|
}
|
|
|
+ if (!empty($params['check_status'])) {
|
|
|
+ $where[] = ['check_status', '=', $params['check_status']];
|
|
|
+ }
|
|
|
if (!empty($params['type'])) {
|
|
|
$where[] = ['type', '=', $params['type']];
|
|
|
}
|
|
@@ -122,7 +125,24 @@ class CustomService
|
|
|
if (!empty($params['current_status'])) {
|
|
|
$where[] = ['current_status', '=', $params['current_status']];
|
|
|
}
|
|
|
- $paginator = MarketCustomer::where($where)->orderBy('visit_time', 'desc')->paginate($size, '*', 'page', $page);
|
|
|
+ if (!empty($params['created_at'])) {
|
|
|
+ $createdAt = $params['created_at'];
|
|
|
+ if (is_array($createdAt)) {
|
|
|
+ $createdAtStart = strtotime($createdAt[0]);
|
|
|
+ $createdAtEnd = strtotime($createdAt[1]);
|
|
|
+ } else {
|
|
|
+ //本月开始和结束
|
|
|
+ $createdAtStart = strtotime(date('Y-m-01 00:00:00'));
|
|
|
+ $createdAtEnd = strtotime(date('Y-m-t 23:59:59'));
|
|
|
+ }
|
|
|
+ $where[] = [function($query) use ($createdAtStart,$createdAtEnd) {
|
|
|
+ $query->whereBetween('created_at', [$createdAtStart, $createdAtEnd]);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ $fn = function ($query) {
|
|
|
+ $query->select('name', 'mobile', 'id');
|
|
|
+ };
|
|
|
+ $paginator = MarketCustomer::with(['consultant' => $fn])->where($where)->orderBy('visit_time', 'desc')->paginate($size, '*', 'page', $page);
|
|
|
$total = $paginator->total();
|
|
|
$items = $paginator->items();
|
|
|
if (!empty($items)) {
|
|
@@ -373,6 +393,10 @@ class CustomService
|
|
|
//查询最新的跟进记录
|
|
|
$follow = MarketCustomerFollow::where('market_customer_id', $id)->orderBy('created_at', 'desc')->first();
|
|
|
$customInfo->follow = $follow;
|
|
|
+ $focus = $customInfo->focus;
|
|
|
+ if (!empty($focus)) {
|
|
|
+ $customInfo->focus = explode(',', $focus);
|
|
|
+ }
|
|
|
return json_success('', $customInfo);
|
|
|
}
|
|
|
|