Commit 683b1641 authored by zhuwei's avatar zhuwei

bug

parent 85fad908
...@@ -144,6 +144,7 @@ class StatementService ...@@ -144,6 +144,7 @@ class StatementService
//dump($conditions); //dump($conditions);
$result["user_num"] = $this->userModel->getAddUserNumByAgentId($conditions); $result["user_num"] = $this->userModel->getAddUserNumByAgentId($conditions);
//dump($conditions); //dump($conditions);
//本周带看(报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions); $addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0; $result["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
...@@ -158,8 +159,8 @@ class StatementService ...@@ -158,8 +159,8 @@ class StatementService
$where_["agent_id"] = array( "in", $agentIds ); $where_["agent_id"] = array( "in", $agentIds );
} }
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) ); $where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$where_['status'] =array( "in", '10, 11, 13, 20' );
//dump($where_);
$obargain = new OBargainModel(); $obargain = new OBargainModel();
$performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收 $performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
...@@ -167,13 +168,13 @@ class StatementService ...@@ -167,13 +168,13 @@ class StatementService
//本周业绩 //本周业绩
$start_time = date("Y-m-d", strtotime("-7 day")); $start_time = date("Y-m-d", strtotime("-7 day"));
$where_['create_time'] = [ 'between', [ $start_time . " 00:00:00", $end_time . " 23:59:59" ] ]; $where_['create_time'] = $conditions['create_time'];
$performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收 $performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
$result["performance_week"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0; $result["performance_week"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//本周客源 //本周客源
$start_time = date("Y-m-d", strtotime("-7 day")); $start_time = date("Y-m-d", strtotime("-7 day"));
$where_['create_time'] = [ 'between', [ $start_time . " 00:00:00", $end_time . " 23:59:59" ] ]; $where_['create_time'] = $conditions['create_time'];
$addUserNum = $this->userModel->getAddUserNum($where_); $addUserNum = $this->userModel->getAddUserNum($where_);
$result["add_user_num_week"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0; $result["add_user_num_week"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
...@@ -188,8 +189,10 @@ class StatementService ...@@ -188,8 +189,10 @@ class StatementService
$where_["agent_id"] = array( "in", $agentIds ); $where_["agent_id"] = array( "in", $agentIds );
} }
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) ); $where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// dump($where_);
$performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收 $performanceSum = $obargain->getAddBargainNumV2($where_, 3);//1表示业绩 2表示实收
//dump($where_);exit;
$result["bargain_sum"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0; $result["bargain_sum"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//exit; //exit;
...@@ -366,12 +369,14 @@ class StatementService ...@@ -366,12 +369,14 @@ class StatementService
$store_list["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0; $store_list["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
//本周业绩 //本周业绩
$start_time = date("Y-m-d", strtotime("-7 day")); $start_time = date("Y-m-d", strtotime("-6 day"));
$end_time = date("Y-m-d", strtotime("-1 day")); $end_time = date("Y-m-d");
$where_["agent_id"] = $agent_id; $where_["agent_id"] = $agent_id;
$where_['create_time'] = [ 'between', [ $start_time . " 00:00:00", $end_time . " 23:59:59" ] ]; $where_['create_time'] = $conditions['create_time'];
$obargain = new OBargainModel(); $where_['status'] =array( "in", '10, 11, 13, 20' );
$obargain = new OBargainModel();
// dump($where_);
$performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收 $performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
$store_list["performance_week"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0; $store_list["performance_week"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
......
...@@ -712,7 +712,6 @@ class OBargainModel extends Model ...@@ -712,7 +712,6 @@ class OBargainModel extends Model
array_push($join, [ ' o_report c', 'a.report_id=c.id', 'left' ]); array_push($join, [ ' o_report c', 'a.report_id=c.id', 'left' ]);
} }
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"]; $where_["a.agent_id"] = $params["agent_id"];
} }
...@@ -729,13 +728,18 @@ class OBargainModel extends Model ...@@ -729,13 +728,18 @@ class OBargainModel extends Model
array_push($join, [ ' o_order b', 'a.order_id = b.id', 'left' ]); array_push($join, [ ' o_order b', 'a.order_id = b.id', 'left' ]);
} }
if (isset($params["status"])) {
$where_["a.status"] = $params["status"];
}
$return = Db::table($this->table) $return = Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join($join) ->join($join)
->where($where_) ->where($where_)
->select(); ->select();
// echo $this->getLastSql(); /*echo $this->getLastSql();
echo '------------------';*/
return $return; return $return;
} }
public function getAddBargainNumV2($params, $type) public function getAddBargainNumV2($params, $type)
...@@ -749,19 +753,14 @@ class OBargainModel extends Model ...@@ -749,19 +753,14 @@ class OBargainModel extends Model
$field = "sum(practical_fee) as num"; $field = "sum(practical_fee) as num";
} elseif ($type == 3) { } elseif ($type == 3) {
$field = "count(1) as num"; $field = "count(1) as num";
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$where_["role"] = 3;//必须是反签方 $where_["role"] = 3;//必须是反签方
array_push($join, [ ' o_report c', 'a.report_id=c.id', 'left' ]);
} }
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"]; $where_["a.agent_id"] = $params["agent_id"];
} }
if (isset($params["agent_id"]) && $type == 3) {
unset($where_["agent_id"]);
$where_["c.report_agent_id"] = $params["agent_id"];
}
if (isset($params["create_time"])) { if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
} }
...@@ -777,8 +776,7 @@ class OBargainModel extends Model ...@@ -777,8 +776,7 @@ class OBargainModel extends Model
->join($join) ->join($join)
->where($where_) ->where($where_)
->select(); ->select();
// echo $this->getLastSql(); //echo $this->getLastSql();
Log::write($this->getLastSql(), '本月完成单数-7151'); //记录日志
return $return; return $return;
} }
/** /**
...@@ -1449,6 +1447,7 @@ class OBargainModel extends Model ...@@ -1449,6 +1447,7 @@ class OBargainModel extends Model
$where_["a.create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
} }
$where_["a.status"] = array( "in", "10,11,13,20" ); $where_["a.status"] = array( "in", "10,11,13,20" );
//$where_["a.role"] = 3;//必须是反签方
$result = $this->db_ $result = $this->db_
->field($field) ->field($field)
->alias("a") ->alias("a")
......
...@@ -160,7 +160,8 @@ class OMarchInModel extends Model ...@@ -160,7 +160,8 @@ class OMarchInModel extends Model
->join("o_order b", "a.order_id = b.id", "left") ->join("o_order b", "a.order_id = b.id", "left")
->where($where_) ->where($where_)
->select(); ->select();
//dump($this->getLastSql($return)); //echo $this->getLastSql();
//echo '=============';
return $return; return $return;
} }
...@@ -172,6 +173,9 @@ class OMarchInModel extends Model ...@@ -172,6 +173,9 @@ class OMarchInModel extends Model
public function getMarchInNum($params) public function getMarchInNum($params)
{ {
$where_ = []; $where_ = [];
if (isset($params["agent_id"])) {
$where_["a.reception_id"] = $params["agent_id"];
}
if (isset($params["create_time"])) { if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
} }
...@@ -179,13 +183,16 @@ class OMarchInModel extends Model ...@@ -179,13 +183,16 @@ class OMarchInModel extends Model
$where_["b.house_id"] = $params["house_id"]; $where_["b.house_id"] = $params["house_id"];
$where_["b.is_del"] = 0;//选择正常状态的参数 $where_["b.is_del"] = 0;//选择正常状态的参数
} }
return Db::table($this->table) $return = Db::table($this->table)
->field("count(1) as num,a.create_time") ->field("count(1) as num,a.create_time")
->alias("a") ->alias("a")
->join("o_order b", "a.order_id = b.id", "left") ->join("o_order b", "a.order_id = b.id", "left")
->where($where_) ->where($where_)
->limit(1) ->limit(1)
->select(); ->select();
// echo $this->getLastSql();
// echo '=============1';
return $return;
} }
/**统计房源进场数据列表 /**统计房源进场数据列表
......
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