|
@@ -9,7 +9,7 @@ use think\Db;
|
|
|
*/
|
|
|
class Huodong extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = ['typelist','duixianglist'];
|
|
|
+ protected $noNeedLogin = ['typelist','duixianglist','huodong_list','huodong_info','huodong_joinuser'];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
//活动类型
|
|
@@ -51,8 +51,17 @@ class Huodong extends Api
|
|
|
//活动列表
|
|
|
public function huodong_list(){
|
|
|
$type_id = input('type_id',0);
|
|
|
- $where = [];
|
|
|
|
|
|
+ //是否屏蔽
|
|
|
+ $map = [];
|
|
|
+ if($this->auth->isLogin()){
|
|
|
+ $screen_ids = Db::name('zzz_huodong_screen')->where('user_id',$this->auth->id)->column('huodong_id');
|
|
|
+ if(!empty($screen_ids)){
|
|
|
+ $map['hd.id'] = ['NOTIN',$screen_ids];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $where = [];
|
|
|
if(!empty($type_id)){
|
|
|
$where['hd.type_id'] = $type_id;
|
|
|
}
|
|
@@ -61,6 +70,7 @@ class Huodong extends Api
|
|
|
->field('hd.*,user.avatar,user.nickname,user.gender')
|
|
|
->join('user','hd.user_id = user.id','LEFT')
|
|
|
->where($where)
|
|
|
+ ->where($map)
|
|
|
->autopage()
|
|
|
->order('hd.id desc')
|
|
|
->select();
|
|
@@ -70,8 +80,11 @@ class Huodong extends Api
|
|
|
if(!empty($list)){
|
|
|
|
|
|
//我参与的活动ids
|
|
|
- $hd_ids = array_column($list,'id');
|
|
|
- $my_join_log = Db::name('zzz_hd_joinlog')->where('user_id',$this->auth->id)->where('hd_id','IN',$hd_ids)->column('hd_id');
|
|
|
+ $my_join_log = [];
|
|
|
+ if($this->auth->isLogin()){
|
|
|
+ $hd_ids = array_column($list,'id');
|
|
|
+ $my_join_log = Db::name('zzz_hd_joinlog')->where('user_id',$this->auth->id)->where('hd_id','IN',$hd_ids)->column('hd_id');
|
|
|
+ }
|
|
|
|
|
|
foreach($list as $key => &$val){
|
|
|
//是否已加入
|
|
@@ -104,9 +117,11 @@ class Huodong extends Api
|
|
|
|
|
|
//是否已加入
|
|
|
$info['is_joined'] = 0;
|
|
|
- $my_join_log = Db::name('zzz_hd_joinlog')->where('user_id',$this->auth->id)->where('hd_id',$id)->find();
|
|
|
- if($my_join_log){
|
|
|
- $info['is_joined'] = 1;
|
|
|
+ if($this->auth->isLogin()){
|
|
|
+ $my_join_log = Db::name('zzz_hd_joinlog')->where('user_id',$this->auth->id)->where('hd_id',$id)->find();
|
|
|
+ if($my_join_log){
|
|
|
+ $info['is_joined'] = 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//显示时间
|
|
@@ -218,5 +233,17 @@ class Huodong extends Api
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
+ //不感兴趣
|
|
|
+ public function screen(){
|
|
|
+ $id = input('id',0);
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'huodong_id' => $id,
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ ];
|
|
|
+ Db::name('zzz_huodong_screen')->insertGetId($data);
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|