Commit c345ea59 authored by hujun's avatar hujun

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

parent 24c9134e
......@@ -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:
......
......@@ -78,8 +78,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();
......
......@@ -3,36 +3,44 @@
namespace app\model;
use think\Model;
use think\Db;
class Remarks extends Model
{
/**成交记录列表
/**
* 成交记录列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @param string $agent_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getJournalHouseInfo($pageNo = 1, $pageSize = 15, $order_ = 'j.id desc', $field, $params) {
$data = $this->field($field)->alias('a')
->join('houseinfos b','houseinfos b ON a.house_id = b.id','LEFT')
public function getJournalHouseInfo($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $agent_id = '') {
$result = $this->field($field)
->where('shopuser_id', $agent_id)
->where($params)
->group('j.apply_id')
->group('house_id')
->limit($pageSize)
->order($order_)
->page($pageNo)
->select();
$fields_houinfo = 'id,title,rent_type,price,room_area,room_area2,shangpu_tags,shangpu_type';
//查找商铺或街铺的名字和图片
foreach ($data as $key => $value) {
$data[$key] = Db::table('journalaccounts')
->field('singntime')->where('apply_id',$value['apply_id'])->find();
$data[$key]['singntime'] = date('Y-m-d',strtotime($value['singntime']));
foreach ($result as $key => $value) {
$data[$key] = Db::table('houseinfos')
->field($fields_houinfo)->where('id',$value['house_id'])->find();
$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')
->where('house_id', $value['house_id'])->where('imgtype',1)->find();
......@@ -41,38 +49,30 @@ class Remarks extends Model
} else {
$data[$key]['img'] = ADMIN_URL_TL.'/resource/image/pzz_.jpg';
}
}
return $data;
}
/**
* @param int $p
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $join
* @param string $where
* 查询当前经纪人的成交记录
*
* @param string $fields
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getListJoin($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '',$join='', $where = '')
{
$data = $this->field($field)
->alias('r')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
public function getJournalHouseInfoId($fields = '', $params) {
$result = $this->field($fields)
->where($params)
->group('house_id')
->select();
//echo $this->getLastSql();
if(!$data){
return $data;
}
return $result;
}
/****************************处理客户电话****************************************/
foreach($data as $k=> $li) {
$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