Commit 5b776c20 authored by clone's avatar clone

bug

parent 21a94415
...@@ -382,15 +382,16 @@ class PerformanceService ...@@ -382,15 +382,16 @@ class PerformanceService
if (count($list) > 0) { if (count($list) > 0) {
foreach ($list as $key => $item) { foreach ($list as $key => $item) {
if ($is_store == 2) { if ($is_store == 2) {
$fields = "a.name,b.store_name"; $fields = "a.name,b.store_name";
$where_["a.level"] = array('in', "20,40"); $where_["a.level"] = array( 'in', "20,40" );
$where_["a.store_id"] = $item["store_id"];
$where_["c.id"] = $item["agent_id"];
} else { } else {
$fields = "c.name,b.store_name"; $fields = "a.name,b.store_name";
$where_["a.id"] = $item["agent_id"];
} }
$where_["a.store_id"] = $item["store_id"]; $info = $this->agentModel->getStoreOrAgentInfo($fields, $where_, $is_store);
$where_["c.id"] = $item["agent_id"];
$info = $this->agentModel->getStoreOrAgentInfo($fields, $where_);
if (count($info) > 0) { if (count($info) > 0) {
$list[$key]["store_name"] = $info[0]["store_name"]; $list[$key]["store_name"] = $info[0]["store_name"];
$list[$key]["name"] = $info[0]["name"]; $list[$key]["name"] = $info[0]["name"];
...@@ -461,6 +462,7 @@ class PerformanceService ...@@ -461,6 +462,7 @@ class PerformanceService
return $params; return $params;
} }
/** /**
* 获取房源数据 * 获取房源数据
* @param $type * @param $type
...@@ -570,7 +572,6 @@ class PerformanceService ...@@ -570,7 +572,6 @@ class PerformanceService
} }
/** /**
* 获取收款数据 * 获取收款数据
* @param $agent_id * @param $agent_id
...@@ -596,7 +597,6 @@ class PerformanceService ...@@ -596,7 +597,6 @@ class PerformanceService
} }
/** /**
* 获取业绩数据 * 获取业绩数据
* @param $type * @param $type
...@@ -668,7 +668,7 @@ class PerformanceService ...@@ -668,7 +668,7 @@ class PerformanceService
return [ "code" => 200, "date" => $receivedList ]; return [ "code" => 200, "date" => $receivedList ];
} }
public function paylogListPcInfo($id,$type, $start_time, $end_time, $page_no, $page_size) public function paylogListPcInfo($id, $type, $start_time, $end_time, $page_no, $page_size)
{ {
$params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time); $params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time);
...@@ -693,22 +693,22 @@ class PerformanceService ...@@ -693,22 +693,22 @@ class PerformanceService
* @param $page_size * @param $page_size
* @return array * @return array
*/ */
public function marchInListPcInfo($id,$type, $start_time, $end_time, $page_no, $page_size) public function marchInListPcInfo($id, $type, $start_time, $end_time, $page_no, $page_size)
{ {
$params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time); $params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time);
//dump($params); //dump($params);
if (!$params) if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ]; return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "a.id,c.user_name,c.user_phone,c.predict_see_time,c.report_agent_name,b.house_title,b.create_time,e.store_name,b.id as order_id"; $field = "a.id,c.user_name,c.user_phone,c.predict_see_time,c.report_agent_name,b.house_title,b.create_time,e.store_name,b.id as order_id";
$addMarchInList = $this->marchInModel->getAddMarchInListPcInfo($params, $field, $page_no, $page_size); $addMarchInList = $this->marchInModel->getAddMarchInListPcInfo($params, $field, $page_no, $page_size);
$addMarchInListTotal = $this->marchInModel->getAddMarchInListPcInfoTotal($params, $field); $addMarchInListTotal = $this->marchInModel->getAddMarchInListPcInfoTotal($params, $field);
//获取图片信息 //获取图片信息
foreach ($addMarchInList as $key => $val) { foreach ($addMarchInList as $key => $val) {
$addMarchInList[$key]["user_name"] = $val["user_name"]?$val["user_name"]:''; $addMarchInList[$key]["user_name"] = $val["user_name"] ? $val["user_name"] : '';
$addMarchInList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]); $addMarchInList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
} }
return [ "code" => 200, "date" => $addMarchInList , "total" => $addMarchInListTotal ]; return [ "code" => 200, "date" => $addMarchInList, "total" => $addMarchInListTotal ];
} }
...@@ -722,7 +722,7 @@ class PerformanceService ...@@ -722,7 +722,7 @@ class PerformanceService
* @param $page_size * @param $page_size
* @return array * @return array
*/ */
public function getUserResourceListPcInfo($id,$type, $start_time, $end_time, $page_no, $page_size) public function getUserResourceListPcInfo($id, $type, $start_time, $end_time, $page_no, $page_size)
{ {
$params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time); $params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time);
...@@ -738,8 +738,8 @@ class PerformanceService ...@@ -738,8 +738,8 @@ class PerformanceService
} }
$addUserList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]); $addUserList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
$follow = new UPhoneFollowPp(); $follow = new UPhoneFollowPp();
$res = $follow->getLastPhoneFollowTime($val['id']); $res = $follow->getLastPhoneFollowTime($val['id']);
$addUserList[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!'; $addUserList[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!';
} }
return [ "code" => 200, "date" => $addUserList ]; return [ "code" => 200, "date" => $addUserList ];
...@@ -756,7 +756,7 @@ class PerformanceService ...@@ -756,7 +756,7 @@ class PerformanceService
* @param $page_size * @param $page_size
* @return array * @return array
*/ */
public function getHousingResourceListPcInfo($id,$type, $start_time, $end_time, $page_no, $page_size) public function getHousingResourceListPcInfo($id, $type, $start_time, $end_time, $page_no, $page_size)
{ {
$params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time); $params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time);
...@@ -775,8 +775,8 @@ class PerformanceService ...@@ -775,8 +775,8 @@ class PerformanceService
//todo 最后跟进时间 //todo 最后跟进时间
$follow = new GHousesFollowUp(); $follow = new GHousesFollowUp();
$res = $follow->getLastFollowTime($val["id"]); $res = $follow->getLastFollowTime($val["id"]);
$addHouseList[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!'; $addHouseList[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!';
} }
return [ "code" => 200, "date" => $addHouseList ]; return [ "code" => 200, "date" => $addHouseList ];
...@@ -793,21 +793,21 @@ class PerformanceService ...@@ -793,21 +793,21 @@ class PerformanceService
* @param $page_size * @param $page_size
* @return array * @return array
*/ */
public function getFollowListPcInfo($id,$type, $start_time, $end_time, $page_no, $page_size) public function getFollowListPcInfo($id, $type, $start_time, $end_time, $page_no, $page_size)
{ {
$params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time); $params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time);
if (!$params) if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ]; return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "a.id,a.user_name,a.user_phone,a.predict_see_time,a.create_time,a.report_agent_name,c.internal_title as house_title,c.shop_type,e.store_name,b.id as order_id"; $field = "a.id,a.user_name,a.user_phone,a.predict_see_time,a.create_time,a.report_agent_name,c.internal_title as house_title,c.shop_type,e.store_name,b.id as order_id";
$reportList = $this->reportModel->getAddReportListPcInfo($params, $field, $page_no, $page_size); $reportList = $this->reportModel->getAddReportListPcInfo($params, $field, $page_no, $page_size);
$reportListTotal = $this->reportModel->getAddReportListPcInfoTotal($params, $field); $reportListTotal = $this->reportModel->getAddReportListPcInfoTotal($params, $field);
foreach ($reportList as $key => $val) { foreach ($reportList as $key => $val) {
$reportList[$key]["user_name"] = $val["user_name"]?$val["user_name"]:''; $reportList[$key]["user_name"] = $val["user_name"] ? $val["user_name"] : '';
$reportList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]); $reportList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
} }
//return [ "code" => 200, "date" => $reportList ]; //return [ "code" => 200, "date" => $reportList ];
return [ "code" => 200, "date" => $reportList , "total" => $reportListTotal ]; return [ "code" => 200, "date" => $reportList, "total" => $reportListTotal ];
} }
...@@ -821,23 +821,23 @@ class PerformanceService ...@@ -821,23 +821,23 @@ class PerformanceService
* @param $page_size * @param $page_size
* @return array * @return array
*/ */
public function getTeamNumPcInfo($id,$type, $start_time, $end_time, $page_no, $page_size) public function getTeamNumPcInfo($id, $type, $start_time, $end_time, $page_no, $page_size)
{ {
if($type == 2){ if ($type == 2) {
$params["a.store_id"] = $id; $params["a.store_id"] = $id;
}else{ } else {
$params["a.district_id"] = $id; $params["a.district_id"] = $id;
} }
//$params['a.create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) ); //$params['a.create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$field = "a.id,a.level,a.name,a.phone,a.create_time,b.store_name"; $field = "a.id,a.level,a.name,a.phone,a.create_time,b.store_name";
$list = $this->agentModel->searchAgentsByKeywordPcInfo($field, $params,$page_size,$page_no); $list = $this->agentModel->searchAgentsByKeywordPcInfo($field, $params, $page_size, $page_no);
foreach ($list as $key => $val) { foreach ($list as $key => $val) {
$follow = new UPhoneFollowPp(); $follow = new UPhoneFollowPp();
$res = $follow->getLastPhoneFollowTime($val['id']); $res = $follow->getLastPhoneFollowTime($val['id']);
$list[$key]["user_name"] = $val["user_name"]?$val["user_name"]:''; $list[$key]["user_name"] = $val["user_name"] ? $val["user_name"] : '';
$list[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!'; $list[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!';
} }
return [ "code" => 200, "date" => $list ]; return [ "code" => 200, "date" => $list ];
...@@ -853,23 +853,22 @@ class PerformanceService ...@@ -853,23 +853,22 @@ class PerformanceService
* @param $page_size * @param $page_size
* @return array * @return array
*/ */
public function getBargainSumPcInfo($id,$type, $start_time, $end_time, $page_no, $page_size,$request_source_type) public function getBargainSumPcInfo($id, $type, $start_time, $end_time, $page_no, $page_size, $request_source_type)
{ {
$params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time); $params = $this->getAgentIdPcInfo($id, $type, $start_time, $end_time);
if (!$params) if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ]; return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "a.id,a.create_time,a.trade_type,a.scale_fee,c.landmark,d.user_phone,d.user_name,b.id as order_id"; $field = "a.id,a.create_time,a.trade_type,a.scale_fee,c.landmark,d.user_phone,d.user_name,b.id as order_id";
$m_bargain = new OBargainModel(); $m_bargain = new OBargainModel();
$list = $m_bargain->getBargainSumList($field, $params,$page_size,$page_no,$request_source_type); $list = $m_bargain->getBargainSumList($field, $params, $page_size, $page_no, $request_source_type);
foreach ($list as $key => $val) { foreach ($list as $key => $val) {
$list[$key]["user_name"] = $val["user_name"]?$val["user_name"]:''; $list[$key]["user_name"] = $val["user_name"] ? $val["user_name"] : '';
$list[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]); $list[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
} }
return [ "code" => 200, "date" => $list ]; return [ "code" => 200, "date" => $list ];
} }
} }
\ No newline at end of file
...@@ -692,20 +692,31 @@ class AAgents extends BaseModel ...@@ -692,20 +692,31 @@ class AAgents extends BaseModel
/** /**
* @param $field * @param $field
* @param $params * @param $params
* @param $is_store
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getStoreOrAgentInfo($field, $params) public function getStoreOrAgentInfo($field, $params,$is_store)
{ {
$result = Db::table($this->table) if($is_store == 2){
->field($field) $result = Db::table($this->table)
->alias("a") ->field($field)
->join("a_store b", "a.store_id = b.id", "left") ->alias("a")
->join("a_agents c", "a.store_id = c.store_id", "left") ->join("a_store b", "a.store_id = b.id", "left")
->where($params) ->join("a_agents c", "a.store_id = c.store_id", "left")
->select(); ->where($params)
->select();
}else{
$result = Db::table($this->table)
->field($field)
->alias("a")
->join("a_store b", "a.store_id = b.id", "left")
->where($params)
->select();
}
// echo $this->getLastSql(); // echo $this->getLastSql();
return $result; 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