53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\crm\service;
|
|
|
|
use app\crm\model\Follow;
|
|
use app\crm\utils\Util;
|
|
|
|
class FollowService
|
|
{
|
|
|
|
public function list($param)
|
|
{
|
|
|
|
|
|
// $page = $request->input('page', 1);
|
|
// $perPage = $request->input('per_page', 10);
|
|
|
|
//客户id
|
|
$customer_id =$param['customer_id'];
|
|
|
|
$where = [];
|
|
$where['customer_id'] = $customer_id;
|
|
|
|
//用户角色
|
|
$userId = $request->user['id'];
|
|
if(Util::isEmpty($userId)){
|
|
return $this->error(trans('user_none'));
|
|
}
|
|
if($request->user['role']!=1){
|
|
$where['user_id'] = $userId;
|
|
}
|
|
|
|
//跟进id
|
|
$id = Util::getParam($request,'id');
|
|
if(!Util::isEmpty($id)){
|
|
$where['id'] = $id;
|
|
}
|
|
|
|
// 执行分页查询
|
|
$data = Follow::where($where)
|
|
->orderBy('id', 'desc')->get();
|
|
// ->paginate($perPage, ['*'], 'page', $page);
|
|
|
|
|
|
// $host = $request->host();
|
|
$url = 'http:'.$request->url();
|
|
foreach ($data as &$value){
|
|
$value = Follow::getFollow($value);
|
|
}
|
|
|
|
return $this->success($data,trans('success'));
|
|
}
|
|
} |