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