接口修改2
This commit is contained in:
parent
daae63614b
commit
d4c1354ee7
@ -17,7 +17,7 @@ class Village extends BaseController
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $middleware = [
|
protected $middleware = [
|
||||||
Auth::class => ['except' => ['get_list','get_ranking_list','get_detail','get_json','get_village','thumbs_up','get_ranking_town'] ]
|
Auth::class => ['except' => ['get_list','get_ranking_list','get_detail','get_json','get_village','thumbs_up','get_ranking_town','get_town_list'] ]
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -653,5 +653,58 @@ class Village extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取镇
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function get_town_list($area_id=0,$street_id=0,$type=1, $page = 1)
|
||||||
|
{
|
||||||
|
if ($area_id){
|
||||||
|
$where['area_id'] = $area_id;
|
||||||
|
}
|
||||||
|
// if ($street_id){
|
||||||
|
// $where['street_id'] = $street_id;
|
||||||
|
// }
|
||||||
|
if($type==1){
|
||||||
|
$where['is_hot'] = 1;
|
||||||
|
}
|
||||||
|
if($type==2){
|
||||||
|
$where['is_tourism'] = 1;
|
||||||
|
}
|
||||||
|
$where['status'] = 1;
|
||||||
|
$list = Db::table('fa_szxc_village')
|
||||||
|
->where($where)
|
||||||
|
->where('village_id','=',0)
|
||||||
|
->page($page,10)
|
||||||
|
->field('id,title,address,people_num,images,views,likes,createtime,area_id,street_id,village_id')
|
||||||
|
->order('likes desc')
|
||||||
|
->withAttr('images', function ($value, $data) {
|
||||||
|
if ($data['images'] != '') {
|
||||||
|
return explode(',',$data['images']);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->withAttr('is_dz', function ($value, $data) {
|
||||||
|
// 判断redis
|
||||||
|
$user_id = JWT_UID;
|
||||||
|
if($user_id){
|
||||||
|
$name = $user_id . $data['id'];
|
||||||
|
$is_zan = Cache::store('redis')->get($name);
|
||||||
|
if($is_zan){
|
||||||
|
return 1;
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->select();
|
||||||
|
if($list){
|
||||||
|
$this->apiSuccess('获取成功',$list);
|
||||||
|
}else{
|
||||||
|
$this->apiError('暂无数据',[]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user