Commit 208829e8 authored by hujun's avatar hujun

后台跟进搜索

parent 5326d3ed
...@@ -23,6 +23,7 @@ use app\model\Remarks; ...@@ -23,6 +23,7 @@ use app\model\Remarks;
use app\model\ULabels; use app\model\ULabels;
use app\model\UPhoneFollowUp; use app\model\UPhoneFollowUp;
use app\model\Users; use app\model\Users;
use app\search\service\SearchService;
class Remark extends Basic class Remark extends Basic
{ {
...@@ -211,23 +212,36 @@ class Remark extends Basic ...@@ -211,23 +212,36 @@ class Remark extends Basic
if (!empty($this->params['content'])) { if (!empty($this->params['content'])) {
$where['content'] = $this->params['content']; $where['content'] = $this->params['content'];
} }
if (!empty($this->params['remark_store_id'])) { // if (!empty($this->params['remark_store_id'])) {
$where['store_id'] = (int)$this->params['remark_store_id']; // $where['store_id'] = (int)$this->params['remark_store_id'];
} // }
if (!empty($this->params['remark_district_id'])) { // if (!empty($this->params['remark_district_id'])) {
$where['district_id'] = (int)$this->params['remark_district_id']; // $where['district_id'] = (int)$this->params['remark_district_id'];
} // }
//有权限的人可以查看其它城市的跟进 //有权限的人可以查看其它城市的跟进
if (!empty($this->params['site_id'])) { if (!empty($this->params['site_id'])) {
$site_id = $this->params['site_id']; $site_id = $this->params['site_id'];
} }
if ($this->siteId == "10001" && ($this->params['agent_id'] > 0 || !empty($this->params["content"])) && empty($this->params['user_id'])) {
$searchService = new SearchService();
$params['search_content'] = $this->params['content'];
$search_result = $searchService->searchByKeyword($this->params, $this->params['pageNo'], $this->params['pageSize'], $this->params['agent_id']);
$search_result = json_decode($search_result, true);
$result = $search_result["result"]["items"];
} else {
$follow_up_service = new PhoneFollowUpService($site_id); $follow_up_service = new PhoneFollowUpService($site_id);
$result_data = $follow_up_service->getPhoneFollowList($this->params['start_date'], $this->params['end_date'], $where, $this->userId); $result_data = $follow_up_service->getPhoneFollowList($this->params['start_date'], $this->params['end_date'], $where, $this->userId);
if ($result_data['code'] == 200) { if ($result_data['code'] == 200) {
if (!empty($result_data['data'])) { $result = $result_data['data'];
foreach ($result_data['data'] as $k => $v) { } else {
$result = [];
}
}
if ($result) {
foreach ($result as $k => $v) {
if (!empty($v['user_id'])) { if (!empty($v['user_id'])) {
$user_data = $m_user->getUserById('user_name,user_phone,vip,agent_id,create_time', $v['user_id']); $user_data = $m_user->getUserById('user_name,user_phone,vip,agent_id,create_time', $v['user_id']);
$list[$k]['user_name'] = $user_data['user_name']; $list[$k]['user_name'] = $user_data['user_name'];
...@@ -249,12 +263,6 @@ class Remark extends Basic ...@@ -249,12 +263,6 @@ class Remark extends Basic
$list[$k]['id'] = $v['id']; $list[$k]['id'] = $v['id'];
} }
} }
} else {
$msg = $result_data['data'];
$code = 101;
$list = [];
}
$data['data']['list'] = $list; $data['data']['list'] = $list;
$data['data']['total'] = 40000; $data['data']['total'] = 40000;
return $this->response($code, $msg, $data); return $this->response($code, $msg, $data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment