|
@@ -72,7 +72,7 @@ class Livebc extends Api
|
|
$this->error(__('Operation frequently'));
|
|
$this->error(__('Operation frequently'));
|
|
}*/
|
|
}*/
|
|
|
|
|
|
- /*$user_id = input('user_id');// 赠送对象
|
|
|
|
|
|
+ $user_id = input('user_id');// 赠送对象
|
|
$gift_id = input('gift_id');// 礼物ID
|
|
$gift_id = input('gift_id');// 礼物ID
|
|
|
|
|
|
if (!$user_id || !$gift_id )
|
|
if (!$user_id || !$gift_id )
|
|
@@ -161,23 +161,23 @@ class Livebc extends Api
|
|
|
|
|
|
// 添加redis记录做贡献排行榜
|
|
// 添加redis记录做贡献排行榜
|
|
$redis->zIncrBy("livebc_jewel_to_" . $partyid, $giftinfo['value'], $this->auth->id);
|
|
$redis->zIncrBy("livebc_jewel_to_" . $partyid, $giftinfo['value'], $this->auth->id);
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
|
|
// tcp 获取房间用户周前三名
|
|
// tcp 获取房间用户周前三名
|
|
- $partyUserTop = $this->getPartyUserTop(54);
|
|
|
|
- /* $returnData["partyUserTop"] = $partyUserTop;
|
|
|
|
|
|
+ $partyUserTop = $this->getPartyUserTop($partyid);
|
|
|
|
+ $returnData["partyUserTop"] = $partyUserTop;
|
|
$returnData["image"] = one_domain_image($giftinfo["image"]);
|
|
$returnData["image"] = one_domain_image($giftinfo["image"]);
|
|
$returnData["gif_image"] = one_domain_image($giftinfo["special"]);
|
|
$returnData["gif_image"] = one_domain_image($giftinfo["special"]);
|
|
|
|
|
|
Db::commit();
|
|
Db::commit();
|
|
- $this->success("赠送成功!",$returnData);*/
|
|
|
|
|
|
+ $this->success("赠送成功!",$returnData);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 用户赠送礼物后房间内用户排行,贡献榜前三名
|
|
* 用户赠送礼物后房间内用户排行,贡献榜前三名
|
|
*/
|
|
*/
|
|
- public function getPartyUserTop($party_id) {
|
|
|
|
|
|
+ private function getPartyUserTop($party_id) {
|
|
$redis = new Redis();
|
|
$redis = new Redis();
|
|
$redisconfig = config("redis");
|
|
$redisconfig = config("redis");
|
|
$redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
$redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
@@ -188,8 +188,6 @@ class Livebc extends Api
|
|
// 获取3条财富排行周记录
|
|
// 获取3条财富排行周记录
|
|
$getweek = $redis->zRevRange("livebc_jewel_to_".$party_id,0,$num-1,true);
|
|
$getweek = $redis->zRevRange("livebc_jewel_to_".$party_id,0,$num-1,true);
|
|
$userList = $userModel->rankList($getweek);
|
|
$userList = $userModel->rankList($getweek);
|
|
- dump($getweek);
|
|
|
|
- dump($userList);
|
|
|
|
|
|
|
|
$avatarArr = [];
|
|
$avatarArr = [];
|
|
if($userList) {
|
|
if($userList) {
|
|
@@ -198,36 +196,12 @@ class Livebc extends Api
|
|
}
|
|
}
|
|
// 加入缓存做备份
|
|
// 加入缓存做备份
|
|
$redis->hSet("user_jewel_top3",$party_id,json_encode($avatarArr));
|
|
$redis->hSet("user_jewel_top3",$party_id,json_encode($avatarArr));
|
|
- //$redis->hSet("livebc_jewel_top3",$party_id,json_encode($avatarArr));
|
|
|
|
}
|
|
}
|
|
- dump($avatarArr);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//准备返回数据,刷礼物的总值,刷礼物人数,榜一信息
|
|
//准备返回数据,刷礼物的总值,刷礼物人数,榜一信息
|
|
public function outlivebc($party_id){
|
|
public function outlivebc($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);
|
|
|
|
- dump($getweek);
|
|
|
|
- dump($userList);
|
|
|
|
|
|
|
|
- $avatarArr = [];
|
|
|
|
- if($userList) {
|
|
|
|
- foreach($userList as $k => $v) {
|
|
|
|
- $v["jewel"] > 0 && $avatarArr[] = $v["avatar"];
|
|
|
|
- }
|
|
|
|
- // 加入缓存做备份
|
|
|
|
- $redis->hSet("user_jewel_top3",$party_id,json_encode($avatarArr));
|
|
|
|
- //$redis->hSet("livebc_jewel_top3",$party_id,json_encode($avatarArr));
|
|
|
|
- }
|
|
|
|
- dump($avatarArr);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|