...
|
...
|
@@ -6,6 +6,7 @@ |
|
|
*/
|
|
|
namespace app\portal\controller;
|
|
|
|
|
|
use app\portal\model\CityCategoryModel;
|
|
|
use app\portal\model\UserModel;
|
|
|
use app\portal\validate\UsersValidate;
|
|
|
use cmf\controller\HomeBaseController;
|
...
|
...
|
@@ -17,7 +18,7 @@ use think\Config; |
|
|
|
|
|
class LoginController extends HomeBaseController
|
|
|
{
|
|
|
|
|
|
private $limit = 8;//收藏,搜索分页
|
|
|
//登录页面
|
|
|
public function login(){
|
|
|
return $this->fetch();
|
...
|
...
|
@@ -174,7 +175,7 @@ class LoginController extends HomeBaseController |
|
|
|
|
|
//我的收藏列表
|
|
|
public function myCollection(){
|
|
|
$limit = 8;
|
|
|
$limit = $this->limit;
|
|
|
$uid = cmf_get_current_user_id();
|
|
|
$collectionModel = new CollectionModel();
|
|
|
$res = $collectionModel
|
...
|
...
|
@@ -206,6 +207,127 @@ class LoginController extends HomeBaseController |
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
//搜索列表
|
|
|
public function searchList(){
|
|
|
$keyword = $this->request->param('keyword');
|
|
|
if(isset($keyword) && !empty($keyword)){
|
|
|
$limit = $this->limit;
|
|
|
$res = Db::name('portal_post')
|
|
|
->alias('p')
|
|
|
->join('city_category c','p.city_id = c.id','LEFT')
|
|
|
->join('portal_category_post c_p','p.id = c_p.post_id','LEFT')
|
|
|
->where('p.post_title','like','%'.$keyword.'%')
|
|
|
->where('c_p.category_id','<>',CityCategoryModel::xqyy)
|
|
|
->where('c_p.category_id','<>',CityCategoryModel::xyhl)
|
|
|
->where('p.delete_time', 0)
|
|
|
->field('p.id,p.post_title,p.post_excerpt,p.post_favorites,c.name city_name')
|
|
|
->order('p.weigh desc')
|
|
|
->paginate($limit,false,['query'=>request()->param()]);
|
|
|
$data = $res->toArray();
|
|
|
$page = $res->render();
|
|
|
|
|
|
$post_ids = array_column($data['data'],'id');
|
|
|
//查找分类名称
|
|
|
$category = Db::name('portal_category_post')
|
|
|
->alias('c_p')
|
|
|
->join('portal_category c','c_p.category_id = c.id','LEFT')
|
|
|
->whereIn('c_p.post_id',$post_ids)
|
|
|
->field('c.id,c_p.post_id,c.name')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
foreach($data['data'] as &$value){
|
|
|
$value['post_title'] = str_replace($keyword,'<span style="color:rgba(9, 255, 142, 1);">'.$keyword.'</span>',$value['post_title']);
|
|
|
foreach($category as $item){
|
|
|
if($value['id'] == $item['post_id']){
|
|
|
$value['category_name'] = $item['name'];
|
|
|
$value['post_url'] = $this->getDetailUrl($item['id']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//查询总数
|
|
|
$count = Db::name('portal_post')
|
|
|
->alias('p')
|
|
|
->join('portal_category_post c_p','p.id = c_p.post_id','LEFT')
|
|
|
->where('p.post_title','like','%'.$keyword.'%')
|
|
|
->where('c_p.category_id','<>',CityCategoryModel::xqyy)
|
|
|
->where('c_p.category_id','<>',CityCategoryModel::xyhl)
|
|
|
->where('p.delete_time', 0)
|
|
|
->count();
|
|
|
}else{
|
|
|
$count = 0;
|
|
|
$data['data'] = [];
|
|
|
$page = '';
|
|
|
}
|
|
|
$this->assign('count',$count);
|
|
|
$this->assign('res',$data['data']);
|
|
|
$this->assign('page',$page);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
//获取各个板块详情页位置
|
|
|
public function getDetailUrl($c_id){
|
|
|
$url = '';
|
|
|
switch ($c_id) {
|
|
|
case CityCategoryModel::xqgs:
|
|
|
$url = '/portal/star/getStoryDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::whmj:
|
|
|
$url = '/portal/star/getSceneryDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::yyzx:
|
|
|
$url = '/portal/star/getFoodDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::lsmq:
|
|
|
$url = '/portal/star/getHotelDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::hlst:
|
|
|
$url = '/portal/star/getEcologyDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::blcx:
|
|
|
$url = '/portal/star/getTravelDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::mxft:
|
|
|
$url = '/portal/region/getStarDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::djkb:
|
|
|
$url = '/portal/region/getNewsDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::djrz:
|
|
|
$url = '/portal/region/getNoteDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::tqwl:
|
|
|
$url = '/portal/region/getFutureDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::qlxc:
|
|
|
$url = '/portal/enjoy/getEnjoyDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::sjmy:
|
|
|
$url = '/portal/enjoy/getEnjoyDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::stsy:
|
|
|
$url = '/portal/enjoy/getEnjoyDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::hwtt:
|
|
|
$url = '/portal/enjoy/getEnjoyDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::lylx:
|
|
|
$url = '/portal/scout/getTravelDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::ddfw:
|
|
|
$url = '/portal/scout/getSceneryDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::cysj:
|
|
|
$url = '/portal/scout/getSceneryDetail';
|
|
|
break;
|
|
|
case CityCategoryModel::yjyr:
|
|
|
$url = '/portal/scout/getSceneryDetail';
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
|
return $url;
|
|
|
}
|
|
|
|
|
|
//第三方微信登录
|
|
|
public function wx_login(){
|
|
|
$config = Config::get('wx_login');
|
...
|
...
|
|