Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -128,6 +128,16 @@ class Room extends BaseCom
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//进入房间前的判断
|
||||
public function before_join_room_check()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$reslut = model('Room')->before_join_room_check($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 进入房间
|
||||
*/
|
||||
|
||||
@@ -43,12 +43,6 @@ class Lottery extends Model
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($send_uid);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($send_uid,9);//聊天气泡
|
||||
|
||||
$nums = $num * count($toarray);
|
||||
$ress = $this->lottery($send_uid,$gift_info['gift_price'],$nums,$room_id,$gift_id,$FromUserInfo,$gift_info);
|
||||
if($ress['code'] == 0){
|
||||
return ['code' => 0, 'msg' => $ress['msg'], 'data' => null];
|
||||
}
|
||||
|
||||
//送礼 开启事务
|
||||
Db::startTrans();
|
||||
//扣除用户金币并记录日志
|
||||
@@ -125,6 +119,14 @@ class Lottery extends Model
|
||||
model('api/Chat')->sendMsg(1005,$room_id,$text);
|
||||
}
|
||||
Db::commit();
|
||||
|
||||
//计算爆币
|
||||
$nums = $num * count($toarray);
|
||||
$ress = $this->lottery($send_uid,$gift_info['gift_price'],$nums,$room_id,$gift_id,$FromUserInfo,$gift_info);
|
||||
if($ress['code'] == 0){
|
||||
return ['code' => 0, 'msg' => $ress['msg'], 'data' => null];
|
||||
}
|
||||
|
||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
@@ -555,8 +555,8 @@ class Room extends Model
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => ['total_amount' => $total_amount, 'total_earning' => $total_earning,'list' => $list_data_array]];
|
||||
}
|
||||
|
||||
//进入房间
|
||||
public function join_room($user_id, $room_id, $password) {
|
||||
//进入房间前的判断
|
||||
public function before_join_room_check($user_id, $room_id) {
|
||||
$room = db::name('vs_room')->where(['id' => $room_id,'apply_status' => ['in',[1,2]]])->find();
|
||||
if (!isset($room)) {
|
||||
return ['code' => 0, 'msg' => '房间不存在', 'data' => ''];
|
||||
@@ -564,11 +564,6 @@ class Room extends Model
|
||||
if($room['apply_status'] == 1){
|
||||
return ['code' => 0, 'msg' => '房间正在审核中……', 'data' => ''];
|
||||
}
|
||||
if(isset($room['password']) && $user_id != $room['user_id']){
|
||||
if (empty($password) || $room['password'] != md5($password)) {
|
||||
return ['code' => 0, 'msg' => '密码错误', 'data' => ''];
|
||||
}
|
||||
}
|
||||
|
||||
if ($room['room_status'] == 2) {//1正常2封禁3关闭
|
||||
$minutes = floor(($room['seal_time'] - time()) % 86400 / 60);
|
||||
@@ -646,7 +641,22 @@ class Room extends Model
|
||||
$this->quit_room($user_id, $room_user,$user_id);
|
||||
}
|
||||
}
|
||||
return ['code' => 1,
|
||||
'msg' => '成功',
|
||||
'data' => null
|
||||
];
|
||||
}
|
||||
|
||||
//进入房间
|
||||
public function join_room($user_id, $room_id, $password) {
|
||||
$room = db::name('vs_room')->where(['id' => $room_id,'apply_status' => ['in',[1,2]]])->find();
|
||||
if(isset($room['password']) && $user_id != $room['user_id']){
|
||||
if (empty($password) || $room['password'] != md5($password)) {
|
||||
return ['code' => 0, 'msg' => '密码错误', 'data' => ''];
|
||||
}
|
||||
}
|
||||
|
||||
$room = db::name('vs_room')->where(['id' => $room_id,'apply_status' => ['in',[1,2]]])->find();
|
||||
//K歌模式下获取歌曲信息
|
||||
$song_pit_list = null;
|
||||
$song_list = null;
|
||||
|
||||
@@ -245,8 +245,8 @@ if small_total_times >= small_trigger_times then
|
||||
result.big_ratio = big_ratio
|
||||
|
||||
-- 大奖金额计算(基于开奖前的总金额)
|
||||
result.big_prize_amount = math.floor(result.big_pool_total_before_open * big_ratio / 100 * 100) / 100
|
||||
result.big_release_amount = math.floor((result.big_pool_total_before_open - result.big_prize_amount) * 100) / 100
|
||||
result.big_prize_amount = math.floor(big_threshold * big_ratio / 100)
|
||||
result.big_release_amount = math.floor(big_total_gold - result.big_prize_amount)
|
||||
|
||||
-- 重置大奖池,大轮次+1
|
||||
redis.call('set', big_total_gold_key, 0)
|
||||
|
||||
@@ -152,17 +152,17 @@ class LotteryService
|
||||
2, // 大奖池
|
||||
3, // 划转
|
||||
$result['small_remain_amount'],//小奖剩余金额
|
||||
$result['big_total_gold'] - $result['small_remain_amount'],
|
||||
$result['big_total_gold'],
|
||||
$result['big_pool_total_before_open'] - $result['small_remain_amount'],
|
||||
$result['big_pool_total_before_open'],
|
||||
$giftId,
|
||||
$result['big_round'] - ($result['is_big_prize'] ? 1 : 0),
|
||||
"小奖剩余划转大奖池:{$result['small_remain_amount']}金币"
|
||||
);
|
||||
|
||||
|
||||
//2.开小奖剩余划入大奖后 大奖够开奖
|
||||
//开大奖
|
||||
if ($result['is_big_prize'] == 1) {
|
||||
// 大奖中奖记录
|
||||
//2.1 大奖中奖记录
|
||||
$this->addWinnerRecord(
|
||||
$winnerUid,
|
||||
2, // 大奖
|
||||
@@ -210,12 +210,12 @@ class LotteryService
|
||||
$this->addPoolFlow(
|
||||
1, // 小奖池
|
||||
2, // 开奖扣除
|
||||
$result['small_prize_amount'],
|
||||
$result['small_total_gold'],
|
||||
$result['small_total_gold'],
|
||||
0,
|
||||
$result['small_total_gold'] - $result['small_prize_amount'],
|
||||
$giftId,
|
||||
$result['small_round'] - 1, // 开奖轮次为当前轮次-1(已结束的轮次)
|
||||
"小奖池开奖:轮次" . ($result['small_round'] - 1).",累计{$result['small_total_gold']}金币"
|
||||
"小奖池开奖:轮次" . ($result['small_round'] - 1).",中奖金额:{$result['small_prize_amount']}金币"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user