Commit 9dfb6502 authored by clone's avatar clone

bug

parent bc837e32
...@@ -62,21 +62,21 @@ class OrderLog extends Basic ...@@ -62,21 +62,21 @@ class OrderLog extends Basic
$is_ok = $this->o_march_in_model->addMarchIn($params); $is_ok = $this->o_march_in_model->addMarchIn($params);
$is_ok=1; $is_ok = 1;
if ($is_ok > 0) { if ($is_ok > 0) {
$ge_tui = new GeTuiUntils(); $ge_tui = new GeTuiUntils();
$report = new OReportModel(); $report = new OReportModel();
$field = 'house_title,user_name'; $field = 'house_title,user_name';
$report_data = $report->getReportOrder($field, ['a.id'=>$params["report_id"]]); $report_data = $report->getReportOrder($field, [ 'a.id' => $params["report_id"] ]);
$agent = new AAgents(); $agent = new AAgents();
$agent_data = $agent->getAgentInfo('device_id,store_id',$params['reception_id']); $agent_data = $agent->getAgentInfo('device_id,store_id', $params['reception_id']);
$content = "客户{$report_data['user_name']}进场【{$report_data['house_title']}】商铺"; $content = "客户{$report_data['user_name']}进场【{$report_data['house_title']}】商铺";
$where['store_id'] = $agent_data['store_id']; $where['store_id'] = $agent_data['store_id'];
$where['level'] = 20; $where['level'] = 20;
$agent_store = $agent->getAgentInfo('id,device_id','',$where); $agent_store = $agent->getAgentInfo('id,device_id', '', $where);
$ge_tui->public_push_message_for_one($params['reception_id'], $agent_data['device_id'],'进场', $content); $ge_tui->public_push_message_for_one($params['reception_id'], $agent_data['device_id'], '进场', $content);
$ge_tui->public_push_message_for_one($agent_store['reception_id'], $agent_store['device_id'],'进场', $content); $ge_tui->public_push_message_for_one($agent_store['reception_id'], $agent_store['device_id'], '进场', $content);
return $this->response("200", "request success", []); return $this->response("200", "request success", []);
} else { } else {
...@@ -290,7 +290,7 @@ class OrderLog extends Basic ...@@ -290,7 +290,7 @@ class OrderLog extends Basic
/* $params = array( /* $params = array(
"type" => 0, //0.客户电话 1.客户姓名 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址 "type" => 0, //0.客户电话 1.客户姓名 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址
"agent_id"=>630, "agent_id"=>630,
"search_keyword" => "14444" "search_keyword" => "1"
);*/ );*/
if (!isset($params["type"]) || !isset($params["agent_id"]) || !isset($params["search_keyword"])) { if (!isset($params["type"]) || !isset($params["agent_id"]) || !isset($params["search_keyword"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
...@@ -406,7 +406,8 @@ class OrderLog extends Basic ...@@ -406,7 +406,8 @@ class OrderLog extends Basic
* @return \think\Response * @return \think\Response
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function addBargain() { public function addBargain()
{
$data['code'] = 200; $data['code'] = 200;
$data['msg'] = ""; $data['msg'] = "";
$data['data'] = []; $data['data'] = [];
......
...@@ -21,7 +21,6 @@ class Report extends Basic ...@@ -21,7 +21,6 @@ class Report extends Basic
private $fulModel; private $fulModel;
public function __construct($request = null) public function __construct($request = null)
{ {
parent::__construct($request); parent::__construct($request);
...@@ -82,8 +81,9 @@ class Report extends Basic ...@@ -82,8 +81,9 @@ class Report extends Basic
* 获取报备列表 * 获取报备列表
* @return \think\Response * @return \think\Response
*/ */
public function reportList(){ public function reportList()
/* $params = array( {
/* $params = array(
"agent_id" =>1, "agent_id" =>1,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告 "type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1, "page_no"=>1,
...@@ -91,7 +91,7 @@ class Report extends Basic ...@@ -91,7 +91,7 @@ class Report extends Basic
);*/ );*/
$params = $this->params; $params = $this->params;
if(!isset($params["agent_id"]) || !isset($params["type"])){ if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
...@@ -101,16 +101,15 @@ class Report extends Basic ...@@ -101,16 +101,15 @@ class Report extends Basic
$field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,b.id as order_id,b.order_no,b.house_id,b.house_title"; $field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,b.id as order_id,b.order_no,b.house_id,b.house_title";
$params["report_agent_id"] = $params["agent_id"]; $params["report_agent_id"] = $params["agent_id"];
$result = $this->service_->orderList($field,$params,$pageNo,$pageSize); $result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
return $this->response("200","request success",$result); return $this->response("200", "request success", $result);
} }
/** /**
* 新增跟进 * 新增跟进
* @return \think\Response * @return \think\Response
......
...@@ -283,24 +283,29 @@ class OrderLogService ...@@ -283,24 +283,29 @@ class OrderLogService
*/ */
public function getSearchOrder($params) public function getSearchOrder($params)
{ {
$condition = []; $condition = $where_ = "1=1 ";
$field = "a.id,a.order_no,a.f_id,a.house_id,a.house_title,b.report_agent_id,b.report_agent_phone,b.report_agent_name, $field = "a.id,a.order_no,a.f_id,a.house_id,a.house_title,b.report_agent_id,b.report_agent_phone,b.report_agent_name,
b.user_id,b.user_phone,b.user_name,b.predict_see_time"; b.user_id,b.user_phone,b.user_name,b.predict_see_time";
switch ((int)$params["type"]) { switch ((int)$params["type"]) {
case 0: case 0:
$condition["b.user_phone"] = array( 'like', "%" . trim($params['search_keyword']) . "%" ); // $condition["b.user_phone"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition .= "and b.user_phone like '%" . trim($params['search_keyword']) . "%' ";
break; break;
case 1: case 1:
$condition["b.user_name"] = array( 'like', "%" . trim($params['search_keyword']) . "%" ); // $condition["b.user_name"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition .= "and b.user_name like '%" . trim($params['search_keyword']) . "%' ";
break; break;
case 2: case 2:
$condition["b.report_agent_phone"] = array( 'like', "%" . trim($params['search_keyword']) . "%" ); //$condition["b.report_agent_phone"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition .= "and b.report_agent_phone like '%" . trim($params['search_keyword']) . "%' ";
break; break;
case 3: case 3:
$condition["b.report_agent_name"] = array( 'like', "%" . trim($params['search_keyword']) . "%" ); //$condition["b.report_agent_name"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition .= "and b.report_agent_name like '%" . trim($params['search_keyword']) . "%' ";
break; break;
case 4: case 4:
$condition["b.house_title"] = array( 'like', "%" . trim($params['search_keyword']) . "%" ); //$condition["b.house_title"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition .= "and b.house_title like '%" . trim($params['search_keyword']) . "%' ";
break; break;
case 5: case 5:
//todo 列表没有显示商铺地址 和产品沟通暂时搁置 //todo 列表没有显示商铺地址 和产品沟通暂时搁置
...@@ -309,13 +314,33 @@ class OrderLogService ...@@ -309,13 +314,33 @@ class OrderLogService
default: default:
return [ "code" => "101", "msg" => "搜索类型错误" ]; return [ "code" => "101", "msg" => "搜索类型错误" ];
} }
if (isset($params["agent_id"])) { /* if (isset($params["agent_id"])) {
$condition["b.report_agent_id"] = array( "eq", $params["agent_id"] ); $condition["b.report_agent_id"] = array( "eq", $params["agent_id"] );
}*/
$vModel = new VerifyService();
$agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
if ($agentArr) {
//$params["report_agent_id"] = $agentArr;
$condition .= "and b.report_agent_id in (" . trim($agentArr) .") ";
}
$caseHouseId = $vModel->getCaseHouseIdByAgentId($params["report_agent_id"]);
$ids = "";
foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ",";
} }
$ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0;
//$params["house_ids"] = $ids;
$where_ .= "and a.house_id in ($ids)";
$orderModel = new OrderModel(); $orderModel = new OrderModel();
$result = $orderModel->searchOrder($field, $condition); $result = $orderModel->searchOrder($field, $condition,$where_);
$ids_str = ""; $ids_str = "";
if (count($result) <= 0) { if (count($result) <= 0) {
......
...@@ -245,7 +245,7 @@ class PerformanceService ...@@ -245,7 +245,7 @@ class PerformanceService
} }
private function getOrderList($params, $type) public function getOrderList($params, $type)
{ {
$result = []; $result = [];
//1带看 2进场 3收款 4成交报告 //1带看 2进场 3收款 4成交报告
......
...@@ -85,7 +85,7 @@ class ReportService ...@@ -85,7 +85,7 @@ class ReportService
array_push($order_arr, $this->orderBin($order_no, $id, $v)); array_push($order_arr, $this->orderBin($order_no, $id, $v));
$device_id = $agent->getAgentList($v); $device_id = $agent->getAgentList($v);
foreach ($device_id as $k=>$v) { foreach ($device_id as $k => $v) {
$content = "【{$v['store_name']}】店【{$agent_name}】约带看【{$order_arr['house_title']}】商铺"; $content = "【{$v['store_name']}】店【{$agent_name}】约带看【{$order_arr['house_title']}】商铺";
$ge_tui->public_push_message_for_one($v['id'], $v['device_id'], '报备', $content); $ge_tui->public_push_message_for_one($v['id'], $v['device_id'], '报备', $content);
} }
...@@ -110,16 +110,25 @@ class ReportService ...@@ -110,16 +110,25 @@ class ReportService
//todo 获取我报备的我的案场的,如果是店长则获取其下所有的经纪人 //todo 获取我报备的我的案场的,如果是店长则获取其下所有的经纪人
$vModel = new VerifyService(); $vModel = new VerifyService();
$agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]); $agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
dump($agentArr);
if ($agentArr) { if ($agentArr) {
$params["report_agent_id"] = array("in",$agentArr); $params["report_agent_id"] = $agentArr;
} }
$caseHouseId = $vModel->getCaseHouseIdByAgentId($params["report_agent_id"]);
$ids = "";
foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ",";
}
$ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0;
$params["house_ids"] = $ids;
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize); $result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
$ids_str = ""; $ids_str = "";
if (count($result) > 0) { if (count($result) > 0) {
foreach ($result as $k => $v) { foreach ($result as $k => $v) {
$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]); //$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
$ids_str .= $v["order_id"] . ","; $ids_str .= $v["order_id"] . ",";
} }
...@@ -141,6 +150,7 @@ class ReportService ...@@ -141,6 +150,7 @@ class ReportService
return null; return null;
} }
public function orderSign($ids_str) public function orderSign($ids_str)
{ {
......
This diff is collapsed.
...@@ -98,13 +98,42 @@ class OrderModel extends Model ...@@ -98,13 +98,42 @@ class OrderModel extends Model
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
public function searchOrder($field,$params){ public function searchOrder($field,$params,$where_){
return $this->db_
/* $result = $this->db_
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_report b","a.f_id = b.id","left") ->join("o_report b","a.f_id = b.id","left")
->union('SELECT '.$field.' FROM o_order a left join o_report b on a.f_id = b.id where '.$params)
->where($params) ->where($params)
->select(); ->select();*/
$sql = "SELECT * FROM
(
(
SELECT
$field
FROM
`o_order` `a`
LEFT JOIN `o_report` `b` ON `a`.`f_id` = `b`.`id`
WHERE
$params
)
UNION
(
SELECT
$field
FROM
`o_order` `a`
LEFT JOIN `o_report` `b` ON `a`.`f_id` = `b`.`id`
WHERE
$where_
)
) AS aaa";
$result = $this->db_->query($sql);
// echo $this->db_->getLastSql();
return $result ;
} }
......
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