巡乐会抽奖接口提交
This commit is contained in:
@@ -254,12 +254,12 @@ class BlindBoxTurntableGift extends Model
|
|||||||
'roomId' => $room_id,
|
'roomId' => $room_id,
|
||||||
'number' => "",
|
'number' => "",
|
||||||
];
|
];
|
||||||
$push->giftBanner($text_list_new);
|
// $push->giftBanner($text_list_new);
|
||||||
}
|
}
|
||||||
if($total_draw_times == $xlh_ext['open_condition']['start_num']){
|
if($total_draw_times == $xlh_ext['open_condition']['start_num']){
|
||||||
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
|
$room = Db::name('vs_room')->field('room_name,blind_box_turntable_periods')->where(['id' => $room_id, 'apply_status' => 2])->find();
|
||||||
//正式开始推送飘屏
|
//正式开始推送飘屏
|
||||||
$text = $room_name."的巡乐会正式开始,请大家尽快参与哦!";
|
$text = $room['room_name']."的巡乐会正式开始,请大家尽快参与哦!";
|
||||||
//推送礼物横幅
|
//推送礼物横幅
|
||||||
$push = new Push(UID, $room_id);
|
$push = new Push(UID, $room_id);
|
||||||
$text_list_new = [
|
$text_list_new = [
|
||||||
@@ -272,7 +272,19 @@ class BlindBoxTurntableGift extends Model
|
|||||||
'roomId' => $room_id,
|
'roomId' => $room_id,
|
||||||
'number' => "",
|
'number' => "",
|
||||||
];
|
];
|
||||||
$push->giftBanner($text_list_new);
|
// $push->giftBanner($text_list_new);
|
||||||
|
//巡乐会正式开始
|
||||||
|
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
||||||
|
'room_id' => $room_id,
|
||||||
|
'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
|
||||||
|
'homeowner_gift_id' => $xlh_ext['locking_condition']['give_homeowner_gift_id'],
|
||||||
|
'periods' => $room['blind_box_turntable_periods'],
|
||||||
|
'num' => 0,
|
||||||
|
'createtime' => time()
|
||||||
|
]);
|
||||||
|
if(!$pan_xlh_id){
|
||||||
|
return ['code' => 0, 'msg' => '失败!', 'data' => []];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result_data = [
|
$result_data = [
|
||||||
@@ -388,6 +400,14 @@ class BlindBoxTurntableGift extends Model
|
|||||||
//巡乐会主礼物
|
//巡乐会主礼物
|
||||||
$xlh_main_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['locking_gift_id'])->find();
|
$xlh_main_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['locking_gift_id'])->find();
|
||||||
//中奖用户
|
//中奖用户
|
||||||
|
$blind_box_turntable_periods = db::name('vs_room')->where('id',$room_id)->value('blind_box_turntable_periods');
|
||||||
|
$pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$blind_box_turntable_periods])->find();
|
||||||
|
if(empty($pan_xlh)){
|
||||||
|
return ['code' => 0, 'msg' => '未开始', 'data' => null];
|
||||||
|
}
|
||||||
|
if($pan_xlh['user_id']){
|
||||||
|
$xlh_user = db::name('user')->where('id',$pan_xlh['user_id'])->find();
|
||||||
|
}
|
||||||
$result_data = [
|
$result_data = [
|
||||||
'title' => $xlh_box['name'],
|
'title' => $xlh_box['name'],
|
||||||
'rule_url' => get_system_config_value('web_site')."/api/Page/get_gift_box_rule?box_id=".$xlh_box["id"],
|
'rule_url' => get_system_config_value('web_site')."/api/Page/get_gift_box_rule?box_id=".$xlh_box["id"],
|
||||||
@@ -397,6 +417,7 @@ class BlindBoxTurntableGift extends Model
|
|||||||
'gift_id' => $room_user_gift['gid'],
|
'gift_id' => $room_user_gift['gid'],
|
||||||
'gift_name' => $room_user_gift['gift_name'],
|
'gift_name' => $room_user_gift['gift_name'],
|
||||||
'base_image' => $room_user_gift['base_image'],
|
'base_image' => $room_user_gift['base_image'],
|
||||||
|
'gift_num' => $pan_xlh['num']
|
||||||
],
|
],
|
||||||
'locking_gift' => [
|
'locking_gift' => [
|
||||||
'gift_id' => $xlh_main_gift['gid'],
|
'gift_id' => $xlh_main_gift['gid'],
|
||||||
@@ -404,6 +425,11 @@ class BlindBoxTurntableGift extends Model
|
|||||||
'gift_price' => $xlh_main_gift['gift_price'],
|
'gift_price' => $xlh_main_gift['gift_price'],
|
||||||
'base_image' => $xlh_main_gift['base_image'],
|
'base_image' => $xlh_main_gift['base_image'],
|
||||||
],
|
],
|
||||||
|
'xlh_user' => [
|
||||||
|
'user_id' => $xlh_user['id'],
|
||||||
|
'nickname' => $xlh_user['nickname'],
|
||||||
|
'avatar' => $xlh_user['avatar'],
|
||||||
|
],
|
||||||
'gift_list' => $gift_list,
|
'gift_list' => $gift_list,
|
||||||
];
|
];
|
||||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data];
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data];
|
||||||
@@ -482,16 +508,25 @@ class BlindBoxTurntableGift extends Model
|
|||||||
//处理抽中礼物命中主奖品逻辑
|
//处理抽中礼物命中主奖品逻辑
|
||||||
if($gift_bag_detail['foreign_id'] == $ext['locking_condition']['selected_gift_id']){
|
if($gift_bag_detail['foreign_id'] == $ext['locking_condition']['selected_gift_id']){
|
||||||
//中奖
|
//中奖
|
||||||
$box_turntable_log = db::name('fa_vs_room_pan_xlh')->insertGetId([
|
$pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$room['blind_box_turntable_periods']])->find();
|
||||||
|
if($pan_xlh){
|
||||||
|
$pan_xlh = db::name('vs_room_pan_xlh')->where('id',$pan_xlh['id'])->update([
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'room_id' => $room_id,
|
'num' => $pan_xlh['num'] + 1,
|
||||||
'gift_bag_id' => $gift_bag_id,
|
]);
|
||||||
'num' => $num,
|
if($pan_xlh['num'] == 0){
|
||||||
'room_id' => $room_id,
|
$end_time = time() + $ext['locking_time']['tow_no_locking_time'] * 60;
|
||||||
'bag_price' => $bag_gift['gift_price'],
|
}else{
|
||||||
|
$end_time = time() + ($ext['locking_time']['tow_no_locking_time']-$ext['locking_time']['next_time']) * 60;
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
'locking_end_time' => $end_time,
|
||||||
'createtime' => time()
|
'createtime' => time()
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//处理礼包发放记录表
|
//处理礼包发放记录表
|
||||||
$data = [];
|
$data = [];
|
||||||
@@ -533,7 +568,6 @@ class BlindBoxTurntableGift extends Model
|
|||||||
'createtime' => time(),
|
'createtime' => time(),
|
||||||
'updatetime' => time()
|
'updatetime' => time()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result_data = [
|
$result_data = [
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'gift_id'=>$gift_bag_detail['foreign_id'],
|
'gift_id'=>$gift_bag_detail['foreign_id'],
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class UserGiftPack extends Model
|
|||||||
const FIRST_CHARGE = 6;
|
const FIRST_CHARGE = 6;
|
||||||
//天降好礼
|
//天降好礼
|
||||||
const DRAW_GIFT = 7;
|
const DRAW_GIFT = 7;
|
||||||
|
//巡乐会抽奖所得
|
||||||
|
const XLH_DRAW_GIFT_GET = 8;
|
||||||
|
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
@@ -48,7 +50,8 @@ class UserGiftPack extends Model
|
|||||||
self::SYSTEM_DEDUCTION => '系统扣除',
|
self::SYSTEM_DEDUCTION => '系统扣除',
|
||||||
self::GIFT_USE => '礼物使用',
|
self::GIFT_USE => '礼物使用',
|
||||||
self::FIRST_CHARGE => '首充获得',
|
self::FIRST_CHARGE => '首充获得',
|
||||||
self::DRAW_GIFT => '天降好礼获得'
|
self::DRAW_GIFT => '天降好礼获得',
|
||||||
|
self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user