盲盒转盘落包,加推送。

This commit is contained in:
2025-12-23 18:34:31 +08:00
parent 697512c46d
commit b63184ce52
2 changed files with 36 additions and 2 deletions

View File

@@ -1554,12 +1554,14 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
if (isset($send_result['code']) && $send_result['code'] !== 1) {
throw new \Exception($send_result['msg']);
}
$gift_counts = $send_result['data'];
// 插入抽奖结果
$this->batchInsertBlindBoxResults($precomputed_results, $log_id);
//中大奖礼物飘屏
$this->pushGiftBanner($bag_data,$user_id,$gift_counts,$room_id);
Db::commit();
// 返回结果
@@ -1776,4 +1778,36 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
}
return ['code' => 1, 'msg' => '发送礼物成功', 'data' => $giftCounts];
}
/**
* 岁月之城,时空之旅抽奖-处理中奖通知 推送礼物横幅
*/
private function pushGiftBanner($bag_data,$user_id,$gift_counts,$room_id)
{
if($gift_counts){
$user_nickname = Db::name('user')->where(['id'=>$user_id])->value('nickname');
$text_list_new = [];
foreach ($gift_counts as $value) {
$draw_gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find();
if($draw_gift['is_public_server'] == 1){
$text_message = $user_nickname . '在' . $bag_data['gift_bag_name'] . '中获得了礼物' . $draw_gift['gift_name'] . 'X' . $value['count']."\n";
$text_list_new[] = [
'text' => $text_message,
'gift_picture' => $draw_gift['base_image'],
'room_id' => $room_id,
'fromUserName' => $user_nickname,
'toUserName' => '',
'giftName' => $draw_gift['gift_name'],
'roomId' => $room_id,
'number' => $value['count'],
];
}
if(!empty($text_list_new)){
//推送礼物横幅
$push = new Push($user_id, $room_id);
$push->giftBanner($text_list_new);
}
}
}
}
}