筛选跟进列表
This commit is contained in:
@@ -66,20 +66,31 @@ class CustomerController
|
|||||||
public function waitFollow(Request $request)
|
public function waitFollow(Request $request)
|
||||||
{
|
{
|
||||||
$userId = $request->user['id'];
|
$userId = $request->user['id'];
|
||||||
|
$filter = Util::getParam($request, 'filter');
|
||||||
|
$page = $request->input('page', 1);
|
||||||
|
$perPage = $request->input('per_page', 10);
|
||||||
$where = [
|
$where = [
|
||||||
['user_id', '=', $userId],
|
['user_id', '=', $userId],
|
||||||
['follow_next', '<>', 0],
|
['follow_next', '<>', 0],
|
||||||
// ['follow_next', '<=', time() + 3600 * 24],
|
|
||||||
// ['follow_next', '>', time()],
|
|
||||||
// ['warn', '<', 1]
|
|
||||||
];
|
];
|
||||||
$customer = Customer::where($where)->whereNotNull('follow_next')->orderBy('follow_next')->get();
|
|
||||||
|
if($filter == 0){
|
||||||
|
$where[] = ['follow_next', '<=', time() + 3600 * 24];
|
||||||
|
}elseif($filter == 1){
|
||||||
|
$where[] = ['follow_next', '<=', time() + 3600 * 24*3];
|
||||||
|
}elseif($filter == 2){
|
||||||
|
$where[] = ['follow_next', '<=', time() + 3600 * 24*7];
|
||||||
|
}
|
||||||
|
$customer = Customer::where($where)
|
||||||
|
->whereNotNull('follow_next')
|
||||||
|
->orderBy('follow_next')
|
||||||
|
->paginate($perPage, ['*'], 'page', $page);
|
||||||
|
|
||||||
foreach ($customer as &$item) {
|
foreach ($customer as &$item) {
|
||||||
$item['follow_remaining'] = $item->follow_next-time();
|
$item['follow_remaining'] = $item->follow_next-time();
|
||||||
$item['follow_next'] = date('Y-m-d H:i:s',$item->follow_next);
|
$item['follow_next'] = date('Y-m-d H:i:s',$item->follow_next);
|
||||||
}
|
}
|
||||||
return Util::success($customer,trans('success'));
|
return Util::page($customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user