...
|
...
|
@@ -24,7 +24,6 @@ class ActiveController extends WeChatBaseController |
|
|
}
|
|
|
//活动首页
|
|
|
public function active(){
|
|
|
$this->checkUser();
|
|
|
$banner=Db::name('active')->where('is_top',1)->field('thumbnail,id')->select();
|
|
|
$this->assign('banner',$banner);
|
|
|
$data=Db::name('active')->where(['status'=>1,'category_id'=>1])->select();
|
...
|
...
|
@@ -33,7 +32,6 @@ class ActiveController extends WeChatBaseController |
|
|
}
|
|
|
//活动首页ajax
|
|
|
public function activeAjax(){
|
|
|
$this->checkUser();
|
|
|
$where['status']=1;
|
|
|
$status=$this->request->param('status');
|
|
|
$where['category_id']=$status;
|
...
|
...
|
@@ -50,18 +48,25 @@ class ActiveController extends WeChatBaseController |
|
|
//活动详情
|
|
|
public function activeDetail()
|
|
|
{
|
|
|
$re=$this->checkUser();
|
|
|
$re=Db::name('users')->where(['open_id'=>session('wechat_user')['id']])->find();
|
|
|
if (!$re['mobile']){
|
|
|
$like=0;
|
|
|
}else{
|
|
|
return $re;
|
|
|
}
|
|
|
$id=$this->request->param('id');
|
|
|
$data=Db::name('active')
|
|
|
->where('id',$id)
|
|
|
->find();
|
|
|
$data['more']=json_decode($data['more'],true);
|
|
|
$data['content']=cmf_replace_content_file_url(htmlspecialchars_decode($data['content']));
|
|
|
$like=Db::name('like')->where(['cid'=>$id,'users_id'=>$re['id'],'status'=>2])->find();
|
|
|
if ($like){
|
|
|
$like=1;
|
|
|
}else{
|
|
|
$like=0;
|
|
|
if (!isset($like)) {
|
|
|
$like = Db::name('like')->where(['cid' => $id, 'users_id' => $re['id'], 'status' => 2])->find();
|
|
|
if ($like) {
|
|
|
$like = 1;
|
|
|
} else {
|
|
|
$like = 0;
|
|
|
}
|
|
|
}
|
|
|
$comment=Db::name('comment')
|
|
|
->alias('c')
|
...
|
...
|
@@ -76,14 +81,16 @@ class ActiveController extends WeChatBaseController |
|
|
return $this->fetch('active_detail');
|
|
|
}
|
|
|
public function comment(){
|
|
|
$this->checkUser();
|
|
|
$id=$this->request->param('id');
|
|
|
$this->assign('id',$id);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
public function commentPost(){
|
|
|
$re=$this->checkUser();
|
|
|
$re=Db::name('users')->where(['open_id'=>session('wechat_user')['id']])->find();
|
|
|
if (!$re['mobile']){
|
|
|
return 3;
|
|
|
}
|
|
|
$param=$this->request->param();
|
|
|
$param['create_time']=time();
|
|
|
$param['status']=2;
|
...
|
...
|
@@ -104,7 +111,10 @@ class ActiveController extends WeChatBaseController |
|
|
|
|
|
//点赞ajax接口
|
|
|
public function like(){
|
|
|
$re=$this->checkUser();
|
|
|
$re=Db::name('users')->where(['open_id'=>session('wechat_user')['id']])->find();
|
|
|
if (!$re['mobile']){
|
|
|
return 3;
|
|
|
}
|
|
|
$param=$this->request->param();
|
|
|
$like=new LikeService();
|
|
|
return $like->like($param['id'],2,$re['id']);
|
...
|
...
|
|