Commit c345ea59 authored by hujun's avatar hujun

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

parent 24c9134e
...@@ -16,7 +16,7 @@ use app\model\Remarks; ...@@ -16,7 +16,7 @@ use app\model\Remarks;
* Intro : * Intro :
*/ */
class Broker extends Basic{ class Broker extends Basic{
/** /**
* 获取当前商铺或街铺的经纪人 * 获取当前商铺或街铺的经纪人
* *
...@@ -155,13 +155,15 @@ class Broker extends Basic{ ...@@ -155,13 +155,15 @@ class Broker extends Basic{
$remarks = new Remarks(); $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_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']) { switch ($params['type']) {
case 0: case 0:
//评价列表信息 //评价列表信息
$result['evaluate'] = $evalutate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']); $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; $data['data'] = $result;
break; break;
case 1: case 1:
...@@ -171,7 +173,7 @@ class Broker extends Basic{ ...@@ -171,7 +173,7 @@ class Broker extends Basic{
break; break;
case 2: 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; $data['data'] = $result;
break; break;
default: default:
......
...@@ -78,8 +78,10 @@ class Agents extends Model ...@@ -78,8 +78,10 @@ class Agents extends Model
$result['head_portrait'] = ADMIN_URL_TL.$result['head_portrait']; $result['head_portrait'] = ADMIN_URL_TL.$result['head_portrait'];
$remarks = new Remarks(); $remarks = new Remarks();
$fields = 'a.id'; $fields = 'id';
$Journal_num = $remarks->getJournalHouseInfoId($fields, $id); $where['shopuser_id'] = $id;
$where['transaction_status'] = 3;
$Journal_num = $remarks->getJournalHouseInfoId($fields, $where);
$result['JournalAccounts'] = count($Journal_num); //成交记录 $result['JournalAccounts'] = count($Journal_num); //成交记录
$current_time = time(); $current_time = time();
......
...@@ -3,36 +3,44 @@ ...@@ -3,36 +3,44 @@
namespace app\model; namespace app\model;
use think\Model; use think\Model;
use think\Db;
class Remarks extends Model class Remarks extends Model
{ {
/**成交记录列表 /**
* 成交记录列表
*
* @param int $pageNo * @param int $pageNo
* @param int $pageSize * @param int $pageSize
* @param string $order_ * @param string $order_
* @param $field * @param $field
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @param string $agent_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getJournalHouseInfo($pageNo = 1, $pageSize = 15, $order_ = 'j.id desc', $field, $params) { public function getJournalHouseInfo($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $agent_id = '') {
$data = $this->field($field)->alias('a')
->join('houseinfos b','houseinfos b ON a.house_id = b.id','LEFT') $result = $this->field($field)
->where('shopuser_id', $agent_id)
->where($params) ->where($params)
->group('j.apply_id') ->group('house_id')
->limit($pageSize) ->limit($pageSize)
->order($order_) ->order($order_)
->page($pageNo) ->page($pageNo)
->select(); ->select();
$fields_houinfo = 'id,title,rent_type,price,room_area,room_area2,shangpu_tags,shangpu_type';
//查找商铺或街铺的名字和图片 //查找商铺或街铺的名字和图片
foreach ($data as $key => $value) { foreach ($result as $key => $value) {
$data[$key] = Db::table('journalaccounts') $data[$key] = Db::table('houseinfos')
->field('singntime')->where('apply_id',$value['apply_id'])->find(); ->field($fields_houinfo)->where('id',$value['house_id'])->find();
$data[$key]['singntime'] = date('Y-m-d',strtotime($value['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') $img = Db::table('houseimgs')->field('imagename')
->where('house_id', $value['house_id'])->where('imgtype',1)->find(); ->where('house_id', $value['house_id'])->where('imgtype',1)->find();
...@@ -41,38 +49,30 @@ class Remarks extends Model ...@@ -41,38 +49,30 @@ class Remarks extends Model
} else { } else {
$data[$key]['img'] = ADMIN_URL_TL.'/resource/image/pzz_.jpg'; $data[$key]['img'] = ADMIN_URL_TL.'/resource/image/pzz_.jpg';
} }
} }
return $data; return $data;
} }
/** /**
* @param int $p * 查询当前经纪人的成交记录
* @param int $pageSize *
* @param string $order_ * @param string $fields
* @param string $field * @param $params
* @param string $join
* @param string $where
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getListJoin($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '',$join='', $where = '') public function getJournalHouseInfoId($fields = '', $params) {
{ $result = $this->field($fields)
$data = $this->field($field) ->where($params)
->alias('r') ->group('house_id')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
->select(); ->select();
//echo $this->getLastSql(); //echo $this->getLastSql();
if(!$data){ if(!$data){
return $data; return $result;
} }
/****************************处理客户电话****************************************/ /****************************处理客户电话****************************************/
foreach($data as $k=> $li) { foreach($data as $k=> $li) {
$phonestr = htmlentities(trim($li["phpone"])); $phonestr = htmlentities(trim($li["phpone"]));
......
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