Commit 51305dd9 authored by hujun's avatar hujun

成交记录去除重复的楼盘id

parent 9dcbe19f
......@@ -16,7 +16,7 @@ use app\model\Remarks;
* Intro :
*/
class Broker extends Basic{
/**
* 获取当前商铺或街铺的经纪人
*
......@@ -155,13 +155,15 @@ class Broker extends Basic{
$remarks = new Remarks();
$fields_evaluate = 'house_id,user_id,user_nick,user_phone,user_pic,evaluate_grade,evaluate_content,evaluate_sign,a.create_time,record_id,a.source';
$fields_journal = 'a.house_id,a.apply_id';
$fields_journal = 'house_id,apply_id,created';
$where['shopuser_id'] = $params['agent_id'];
$where['transaction_status'] = 3;
switch ($params['type']) {
case 0:
//评价列表信息
$result['evaluate'] = $evalutate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
//成交记录
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'a.id desc', $fields_journal, 'j.transaction_status = 3', $params['agent_id']);
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'id desc', $fields_journal, $where, $params['agent_id']);
$data['data'] = $result;
break;
case 1:
......@@ -171,7 +173,7 @@ class Broker extends Basic{
break;
case 2:
//成交记录
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'a.id desc', $fields_journal, 'j.transaction_status = 3', $params['agent_id']);
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'id desc', $fields_journal, $where, $params['agent_id']);
$data['data'] = $result;
break;
default:
......
......@@ -77,8 +77,10 @@ class Agents extends Model
$result['head_portrait'] = ADMIN_URL_TL.$result['head_portrait'];
$remarks = new Remarks();
$fields = 'a.id';
$Journal_num = $remarks->getJournalHouseInfoId($fields, $id);
$fields = 'id';
$where['shopuser_id'] = $id;
$where['transaction_status'] = 3;
$Journal_num = $remarks->getJournalHouseInfoId($fields, $where);
$result['JournalAccounts'] = count($Journal_num); //成交记录
$current_time = time();
......
......@@ -21,12 +21,12 @@ class Remarks extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getJournalHouseInfo($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field, $params, $agent_id = '') {
public function getJournalHouseInfo($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $agent_id = '') {
$result = $this->field($field)->alias('a')
->join('applies b','a.apply_id = a.id','LEFT')
->where('a.shopuser_id', $agent_id)
->group('a.apply_id')
$result = $this->field($field)
->where('shopuser_id', $agent_id)
->where($params)
->group('house_id')
->limit($pageSize)
->order($order_)
->page($pageNo)
......@@ -38,11 +38,7 @@ class Remarks extends Model
$data[$key] = Db::table('houseinfos')
->field($fields_houinfo)->where('id',$value['house_id'])->find();
$singntime = Db::table('journalaccounts')->field('max(id),singntime')->where([
'apply_id'=>$value['apply_id']
])->find();
$data[$key]['singntime'] = $singntime['singntime'] ? date('Y-m-d',strtotime($singntime['singntime'])) : "";
$data[$key]['singntime'] = $value['created'] ? date('Y-m-d',strtotime($value['created'])) : "";
$data[$key]['shangpu_tags'] = explode(',',$data[$key]['shangpu_tags']);
$img = Db::table('houseimgs')->field('imagename')
......@@ -53,7 +49,6 @@ class Remarks extends Model
} else {
$data[$key]['img'] = ADMIN_URL_TL.'/resource/image/pzz_.jpg';
}
}
return $data;
......@@ -63,17 +58,16 @@ class Remarks extends Model
* 查询当前经纪人的成交记录
*
* @param string $fields
* @param $agent_id
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getJournalHouseInfoId($fields = '', $agent_id) {
$result = $this->field($fields)->alias('a')
->join('applies b','a.apply_id = a.id','LEFT')
->where('a.shopuser_id', $agent_id)
->group('a.apply_id')
public function getJournalHouseInfoId($fields = '', $params) {
$result = $this->field($fields)
->where($params)
->group('house_id')
->select();
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