|
@@ -23,6 +23,39 @@ class Plantask extends Controller
|
|
Db::name('gift_baobi_log')->where($map)->delete();
|
|
Db::name('gift_baobi_log')->where($map)->delete();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //每天24点,房间流水重置:麦位红心,两个排行榜
|
|
|
|
+ public function auto_party_clear(){
|
|
|
|
+
|
|
|
|
+ //redis
|
|
|
|
+ $redis = new Redis();
|
|
|
|
+ $redisconfig = config("redis");
|
|
|
|
+ $redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
|
|
+ if ($redisconfig['redis_pwd']) {
|
|
|
|
+ $redis->auth($redisconfig['redis_pwd']);
|
|
|
|
+ }
|
|
|
|
+ if($redisconfig['redis_selectdb'] > 0){
|
|
|
|
+ $redis->select($redisconfig['redis_selectdb']);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //所有正常的房间
|
|
|
|
+ $partyInfo_arr = Db::name('party')->where('status',1)->column('id,user_id,easemob_room_id');
|
|
|
|
+ //dump($partyInfo_arr);exit;
|
|
|
|
+ foreach($partyInfo_arr as $party_id => $partyInfo){
|
|
|
|
+
|
|
|
|
+ //用户魅力榜,清空
|
|
|
|
+ $redis->zRemRangeByRank("hourCharm_".$party_id, 0,-1);
|
|
|
|
+
|
|
|
|
+ //用户贡献榜,清空
|
|
|
|
+ $redis->zRemRangeByRank("hourWealth_".$party_id, 0,-1);
|
|
|
|
+
|
|
|
|
+ //贡献榜前三,设置为空
|
|
|
|
+ $redis->hSet("user_jewel_top3",$party_id,json_encode([]));
|
|
|
|
+
|
|
|
|
+ //更新麦位魅力值
|
|
|
|
+ $this->clearSeatCharm($partyInfo['easemob_room_id'],$partyInfo,$redis);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//送礼物(api/party/giveGiftToYou)拆分出来的异步用户升级方法,
|
|
//送礼物(api/party/giveGiftToYou)拆分出来的异步用户升级方法,
|
|
|
|
|
|
|
|
|
|
@@ -128,6 +161,43 @@ class Plantask extends Controller
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 更新到麦位小红心为0,其他不变
|
|
|
|
+ */
|
|
|
|
+ private function clearSeatCharm($easemob_room_id,$party_info,$redis) {
|
|
|
|
+ //获取已有信息
|
|
|
|
+
|
|
|
|
+ $easemob = new Easemob();
|
|
|
|
+ $seatlist = $easemob->room_getRoomCustomAttribute($easemob_room_id,['seat0','seat1','seat2','seat3','seat4','seat5','seat6','seat7']);
|
|
|
|
+
|
|
|
|
+ if(empty($seatlist)){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $matedata = [];
|
|
|
|
+
|
|
|
|
+ //轮询麦位
|
|
|
|
+ foreach($seatlist as $seatnum => $seatdata){
|
|
|
|
+ $seatdata = json_decode($seatdata,true);
|
|
|
|
+
|
|
|
|
+ $seatdata['charm'] = 0;//改为0
|
|
|
|
+
|
|
|
|
+ $seatdata = json_encode($seatdata);
|
|
|
|
+
|
|
|
|
+ $matedata[$seatnum] = $seatdata;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //重新设置麦位小红心
|
|
|
|
+ //获取房间用户周前三名 getPartyUserTop里面摘出来的一部分
|
|
|
|
+ //[环信]更新财富榜前3。
|
|
|
|
+ $avatarArr = $redis->hGet("user_jewel_top3",$party_info['id']);
|
|
|
|
+ $matedata['wealth_top3_userlist'] = $avatarArr;
|
|
|
|
+ $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$party_info['user_id'],$matedata);
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|