送盲盒 数据整合
This commit is contained in:
@@ -269,6 +269,7 @@ class SendGift extends Model
|
||||
|
||||
$receive_gift_total = 0;//收礼人收到的礼物总值
|
||||
$gift_box = [];//开出的盲盒
|
||||
$gift_box_str = '';
|
||||
|
||||
//查询礼物是否是盲盒
|
||||
if($gift_info['label'] == 2){//趣味礼物(盲盒)
|
||||
@@ -280,11 +281,14 @@ class SendGift extends Model
|
||||
return ['code' => 0, 'msg' => '网络错误-3', 'data' => null];
|
||||
}
|
||||
$gift_box[$i] = $gift_box1[$i]['data'];
|
||||
//礼物整合
|
||||
$gift_box_str .= $gift_box[$i]['gift_name'] . 'x' . $gift_box[$i]['num'].'/';
|
||||
//开出的礼物价值
|
||||
$receive_gift_total += $gift_box[$i]['gift_price'];
|
||||
|
||||
Log::record("送礼开出盲盒礼物信息:".json_encode($gift_box1),"info");
|
||||
}
|
||||
$gift_box_str = substr($gift_box_str,0,-1);//去掉最后一个/
|
||||
}else{
|
||||
$receive_gift_total = $gift_price;
|
||||
|
||||
@@ -421,18 +425,18 @@ class SendGift extends Model
|
||||
}
|
||||
}
|
||||
|
||||
$give_gift = 0;//送礼记录表ID(雪花ID)
|
||||
if($gift_info['label'] == 2) {//趣味礼物(盲盒)
|
||||
if($gift_box){
|
||||
foreach ($gift_box as $i => $v){
|
||||
//记录一下收礼记录
|
||||
$give_gift = $this -> change_user_give_gift_logs($uid,$v['gift_id'],$v['gift_price'],1,$to_uid,2,$type,$room_id,'',0,2);
|
||||
if(!$give_gift){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '送礼失败,请重试!!', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
// if($gift_box){
|
||||
// foreach ($gift_box as $i => $v){
|
||||
// //记录一下收礼记录
|
||||
// $give_gift = $this -> change_user_give_gift_logs($uid,$v['gift_id'],$v['gift_price'],1,$to_uid,2,$type,$room_id,'',0,2);
|
||||
// if(!$give_gift){
|
||||
// Db::rollback();
|
||||
// return ['code' => 0, 'msg' => '送礼失败,请重试!!', 'data' => null];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$give_gift = $this -> change_user_give_gift_logs($uid,$gid,$receive_gift_total,$num,$to_uid,2,$type,$room_id,$gift_box_str,0,2);
|
||||
}else{
|
||||
//收礼记录行为日志
|
||||
$give_gift = $this -> change_user_give_gift_logs($uid,$gid,$gift_price,$num,$to_uid,2,$type,$room_id,'');
|
||||
@@ -446,7 +450,7 @@ class SendGift extends Model
|
||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||
$room_owner_ratio = get_system_config_value('room_author_ratio');
|
||||
$app_ratio = 100 - $receive_ratio - $room_owner_ratio - $guid_ratio;
|
||||
$app_earning = coin_earning($gift_price, $app_ratio);
|
||||
$app_earning = coin_earning($receive_gift_total, $app_ratio);
|
||||
|
||||
$gift_rate = $this->change_give_gift_profit($give_gift, $receive_ratio, $receiver_earnings, $room_owner_ratio, $room_owner_earnings, $app_ratio, $app_earning,$guid_ratio,$guild_earnings);
|
||||
if(!$gift_rate){
|
||||
@@ -761,6 +765,7 @@ class SendGift extends Model
|
||||
$ToUserInfos = [];//酒吧房被撩用户集合
|
||||
|
||||
foreach ($to_array as $k => $to_uid){
|
||||
$gift_box_str = '';
|
||||
$gift_user_data[]['user_id'] = $to_uid;
|
||||
$receive_gift_total = 0;//收礼人收到的礼物总值
|
||||
$gift_box = [];//开出的盲盒
|
||||
@@ -796,9 +801,12 @@ class SendGift extends Model
|
||||
$gift_box[$i] = $gift_box1[$i]['data'];
|
||||
//开出的礼物价值
|
||||
$receive_gift_total += $gift_box[$i]['gift_price'];
|
||||
|
||||
//礼物整合
|
||||
$gift_box_str .= $gift_box[$i]['gift_name'] . 'x' . $gift_box[$i]['num'].'/';
|
||||
Log::record("送礼开出盲盒礼物信息:".json_encode($gift_box1),"info");
|
||||
}
|
||||
//去掉最后一个/
|
||||
$gift_box_str = substr($gift_box_str,0,strlen($gift_box_str)-1);
|
||||
}else{
|
||||
$receive_gift_total = $gift_price;
|
||||
}
|
||||
@@ -897,16 +905,17 @@ class SendGift extends Model
|
||||
}
|
||||
|
||||
if($gift_info['label'] == 2) {//趣味礼物(盲盒)
|
||||
if($gift_box){
|
||||
foreach ($gift_box as $i => $v){
|
||||
//记录一下收礼记录
|
||||
$give_gift = $this -> change_user_give_gift_logs($uid,$v['gift_id'],$v['gift_price'],1,$to_uid,2,$type,$room_id,'',0,2);
|
||||
if(!$give_gift){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '送礼失败,请重试!!', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
// if($gift_box){
|
||||
// foreach ($gift_box as $i => $v){
|
||||
// //记录一下收礼记录
|
||||
// $give_gift = $this -> change_user_give_gift_logs($uid,$v['gift_id'],$v['gift_price'],1,$to_uid,2,$type,$room_id,'',0,2);
|
||||
// if(!$give_gift){
|
||||
// Db::rollback();
|
||||
// return ['code' => 0, 'msg' => '送礼失败,请重试!!', 'data' => null];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$give_gift = $this -> change_user_give_gift_logs($uid,$gid,$receive_gift_total,$num,$to_uid,2,$type,$room_id,$gift_box_str,0,2);
|
||||
}else{
|
||||
//收礼记录行为日志
|
||||
$give_gift = $this -> change_user_give_gift_logs($uid,$gid,$gift_price,$num,$to_uid,2,$type,$room_id,'');
|
||||
@@ -920,7 +929,7 @@ class SendGift extends Model
|
||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||
$room_owner_ratio = get_system_config_value('room_author_ratio');
|
||||
$app_ratio = 100 - $receive_ratio - $room_owner_ratio - $guid_ratio;
|
||||
$app_earning = coin_earning($gift_price, $app_ratio);
|
||||
$app_earning = coin_earning($receive_gift_total, $app_ratio);
|
||||
|
||||
$gift_rate = $this->change_give_gift_profit($give_gift, $receive_ratio, $receiver_earnings, $room_owner_ratio, $room_owner_earnings, $app_ratio, $app_earning,$guid_ratio,$guild_earnings);
|
||||
if(!$gift_rate){
|
||||
|
||||
Reference in New Issue
Block a user