Commit ee3e0f30 authored by hujun's avatar hujun

编辑商铺,获取信息修改

parent 45e16670
......@@ -25,6 +25,35 @@ class GHouses extends BaseModel
->where('a.id',$id)
->find();
$data = $select_data->getData();
/*案场,盘方,独家 start*/
$houseAgents = new GHousesToAgents();
$agents_data = $houseAgents->getHousesAgents($id);
$agents_str = '';
$exclusive_str = '';
$dish_str = '';
foreach ($agents_data as $k => $v) {
if ($v['type'] == 1) {
$agents_str .= $v['id'].',';
$data['agents_name'][$k] = $v['id'].'-'.$v['name'].'-'.$v['phone'];
} elseif ($v['type'] == 2) {
$dish_str .= $v['id'].',';
$data['dish_name'][$k] = $v['id'].'-'.$v['name'].'-'.$v['phone'];
} elseif ($v['type'] == 3) {
$exclusive_str .= $v['id'].',';
$data['exclusive_name'][$k] = $v['id'].'-'.$v['name'].'-'.$v['phone'];
}
}
$data['agent_data'] = rtrim($agents_str,',');
$data['agent_dish'] = rtrim($dish_str,',');
$data['exclusive_ids'] = rtrim($exclusive_str,',');
/*案场,盘方,独家 end*/
/*案场联系人 start*/
$case = new ACase();
$data['phone'] = $case->where('id','in',$data['case_id'])
->where('status',0)->column('name,phone');
/*案场联系人 end*/
/*图片 start*/
$img = new GHousesImgs();
$img_data = $img->field('id,img_type,img_name')
->where('img_status = 0 AND house_id = '.$id)
......@@ -37,12 +66,15 @@ class GHouses extends BaseModel
switch ($v->img_type) {
case 1 :
$data['cover'] = $v;break;
case 2 :
case 2 :
$data['slide_show'][$k] = $v;break;
case 3 :
$data['plan'][$k] = $v;break;
default :
$data['plan'][$k] = $v;
$data['exclusive_img'][$k] = $v;
}
}
/*图片 start*/
return $data;
}
......
......@@ -124,6 +124,19 @@ class GHousesToAgents extends BaseModel
return $res;
}
/**
* 经纪人与楼盘信息列表分页
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsHousesList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->field($field)
->alias('a')
......@@ -134,4 +147,24 @@ class GHousesToAgents extends BaseModel
->page($pageNo)
->select();
}
/**
* 楼盘对应的经纪人信息
*
* @param $houses_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHousesAgents($houses_id) {
$select_data = $this->field('b.id,name,a.type,b.phone')->alias('a')
->join('a_agents b','a.agents_id = b.id','LEFT')
->where([
'houses_id' => $houses_id,
'is_del' => 0
])->select();
return $select_data;
}
}
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