Commit 9e65825a authored by hujun's avatar hujun

咨询经纪人修改

parent bfeb8e36
...@@ -8,7 +8,7 @@ use app\model\AAgents; ...@@ -8,7 +8,7 @@ use app\model\AAgents;
use app\model\Evaluate; use app\model\Evaluate;
use app\model\EvaluateSign; use app\model\EvaluateSign;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\OReportModel; use app\model\OMarchInModel;
/** /**
* Description of Agents * Description of Agents
...@@ -52,14 +52,14 @@ class Broker extends Basic ...@@ -52,14 +52,14 @@ class Broker extends Basic
} }
//查找30天带看最多的人 //查找30天带看最多的人
$m_report = new OReportModel(); $m_march = new OMarchInModel();
$report_fields = 'COUNT( a.report_agent_id ) AS num,a.report_agent_id '; $report_fields = 'COUNT( a.reception_id ) AS num,a.reception_id ';
$report_where['b.house_id'] = $params['house_id']; $report_where['b.house_id'] = $params['house_id'];
$report_where['a.create_time'] = ['between', [date('Y-m-d', strtotime("-30 day")) . ' 00:00:00', date('Y-m-d').' 23:59:59']]; $report_where['a.create_time'] = ['between', [date('Y-m-d', strtotime("-30 day")) . ' 00:00:00', date('Y-m-d').' 23:59:59']];
$report_agent_id = $m_report->getMaxReportAgent($report_fields, $report_where); $reception_id = $m_march->getMaxMarchInAgent($report_fields, $report_where);
if (!empty($report_agent_id['report_agent_id'])) { if (!empty($reception_id['reception_id'])) {
$report_agent = $agents->getUser(1, 1, '', $fields, [ 'a.id' => $report_agent_id['report_agent_id'], 'a.status'=>0,'c.is_del'=>0 ]); $report_agent = $agents->getUser(1, 1, '', $fields, [ 'a.id' => $reception_id['reception_id'], 'a.status'=>0,'c.is_del'=>0 ]);
} }
$where['c.houses_id'] = $params['house_id']; $where['c.houses_id'] = $params['house_id'];
......
...@@ -397,4 +397,20 @@ class OMarchInModel extends Model ...@@ -397,4 +397,20 @@ class OMarchInModel extends Model
return $return; return $return;
} }
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getMaxMarchInAgent($field, $where) {
return $this->alias('a')
->field($field)
->join('o_order b', 'a.id = b.f_id', 'left')
->where($where)
->group('a.reception_id ')
->find();
}
} }
\ No newline at end of file
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