Commit fe71a2e6 authored by hujun's avatar hujun

Merge remote-tracking branch 'origin/0416-v3.2.5' into 0416-v3.2.5

parents 02cde00d 4e64ea8c
...@@ -114,16 +114,16 @@ class Bargain extends Basic ...@@ -114,16 +114,16 @@ class Bargain extends Basic
public function bargainListSearchBargainId() public function bargainListSearchBargainId()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /*
"submit_agent_id" => 93, AuthToken:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImlkIjo1Nzc1LCJuYW1lIjoiXHU2ZDRiXHU4YmQ1MiIsInBob25lIjoiMTU2MDE2NTIzNTIiLCJsZXZlbCI6MjB9LCJ0aW1lU3RhbXBfIjoxNTU2MDc0NjY1fQ.EmHCH_QtMdymkAbYSLBGJ6q2-DUtrcv0ngXBDAKlMU4
"status" => 1,//0全部 1未结单 2已结单 3 撤销审核 4已撤销 is_my_correlation:0
"is_my_correlation" => 1, //是否与我相关 0全部 1与我相关 keyword:288
"keyword" => "17717536291", page_no:1
"page_no" => 1, page_size:15
"page_size" => 10, status:5
"bargain_id" =>10 submit_agent_id:5775
);*/ type:3
*/
$checkResult = $this->validate($params, "BargainValidate.bargainList"); $checkResult = $this->validate($params, "BargainValidate.bargainList");
if (true !== $checkResult) { if (true !== $checkResult) {
...@@ -136,16 +136,17 @@ class Bargain extends Basic ...@@ -136,16 +136,17 @@ class Bargain extends Basic
$is_my_correlation = $params["is_my_correlation"]; $is_my_correlation = $params["is_my_correlation"];
$keyword = empty($params["keyword"]) ? "" : $params["keyword"]; $keyword = empty($params["keyword"]) ? "" : $params["keyword"];
$bargain_id = empty($params['bargain_id']) ? '':$params['bargain_id']; $bargain_id = empty($params['bargain_id']) ? '':$params['bargain_id'];
$type = empty($params['type']) ? '':$params['type'];
/*业务员不允许点击查看全部成交报告 start*/ /*业务员不允许点击查看全部成交报告 start*/
$agent_field = "a.level"; $agent_field = "a.level";
$agent_res = $this->agentModel->getAgentsInfoByAgentId($agent_field, [ "agent_id" => $submit_agent_id ]); $agent_res = $this->agentModel->getAgentsInfoByAgentId($agent_field, [ "agent_id" => $submit_agent_id ]);
if(($agent_res[0]['level'] == 10) && ($is_my_correlation == 0)){ if(($agent_res[0]['level'] == 10) && ($is_my_correlation == 0)){
return $this->response("101", "暂无权限!2"); return $this->response("101", "暂无权限!");
} }
/*业务员不允许点击查看全部成交报告 end*/ /*业务员不允许点击查看全部成交报告 end*/
$result = $this->service_->getBargainList($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword, $bargain_id); $result = $this->service_->getBargainListV2($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword, $bargain_id,$type);
return $this->response("200", "success", $result); return $this->response("200", "success", $result);
} }
......
...@@ -74,6 +74,59 @@ class BargainService ...@@ -74,6 +74,59 @@ class BargainService
return $convertResult; return $convertResult;
} }
public function getBargainListV2($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword, $bargain_id,$type)
{
$condition = [];
if ($is_my_correlation == 1) {
$aService = new VerifyService();
$ids = $aService->getAgentsByAgentId($submit_agent_id);
$condition["ids"] = $ids;
} else {
$condition["father_id"] = 0;
}
switch ($status) {
case 1:
$condition["account_statement"] = 0;
break;
case 2:
$condition["account_statement"] = 1;
break;
case 3:
$condition["status"] = 20;
break;
case 4:
$condition["status"] = 21;
break;
case 5://调账->搜成交报告 不包括 待撤销和已撤销
$condition["status"] = array('not in','20,21');
break;
default:
}
if (!empty($keyword)) {
$condition["keyword"] = $keyword;
}
if (!empty($bargain_id)) {
$condition["id"] = $bargain_id;
}
if (!empty($type)) {
$condition["type"] = $type;
}
$bargainModel = new OBargainModel();
$filed = "a.id,a.father_id,a.house_number,a.price,a.commission,a.agent_id,a.create_time,b.user_phone,
b.user_name,b.user_id,c.id as order_id,c.order_no,d.id as house_id,d.internal_title,d.internal_address,b.id as report_id";
$result = $bargainModel->selectBargainList($filed, $condition, $pageNo, $pageSize);
$convertResult ["total"] = count($result);
$convertResult ["result"] = $this->convert($is_my_correlation, $result);
return $convertResult;
}
private function convert($is_my_correlation, $result) private function convert($is_my_correlation, $result)
{ {
$sortResult = []; $sortResult = [];
......
...@@ -36,8 +36,8 @@ class FindShop extends Basic ...@@ -36,8 +36,8 @@ class FindShop extends Basic
"page_no" => 1, "page_no" => 1,
"page_size" => 15, "page_size" => 15,
);*/ );*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$conditions = []; $conditions = [];
if ($params['is_my'] != 0 && $params['is_my'] != 1) { if ($params['is_my'] != 0 && $params['is_my'] != 1) {
...@@ -72,10 +72,14 @@ class FindShop extends Basic ...@@ -72,10 +72,14 @@ class FindShop extends Basic
$result = $findShopModel->getFindShopAndUserList($field, $conditions, $pageNo, $pageSize); $list = $findShopModel->getFindShopAndUserList($field, $conditions, $pageNo, $pageSize);
foreach ($result as $key=>$item){ foreach ($list as $key=>$item){
$result[$key]["user_phone"] = substr_replace($item["user_phone"], '****', 3, 4); $list[$key]["user_phone"] = substr_replace($item["user_phone"], '****', 3, 4);
} }
$total = $findShopModel->getFindShopAndUserCount($field, $conditions);
$result["list"] = $list;
$result["total"] = $total;
return $this->response("200", "success", $result); return $this->response("200", "success", $result);
......
...@@ -260,7 +260,6 @@ class OBargainModel extends Model ...@@ -260,7 +260,6 @@ class OBargainModel extends Model
if (!isset($params["type"]) && isset($params["keyword"])) { if (!isset($params["type"]) && isset($params["keyword"])) {
$where_["b.user_phone|b.user_name|d.internal_address"] = array( "like", "%" . $params["keyword"] . "%" ); $where_["b.user_phone|b.user_name|d.internal_address"] = array( "like", "%" . $params["keyword"] . "%" );
} }
switch ((int)$params["type"]){ //1商铺id 2商铺地址 3成交报告id 4带看id 5客户id switch ((int)$params["type"]){ //1商铺id 2商铺地址 3成交报告id 4带看id 5客户id
case 1: case 1:
$where_["d.id"] = $params["keyword"]; $where_["d.id"] = $params["keyword"];
......
...@@ -60,6 +60,16 @@ class UFindShop extends Model{ ...@@ -60,6 +60,16 @@ class UFindShop extends Model{
->limit($page_size) ->limit($page_size)
->select(); ->select();
} }
public function getFindShopAndUserCount($field, $params)
{
$params["a.status"] = 0;
return $this->db_
->alias("a")
->join("u_users b","a.user_id = b.id","left")
->field($field)
->where($params)
->count();
}
/** /**
* @param $params * @param $params
......
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