GIT 重置

This commit is contained in:
2025-09-16 16:39:57 +08:00
parent e6f5689a94
commit 433d348f7c
2 changed files with 62 additions and 20 deletions

View File

@@ -26,30 +26,72 @@ class RoomPan
}
/*
* 盲盒转盘礼物补发
* 盲盒转盘礼物推送补发
*/
public function blind_box_turntable_gift_send(){
$blind_box_turntable_log = db('vs_blind_box_turntable_results_log')->where(['is_sued'=>0,'createtime'=>['>=',time()-60*30]])->limit(50)->select();
if(empty($blind_box_turntable_log)){
$blind_box_turntable = db('vs_blind_box_turntable_log')->where(['is_sued'=>0,'createtime'=>['>=',time()-60*30]])->limit(1000)->select();
if(empty($blind_box_turntable)){
echo "没有需要发放的礼物 \n";
}
echo "开始发放".count($blind_box_turntable_log)." \n";
foreach ($blind_box_turntable_log as $key => $value) {
$blind_box_turntable = db('vs_blind_box_turntable_log')->field('user_id,room_id')->where('id',$value['tid'])->find();
$give_gift_ext['gift_id'] = $value['gift_id'];
$give_gift_ext['count'] = $value['count'];
$give_gift_ext['gift_price'] = $value['gift_price'];
$give_gift_ext['all_gift_price'] = $value['all_gift_price'];
$give_gift_ext['is_draw_gift'] = 1;
echo "发放Id".$value['id']." 补发用户Id".$value['gift_user_id']." 礼物Id".$value['gift_id']." 礼物数量:".$value['count']."\n";
// $res = model('GiveGift')->give_gift($blind_box_turntable['user_id'], $value['gift_user_id'], $value['gift_id'], $value['count'],2,1, $blind_box_turntable['room_id'],0,0,$give_gift_ext);
$res = model('Room')->room_gift($blind_box_turntable['user_id'], $value['gift_user_id'], $value['gift_id'], $value['count'], 1, $blind_box_turntable['room_id'], 0,$value['heart_id'],$give_gift_ext);
if (isset($res) && $res['code'] != 1) {
echo "礼物发放失败".$res['msg']."\n";
echo "开始发放".count($blind_box_turntable)." \n";
foreach ($blind_box_turntable as $k => $v) {
$blind_box_turntable_results_log = db('vs_blind_box_turntable_results_log')->where('tid',$v['id'])->find();
if(empty($blind_box_turntable_results_log)){
echo $v['id']." 没有需要发放的礼物 \n";
continue;
}
db('vs_blind_box_turntable_results_log')->where('id', $value['id'])->update(['is_sued' => 1, 'updatetime' => time()]);
echo "补发成功 \n";
$room_id = $v['room_id'];
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
$FromUserInfo = Db::name('user')->where(['id'=>$v['user_id']])->find();
$user_nickname = $FromUserInfo['nickname'];
$textMessage = $user_nickname;
$text_message = $user_nickname;
foreach ($blind_box_turntable_results_log as $key => $value) {
$ToUserInfo = Db::name('user')->where(['id'=>$value['gift_user_id']])->find();
$draw_gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find();
$textMessage = $textMessage . ' 送给 ' . $ToUserInfo['nickname']. ' 盲盒转盘礼物 ' . $draw_gift['gift_name'].' x ' .$value['count']."\n";
$play_image[] = $draw_gift['play_image'];
$text_message = $text_message . '在' . $room_name . '房间送给了' . $ToUserInfo['nickname'] . $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' => $FromUserInfo['nickname'],
'toUserName' => $ToUserInfo['nickname'],
'giftName' => $draw_gift['gift_name'],
'roomId' => $room_id,
'number' => $value['count'],
];
}
$text = [
'GiftInfo' => [
'play_image' => implode(',',$play_image),
],
'text' => $textMessage
];
//聊天室推送系统消息
model('Chat')->sendMsg(1005,$room_id,$text);
$roomtype = Db::name('vs_room')->where(['id' => $room_id])->value('type_id');
if($roomtype == 6){
//推送消息
$hot_value = db::name('vs_give_gift')->where('from_id', $room_id)->where('from',6)
->sum('total_price');
$text1 = [
'room_id' => $room_id,
'hot_value' => $hot_value * 10,
'text' => '房间心动值变化'
];
//聊天室推送系统消息
model('Chat')->sendMsg(1028,$room_id,$text1);
}else{
if($draw_gift['is_public_server'] == 1){
//推送礼物横幅
$push = new Push($v['user_id'], $room_id);
$push->giftBanner($text_list_new);
}
}
db::name('vs_blind_box_turntable_log')->where('id', $v['id'])->update(['is_sued' => 1, 'updatetime' => time()]);
}
}