每日任务 练歌房
This commit is contained in:
@@ -63,7 +63,8 @@ class RoomSong extends BaseCom
|
||||
redis_lock_exit($key_name);
|
||||
$room_id = input('room_id');
|
||||
$now_room_song_id = input('now_did');
|
||||
$res = model('RoomSong')->change_song($room_id,$now_room_song_id);
|
||||
$is_auto_next = input('is_auto_next');
|
||||
$res = model('RoomSong')->change_song($room_id,$now_room_song_id,$is_auto_next);
|
||||
redis_unlock($key_name);
|
||||
return V($res['code'], $res['msg'], $res['data']);
|
||||
}
|
||||
|
||||
@@ -3383,6 +3383,18 @@ class Room extends Model
|
||||
return $room_ids[array_rand($room_ids)];
|
||||
}
|
||||
|
||||
if($task_id == 33){
|
||||
//练歌:type= 1 label =2
|
||||
$room_ids = db::name('vs_room')->alias('a')->join('vs_room_visitor b','a.id = b.room_id','right')
|
||||
->where(['a.type_id' => 1,'a.label_id' => 2,'a.room_status' => 1,'b.user_id' => ['<>',0]])
|
||||
->column('a.id');
|
||||
if(!$room_ids){
|
||||
return 0;
|
||||
}
|
||||
//在上面获取 一个随义的id
|
||||
return $room_ids[array_rand($room_ids)];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ class RoomSong extends Model
|
||||
}
|
||||
|
||||
//切歌
|
||||
public function change_song($room_id,$now_room_song_id){
|
||||
public function change_song($room_id,$now_room_song_id,$is_auto_next = 0){
|
||||
//根据传过来的参数查询当前场次
|
||||
$times = db::name('vs_room_song')->where('did',$now_room_song_id)->value('times');
|
||||
//查询下一首歌曲
|
||||
@@ -423,6 +423,12 @@ class RoomSong extends Model
|
||||
'nextInfo' => $next_song_info
|
||||
];
|
||||
model('Chat')->sendMsg(1013,$room_id,$text);
|
||||
if($is_auto_next == 1){
|
||||
$uid = db::name('vs_room_song')->where('did',$now_room_song_id)->value('user_id');
|
||||
//任务:33-每日增加练歌房唱5首歌
|
||||
model('Tasks')->tasks_complete($uid,33);
|
||||
}
|
||||
|
||||
return ['code'=>1,'msg'=>'切歌成功','data'=>null];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user