巡乐会抽奖接口提交.-联调-巡乐会结束 脚本调整
This commit is contained in:
@@ -16,7 +16,7 @@ class RoomPan
|
||||
*/
|
||||
function index()
|
||||
{
|
||||
echo "巡乐会结束 礼物发放:\n";
|
||||
echo "巡乐会礼物发放开始:\n";
|
||||
$this->xlh_gift_send();//拍卖房结束提醒
|
||||
echo "礼物发放结束 \n";
|
||||
|
||||
@@ -61,54 +61,58 @@ class RoomPan
|
||||
echo "没有需要发放的礼物 \n";
|
||||
}
|
||||
foreach ($xlh_list as $key=>$value){
|
||||
//发放
|
||||
//抽中礼物落包
|
||||
$res = [];
|
||||
$res = model('api/UserGiftPack')->change_user_gift_pack($value['user_id'],$value['gift_id'],$value['num'],model('UserGiftPack')::XLH_DRAW_GIFT_GET,"巡乐会中奖发放");
|
||||
if ($res['code'] != 1) {
|
||||
echo $res['msg']."\n";
|
||||
continue;
|
||||
try{
|
||||
//发放
|
||||
//抽中礼物落包
|
||||
$res = [];
|
||||
$res = model('api/UserGiftPack')->change_user_gift_pack($value['user_id'],$value['gift_id'],$value['num'],model('UserGiftPack')::XLH_DRAW_GIFT_GET,"巡乐会中奖发放");
|
||||
if ($res['code'] != 1) {
|
||||
echo $res['msg']."\n";
|
||||
continue;
|
||||
}
|
||||
echo "巡乐会中奖礼物发放成功 用户Id:".$value['user_id']."\n";
|
||||
//房主礼物落包
|
||||
$res = [];
|
||||
//获取房主id
|
||||
$user_id = db::name('vs_room')->where(['id'=>$value['room_id']])->value('user_id');
|
||||
$res = model('api/UserGiftPack')->change_user_gift_pack($user_id,$value['homeowner_gift_id'],1,model('UserGiftPack')::XLH_DRAW_GIFT_GET,"巡乐会中奖后房主礼物发放");
|
||||
if ($res['code'] != 1) {
|
||||
echo $res['msg']."\n";
|
||||
continue;
|
||||
}
|
||||
echo "巡乐会中奖后房主礼物发放成功 房主Id:".$user_id."\n";
|
||||
//处理发放记录
|
||||
$res = [];
|
||||
$res = db::name('vs_room_pan_xlh')->where('id',$value['id'])->update([
|
||||
'send_time' => time()
|
||||
]);
|
||||
$xlh_log = db::name('vs_room_pan_xlh_log')->where(['xlh_id'=>$value['id'],'user_id'=>$value['user_id']])->order('id desc')->find();
|
||||
$res = db::name('vs_room_pan_xlh_log')->where('id',$xlh_log['id'])->update([
|
||||
'is_send' => 1
|
||||
]);
|
||||
if ($res === false) {
|
||||
echo "处理发放记录失败 \n";
|
||||
continue;
|
||||
}
|
||||
db::name("vs_room")->where('id',$value['room_id'])->update([
|
||||
'xlh_periods_num' => 0
|
||||
]);
|
||||
//推送
|
||||
$FromUserInfo = db::name('user')->field('nickname,avatar')->where(['id'=>$value['user_id']])->find();
|
||||
$room_name = db::name('vs_room')->where(['id'=>$value['room_id']])->value('room_name');
|
||||
$gift_name = db::name('vs_gift')->where(['gid'=>$value['gift_id']])->value('gift_name');
|
||||
$text = $FromUserInfo['nickname'] . ' 用户在 ' . $room_name.' 房间巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包";
|
||||
//推送礼物横幅
|
||||
$push = new Push(0, $value['room_id']);
|
||||
$text_list_new = [
|
||||
'text' => $text,
|
||||
'room_id' => $value['room_id'],
|
||||
'from_type' => 3
|
||||
];
|
||||
$push->xunlehui($text_list_new);
|
||||
}catch (\Exception $e){
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
echo "巡乐会中奖礼物发放成功 用户Id:".$value['user_id']."\n";
|
||||
//房主礼物落包
|
||||
$res = [];
|
||||
//获取房主id
|
||||
$user_id = db::name('vs_room')->where(['id'=>$value['room_id']])->value('user_id');
|
||||
$res = model('api/UserGiftPack')->change_user_gift_pack($user_id,$value['homeowner_gift_id'],1,model('UserGiftPack')::XLH_DRAW_GIFT_GET,"巡乐会中奖后房主礼物发放");
|
||||
if ($res['code'] != 1) {
|
||||
echo $res['msg']."\n";
|
||||
continue;
|
||||
}
|
||||
echo "巡乐会中奖后房主礼物发放成功 房主Id:".$user_id."\n";
|
||||
//处理发放记录
|
||||
$res = [];
|
||||
$res = db::name('vs_room_pan_xlh')->where('id',$value['id'])->update([
|
||||
'send_time' => time()
|
||||
]);
|
||||
$xlh_log = db::name('vs_room_pan_xlh_log')->where(['xlh_id'=>$value['id'],'user_id'=>$value['user_id']])->order('id desc')->find();
|
||||
$res = db::name('vs_room_pan_xlh_log')->where('id',$xlh_log)->update([
|
||||
'is_send' => 1
|
||||
]);
|
||||
if ($res === false) {
|
||||
echo "处理发放记录失败 \n";
|
||||
continue;
|
||||
}
|
||||
db::name("vs_room")->where('id',$value['room_id'])->update([
|
||||
'xlh_periods_num' => 0
|
||||
]);
|
||||
//推送
|
||||
$FromUserInfo = db::name('user')->field('nickname,avatar')->where(['id'=>$value['user_id']])->find();
|
||||
$room_name = db::name('vs_room')->where(['id'=>$value['room_id']])->value('room_name');
|
||||
$gift_name = db::name('vs_gift')->where(['id'=>$value['gift_id']])->value('gift_name');
|
||||
$text = $FromUserInfo['nickname'] . ' 用户在 ' . $room_name.' 房间巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包";
|
||||
//推送礼物横幅
|
||||
$push = new Push(UID, $value['room_id']);
|
||||
$text_list_new = [
|
||||
'text' => $text,
|
||||
'room_id' => $value['room_id'],
|
||||
'from_type' => 3
|
||||
];
|
||||
$push->xunlehui($text_list_new);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user