巡乐会抽奖接口提交.-抽奖记录
This commit is contained in:
@@ -284,15 +284,9 @@ class BlindBoxTurntableGift extends Model
|
||||
$push = new Push(UID, $room_id);
|
||||
$text_list_new = [
|
||||
'text' => $text,
|
||||
'gift_picture' => "",
|
||||
'room_id' => $room_id,
|
||||
'fromUserName' => "",
|
||||
'toUserName' => "",
|
||||
'giftName' => "",
|
||||
'roomId' => $room_id,
|
||||
'number' => "",
|
||||
'room_id' => $room_id
|
||||
];
|
||||
// $push->giftBanner($text_list_new);
|
||||
$push->xunlehui($text_list_new);
|
||||
}
|
||||
if($total_draw_times == $xlh_ext['open_condition']['start_num']){
|
||||
$room = Db::name('vs_room')->field('room_name,blind_box_turntable_periods')->where(['id' => $room_id, 'apply_status' => 2])->find();
|
||||
@@ -302,15 +296,9 @@ class BlindBoxTurntableGift extends Model
|
||||
$push = new Push(UID, $room_id);
|
||||
$text_list_new = [
|
||||
'text' => $text,
|
||||
'gift_picture' => "",
|
||||
'room_id' => $room_id,
|
||||
'fromUserName' => "",
|
||||
'toUserName' => "",
|
||||
'giftName' => "",
|
||||
'roomId' => $room_id,
|
||||
'number' => "",
|
||||
'room_id' => $room_id
|
||||
];
|
||||
// $push->giftBanner($text_list_new);
|
||||
$push->xunlehui($text_list_new);
|
||||
//巡乐会正式开始
|
||||
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
||||
'room_id' => $room_id,
|
||||
@@ -497,6 +485,7 @@ class BlindBoxTurntableGift extends Model
|
||||
if(empty($pan_xlh)){
|
||||
return ['code' => 0, 'msg' => '未开始', 'data' => null];
|
||||
}
|
||||
$is_zhong_jiang = 0;
|
||||
for($i = 0; $i < $num; $i++){
|
||||
//随机获取一个礼物
|
||||
$where = [
|
||||
@@ -552,24 +541,26 @@ class BlindBoxTurntableGift extends Model
|
||||
//处理抽中礼物命中主奖品逻辑
|
||||
if($gift_bag_detail['foreign_id'] == $ext['locking_condition']['selected_gift_id']){
|
||||
//中奖
|
||||
if($pan_xlh['num'] == 0){
|
||||
$pan_xlh_num = $pan_xlh['num']+1;
|
||||
if($pan_xlh_num <= 1){
|
||||
$end_time = time() + $ext['locking_time']['tow_no_locking_time'] * 60;
|
||||
}else{
|
||||
$end_time = time() + ($ext['locking_time']['tow_no_locking_time']-$ext['locking_time']['next_time']) * 60;
|
||||
}
|
||||
db::name('vs_room_pan_xlh')->where('id',$pan_xlh['id'])->update([
|
||||
'user_id' => $user_id,
|
||||
'num' => $pan_xlh['num'] + 1,
|
||||
'num' => $pan_xlh_num,
|
||||
'end_time' => $end_time,
|
||||
'updatetime' => time()
|
||||
]);
|
||||
db::name('vs_room_pan_xlh_log')->insertGetId([
|
||||
'xlh_id' => $pan_xlh['id'],
|
||||
'user_id' => $user_id,
|
||||
'num' => isset($pan_xlh['num']) ? $pan_xlh['num']+1 : 1,
|
||||
'num' => $pan_xlh_num,
|
||||
'locking_end_time' => $end_time,
|
||||
'createtime' => time()
|
||||
]);
|
||||
$is_zhong_jiang = 1;
|
||||
}
|
||||
//减去盲盒包礼物数量
|
||||
$ret = db::name("vs_room_pan")->where(['room_id'=>$room_id,'gift_bag_detail_id'=>$gift_bag_detail['id']])->setDec('remaining_number',1);
|
||||
@@ -631,19 +622,20 @@ class BlindBoxTurntableGift extends Model
|
||||
'createtime' => time(),
|
||||
'updatetime' => time()
|
||||
]);
|
||||
if($is_zhong_jiang == 1){
|
||||
//推送
|
||||
$FromUserInfo = db::name('user')->field('nickname,avatar')->where(['id'=>$user_id])->find();
|
||||
$room_name = db::name('vs_room')->where(['id'=>$room_id])->value('name');
|
||||
$gift_name = db::name('vs_gift')->where(['id'=>$value['gift_id']])->value('gift_name');
|
||||
$text = $FromUserInfo['nickname'] . ' 用户在 ' . $room_name.' 房间巡乐会中 ' .$gift_name.'礼物 x ' .$value['count']." 已收入背包";
|
||||
$text = [
|
||||
'gift_num' => $pan_xlh['num']+1,
|
||||
'gift_num' => $pan_xlh_num,
|
||||
'userInfo' => $FromUserInfo,
|
||||
'text' => $text
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('Chat')->sendMsg(1057,$room_id,$text);
|
||||
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $result_data];
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ class Push
|
||||
//推送系统消息
|
||||
const PUSH_SYSTEM_MESSAGE = 7000;//推送系统消息
|
||||
|
||||
//房间盘推送
|
||||
//巡乐会推送开启进度推送
|
||||
const PUSH_ROOM_PAN_XLH_PROGRESS = 8000;
|
||||
|
||||
public $user_id, $room_id, $topic_room, $topic_client;
|
||||
|
||||
public function __construct($user_id = 0, $room_id = 0)
|
||||
@@ -287,6 +291,12 @@ class Push
|
||||
$this->push(self::PUSH_SYSTEM_MESSAGE, $topic, $data);
|
||||
}
|
||||
|
||||
//巡乐会推送
|
||||
public function xunlehui($data){
|
||||
$topic = 'xunlehui';
|
||||
$this->push(self::PUSH_ROOM_PAN_XLH_PROGRESS, $topic, $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user