查询下属客户
This commit is contained in:
@@ -5,6 +5,7 @@ namespace app\crm\controller;
|
||||
use app\common\model\Corp;
|
||||
use app\common\model\InquiryLog;
|
||||
use app\common\model\User;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\crm\model\Channel;
|
||||
use app\crm\model\Country;
|
||||
use app\crm\model\Customer;
|
||||
@@ -18,6 +19,7 @@ use support\Request;
|
||||
|
||||
class CustomerController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
/**
|
||||
* 不需要头信息的方法
|
||||
@@ -26,6 +28,35 @@ class CustomerController extends BaseController
|
||||
|
||||
protected $noNeedLogin = ['getChannel', 'getCountry'];
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new CustomerService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @param Request $request 请求对象
|
||||
* @return mixed 返回分页数据及总数
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->serviceList($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'indexFormat')
|
||||
? [$this, 'indexFormat']
|
||||
: null);
|
||||
foreach ($data['records'] as &$item) {
|
||||
$item = $this->service->getCustomer($item);
|
||||
}
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage().$e->getLine().$e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户分级
|
||||
* @param Request $request
|
||||
|
||||
Reference in New Issue
Block a user