Merge branch 'feature/follow' into develop
This commit is contained in:
@@ -66,6 +66,41 @@ class CustomerController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待跟进客户列表
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function waitFollow(Request $request)
|
||||||
|
{
|
||||||
|
$userId = $request->user['id'];
|
||||||
|
$filter = Util::getParam($request, 'filter');
|
||||||
|
$page = $request->input('page', 1);
|
||||||
|
$perPage = $request->input('per_page', 10);
|
||||||
|
$where = [
|
||||||
|
['user_id', '=', $userId],
|
||||||
|
['follow_next', '<>', 0],
|
||||||
|
];
|
||||||
|
|
||||||
|
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) {
|
||||||
|
$item['follow_remaining'] = $item->follow_next-time();
|
||||||
|
$item['follow_next'] = date('Y-m-d H:i:s',$item->follow_next);
|
||||||
|
}
|
||||||
|
return Util::page($customer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户列表
|
* 客户列表
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
@@ -109,7 +144,6 @@ class CustomerController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 执行分页查询
|
// 执行分页查询
|
||||||
$query = Customer::where($where)
|
$query = Customer::where($where)
|
||||||
->orderBy('id', 'desc');
|
->orderBy('id', 'desc');
|
||||||
@@ -264,6 +298,7 @@ class CustomerController
|
|||||||
$data = [
|
$data = [
|
||||||
'follow_next' => Util::getParam($request, 'follow_next', 0),
|
'follow_next' => Util::getParam($request, 'follow_next', 0),
|
||||||
'follow_remark' => Util::getParam($request, 'follow_remark', 0),
|
'follow_remark' => Util::getParam($request, 'follow_remark', 0),
|
||||||
|
'warn' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
$res = Customer::where('id', $id)
|
$res = Customer::where('id', $id)
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ class FollowController
|
|||||||
|
|
||||||
$customer = Customer::find($customer_id);
|
$customer = Customer::find($customer_id);
|
||||||
$customer->follow_last = strtotime($res->created_at);
|
$customer->follow_last = strtotime($res->created_at);
|
||||||
|
$customer->follow_next = null;
|
||||||
|
$customer->warn = 0;
|
||||||
$customer->save();
|
$customer->save();
|
||||||
|
|
||||||
if ($res) {
|
if ($res) {
|
||||||
|
|||||||
Reference in New Issue
Block a user