|
@@ -24,7 +24,6 @@ class ActiveController extends WeChatBaseController |
|
@@ -24,7 +24,6 @@ class ActiveController extends WeChatBaseController |
24
|
}
|
24
|
}
|
25
|
//活动首页
|
25
|
//活动首页
|
26
|
public function active(){
|
26
|
public function active(){
|
27
|
- $this->checkUser();
|
|
|
28
|
$banner=Db::name('active')->where('is_top',1)->field('thumbnail,id')->select();
|
27
|
$banner=Db::name('active')->where('is_top',1)->field('thumbnail,id')->select();
|
29
|
$this->assign('banner',$banner);
|
28
|
$this->assign('banner',$banner);
|
30
|
$data=Db::name('active')->where(['status'=>1,'category_id'=>1])->select();
|
29
|
$data=Db::name('active')->where(['status'=>1,'category_id'=>1])->select();
|
|
@@ -33,7 +32,6 @@ class ActiveController extends WeChatBaseController |
|
@@ -33,7 +32,6 @@ class ActiveController extends WeChatBaseController |
33
|
}
|
32
|
}
|
34
|
//活动首页ajax
|
33
|
//活动首页ajax
|
35
|
public function activeAjax(){
|
34
|
public function activeAjax(){
|
36
|
- $this->checkUser();
|
|
|
37
|
$where['status']=1;
|
35
|
$where['status']=1;
|
38
|
$status=$this->request->param('status');
|
36
|
$status=$this->request->param('status');
|
39
|
$where['category_id']=$status;
|
37
|
$where['category_id']=$status;
|
|
@@ -50,18 +48,25 @@ class ActiveController extends WeChatBaseController |
|
@@ -50,18 +48,25 @@ class ActiveController extends WeChatBaseController |
50
|
//活动详情
|
48
|
//活动详情
|
51
|
public function activeDetail()
|
49
|
public function activeDetail()
|
52
|
{
|
50
|
{
|
53
|
- $re=$this->checkUser();
|
51
|
+ $re=Db::name('users')->where(['open_id'=>session('wechat_user')['id']])->find();
|
|
|
52
|
+ if (!$re['mobile']){
|
|
|
53
|
+ $like=0;
|
|
|
54
|
+ }else{
|
|
|
55
|
+ return $re;
|
|
|
56
|
+ }
|
54
|
$id=$this->request->param('id');
|
57
|
$id=$this->request->param('id');
|
55
|
$data=Db::name('active')
|
58
|
$data=Db::name('active')
|
56
|
->where('id',$id)
|
59
|
->where('id',$id)
|
57
|
->find();
|
60
|
->find();
|
58
|
$data['more']=json_decode($data['more'],true);
|
61
|
$data['more']=json_decode($data['more'],true);
|
59
|
$data['content']=cmf_replace_content_file_url(htmlspecialchars_decode($data['content']));
|
62
|
$data['content']=cmf_replace_content_file_url(htmlspecialchars_decode($data['content']));
|
60
|
- $like=Db::name('like')->where(['cid'=>$id,'users_id'=>$re['id'],'status'=>2])->find();
|
|
|
61
|
- if ($like){
|
|
|
62
|
- $like=1;
|
|
|
63
|
- }else{
|
|
|
64
|
- $like=0;
|
63
|
+ if (!isset($like)) {
|
|
|
64
|
+ $like = Db::name('like')->where(['cid' => $id, 'users_id' => $re['id'], 'status' => 2])->find();
|
|
|
65
|
+ if ($like) {
|
|
|
66
|
+ $like = 1;
|
|
|
67
|
+ } else {
|
|
|
68
|
+ $like = 0;
|
|
|
69
|
+ }
|
65
|
}
|
70
|
}
|
66
|
$comment=Db::name('comment')
|
71
|
$comment=Db::name('comment')
|
67
|
->alias('c')
|
72
|
->alias('c')
|
|
@@ -76,14 +81,16 @@ class ActiveController extends WeChatBaseController |
|
@@ -76,14 +81,16 @@ class ActiveController extends WeChatBaseController |
76
|
return $this->fetch('active_detail');
|
81
|
return $this->fetch('active_detail');
|
77
|
}
|
82
|
}
|
78
|
public function comment(){
|
83
|
public function comment(){
|
79
|
- $this->checkUser();
|
|
|
80
|
$id=$this->request->param('id');
|
84
|
$id=$this->request->param('id');
|
81
|
$this->assign('id',$id);
|
85
|
$this->assign('id',$id);
|
82
|
return $this->fetch();
|
86
|
return $this->fetch();
|
83
|
}
|
87
|
}
|
84
|
|
88
|
|
85
|
public function commentPost(){
|
89
|
public function commentPost(){
|
86
|
- $re=$this->checkUser();
|
90
|
+ $re=Db::name('users')->where(['open_id'=>session('wechat_user')['id']])->find();
|
|
|
91
|
+ if (!$re['mobile']){
|
|
|
92
|
+ return 3;
|
|
|
93
|
+ }
|
87
|
$param=$this->request->param();
|
94
|
$param=$this->request->param();
|
88
|
$param['create_time']=time();
|
95
|
$param['create_time']=time();
|
89
|
$param['status']=2;
|
96
|
$param['status']=2;
|
|
@@ -104,7 +111,10 @@ class ActiveController extends WeChatBaseController |
|
@@ -104,7 +111,10 @@ class ActiveController extends WeChatBaseController |
104
|
|
111
|
|
105
|
//点赞ajax接口
|
112
|
//点赞ajax接口
|
106
|
public function like(){
|
113
|
public function like(){
|
107
|
- $re=$this->checkUser();
|
114
|
+ $re=Db::name('users')->where(['open_id'=>session('wechat_user')['id']])->find();
|
|
|
115
|
+ if (!$re['mobile']){
|
|
|
116
|
+ return 3;
|
|
|
117
|
+ }
|
108
|
$param=$this->request->param();
|
118
|
$param=$this->request->param();
|
109
|
$like=new LikeService();
|
119
|
$like=new LikeService();
|
110
|
return $like->like($param['id'],2,$re['id']);
|
120
|
return $like->like($param['id'],2,$re['id']);
|