查询下属客户

This commit is contained in:
2025-08-08 15:52:13 +08:00
parent 8ebdb052dc
commit 859fd1cff1
5 changed files with 88 additions and 2 deletions
+31
View File
@@ -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