...
|
...
|
@@ -264,7 +264,8 @@ class House extends Api |
|
|
* @ApiRoute (/api/house/house_list)
|
|
|
*
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="area", type="string", required=true, description="市区地址例如:'天津市/西青区'")
|
|
|
* @ApiParams (name="type", type="string", required=true, description="用户类型1=用户2=商家")
|
|
|
* @ApiParams (name="area", type="string", required=false, description="市区地址例如:'天津市/西青区'")
|
|
|
* @ApiParams (name="keyword", type="string", required=false, description="关键字")
|
|
|
*
|
|
|
*
|
...
|
...
|
@@ -285,6 +286,7 @@ class House extends Api |
|
|
public function house_list()
|
|
|
{
|
|
|
$qiniu = get_addon_config('qiniu')['cdnurl'];
|
|
|
$type = $this->request->param('type',1,'intval');
|
|
|
$user_id = $this->auth->id;
|
|
|
$area = $this->request->param('area');
|
|
|
$keyword = $this->request->param('keyword');
|
...
|
...
|
@@ -303,15 +305,35 @@ class House extends Api |
|
|
->order('createtime desc')
|
|
|
->select();
|
|
|
|
|
|
//查出该用户已绑定的和申请中的小区
|
|
|
$user_house = Db::name('user_house')
|
|
|
->where('user_id',$user_id)
|
|
|
->select();
|
|
|
if($type == 1) {
|
|
|
//查出该用户已绑定的和申请中的小区
|
|
|
$user_house = Db::name('user_house')
|
|
|
->where('user_id',$user_id)
|
|
|
->select();
|
|
|
|
|
|
foreach ($data as &$v){
|
|
|
foreach ($user_house as &$val){
|
|
|
if($v['id'] == $val['house_id']){
|
|
|
$v['shen_status'] = $val['status'];
|
|
|
foreach ($data as &$v){
|
|
|
$v['shen_status'] = 0;
|
|
|
foreach ($user_house as &$val){
|
|
|
if($v['id'] == $val['house_id']){
|
|
|
$v['shen_status'] = $val['status'];
|
|
|
}else{
|
|
|
$v['shen_status'] = 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
//查出该用户入驻商家已绑定的和申请中的小区
|
|
|
$store_model = new \app\api\model\Store();
|
|
|
$where_s = ['user_id'=>$this->auth->id];
|
|
|
$where = [
|
|
|
'where' => $where_s,
|
|
|
];
|
|
|
$store = $store_model->findOrFail($where,false);
|
|
|
|
|
|
foreach ($data as &$v){
|
|
|
$house_ids = explode(',',$store['house_ids']);
|
|
|
if(in_array($v['id'],$house_ids)){
|
|
|
$v['shen_status'] = 2;
|
|
|
}else{
|
|
|
$v['shen_status'] = 0;
|
|
|
}
|
...
|
...
|
|