Commit ec8e72fd authored by zhuwei's avatar zhuwei

bug

parent 621b8a0f
......@@ -463,7 +463,7 @@ class StatementService
$where_["agent_id"] = array( "in", $agentIds );
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$performanceSum = $obargain->getAddBargainNumV2($where_, 3);//1表示业绩 2表示实收
$results[$key]["director_bargain_sum_store"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//todo 上周人数
$start_time = date("Y-m-d", strtotime("-14 day"));
......
......@@ -4,6 +4,7 @@ namespace app\model;
use app\task\controller\ResultsSummaryNewTask;
use think\Db;
use think\Log;
use think\Model;
/**
......@@ -741,7 +742,49 @@ class OBargainModel extends Model
// echo $this->getLastSql();
return $return;
}
public function getAddBargainNumV2($params, $type)
{
$where_ = [];
$field = "";
$join = [];
if ($type == 1) {
$field = "sum(scale_fee) as num";
} elseif ($type == 2) {
$field = "sum(practical_fee) as num";
} elseif ($type == 3) {
$field = "count(1) as num";
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$where_["role"] = 3;//必须是反签方
array_push($join, [ ' o_report c', 'a.report_id=c.id', 'left' ]);
}
if (isset($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"])) {
$where_["a.create_time"] = $params["create_time"];
}
if (isset($params["house_ids"])) {
$where_["b.house_id"] = array( "in", $params["house_ids"] );
array_push($join, [ ' o_order b', 'a.order_id = b.id', 'left' ]);
}
$return = Db::table($this->table)
->field($field)
->alias("a")
->join($join)
->where($where_)
->select();
// echo $this->getLastSql();
Log::write($this->getLastSql(), '本月完成单数-7151'); //记录日志
return $return;
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
......
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