|
@@ -190,12 +190,52 @@ class Livebc extends Api
|
|
Db::rollback();
|
|
Db::rollback();
|
|
$this->error($wallet_rs['msg']);
|
|
$this->error($wallet_rs['msg']);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //排行榜
|
|
|
|
+ $redis = new Redis();
|
|
|
|
+ $redisconfig = config("redis");
|
|
|
|
+ $redis->connect($redisconfig["host"], $redisconfig["port"], 86400 * 31);
|
|
|
|
+
|
|
|
|
+ // 添加redis记录做财富排行榜日榜用
|
|
|
|
+ $redis->zIncrBy("livebc_jewel_to_" . $this->auth->id, $giftinfo['value'], $user_id);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // tcp 获取房间用户周前三名
|
|
|
|
+ $partyUserTop = $this->getPartyUserTop($this->auth->id);
|
|
|
|
+ $returnData["partyUserTop"] = $partyUserTop;
|
|
|
|
+ $returnData["image"] = one_domain_image($giftinfo["image"]);
|
|
|
|
+ $returnData["gif_image"] = one_domain_image($giftinfo["special"]);
|
|
|
|
|
|
Db::commit();
|
|
Db::commit();
|
|
- $this->success('赠送成功');
|
|
|
|
|
|
+ $this->success("赠送成功!",$returnData);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 用户赠送礼物后房间内用户排行,贡献榜前三名
|
|
|
|
+ */
|
|
|
|
+ private function getPartyUserTop($party_id) {
|
|
|
|
+ $redis = new Redis();
|
|
|
|
+ $redisconfig = config("redis");
|
|
|
|
+ $redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
|
|
+
|
|
|
|
+ $userModel = new \app\common\model\User();
|
|
|
|
+ // 获取条数
|
|
|
|
+ $num = 3;
|
|
|
|
+ // 获取3条财富排行周记录
|
|
|
|
+ $getweek = $redis->zRevRange("livebc_jewel_to_".$party_id,0,$num-1,true);
|
|
|
|
+ $userList = $userModel->rankList($getweek);
|
|
|
|
+ $avatarArr = [];
|
|
|
|
+ if($userList) {
|
|
|
|
+ foreach($userList as $k => $v) {
|
|
|
|
+ $v["jewel"] > 0 && $avatarArr[] = $v["avatar"];
|
|
|
|
+ }
|
|
|
|
+ // 加入缓存做备份
|
|
|
|
+ $redis->hSet("livebc_jewel_top3",$party_id,json_encode($avatarArr));
|
|
|
|
+ }
|
|
|
|
+ return $avatarArr;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|