作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

测试反馈修改

... ... @@ -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']);
... ...
... ... @@ -333,6 +333,10 @@
$(".commentnum").html(num)
window.location.reload();
}
else if (data==3){
alert('请先注册')
window.location.href="{:url('user/register/register')}";
}
}
})
})
... ...
... ... @@ -75,7 +75,12 @@
else if (data==2){
alert('您已经评论过了')
return false;
}else {
}
else if (data==3){
alert('请先注册')
window.location.href="{:url('user/register/register')}";
}
else {
alert('评论成功')
window.location.href=data;
}
... ...