修改收益计算比例

This commit is contained in:
2025-11-07 17:24:56 +08:00
parent e3b12879f9
commit cbcaa266ce

View File

@@ -7,7 +7,12 @@ use think\Model;
use think\facade\Cache; use think\facade\Cache;
class Gift extends Model class Gift extends Model
{ {
//厅主收益
public $room_owner_rate; public $room_owner_rate;
//用户实时收益
public $user_rate;
//加入工会用户实时收益
public $guild_user_rate;
public function __construct($data = []) public function __construct($data = [])
{ {
parent::__construct($data); parent::__construct($data);
@@ -21,6 +26,8 @@ class Gift extends Model
// $rate = 0.2; // $rate = 0.2;
$rate = 0.1; $rate = 0.1;
$this->room_owner_rate = $rate; $this->room_owner_rate = $rate;
$this->user_rate = 0.6;
$this->guild_user_rate = 0.63;
} }
@@ -94,7 +101,7 @@ class Gift extends Model
$total_send_amount = $gift_info['gift_price'] * $num * $send_count; //赠送礼物总价值 $total_send_amount = $gift_info['gift_price'] * $num * $send_count; //赠送礼物总价值
$config = get_uncache_system_config(); $config = get_uncache_system_config();
if($config['gift_earnings_rate'] > 1){ if($config['gift_earnings_rate'] > 1){
$config['gift_earnings_rate'] = 0.6; $config['gift_earnings_rate'] = $this->user_rate;
} }
$now_time = time(); $now_time = time();
$user_info = db::name('user')->where('uid', $uid)->find(); $user_info = db::name('user')->where('uid', $uid)->find();
@@ -313,9 +320,9 @@ class Gift extends Model
if(!empty($user_guild_id)){ if(!empty($user_guild_id)){
$receiver_profit = $gift_total_price * 0.6; $receiver_profit = $gift_total_price * $this->user_rate;
}else{ }else{
$receiver_profit = $gift_total_price * 0.57; $receiver_profit = $gift_total_price * $this->guild_user_rate;
} }
@@ -738,7 +745,7 @@ class Gift extends Model
$room_guild_id = model('guild')->user_guild_info($room_info['room_owner_uid']); $room_guild_id = model('guild')->user_guild_info($room_info['room_owner_uid']);
$config = get_uncache_system_config(); $config = get_uncache_system_config();
if($config['gift_earnings_rate'] > 1){ if($config['gift_earnings_rate'] > 1){
$config['gift_earnings_rate'] = 0.6; $config['gift_earnings_rate'] = $this->user_rate;
} }
$now_time = time(); $now_time = time();
//当前主持比例 //当前主持比例
@@ -826,9 +833,9 @@ class Gift extends Model
// $this_receiver_profit = $this_gift_total_price * 0.6;//接收人收益 // $this_receiver_profit = $this_gift_total_price * 0.6;//接收人收益
if(!empty($user_guild_id)){ if(!empty($user_guild_id)){
$this_receiver_profit = $this_gift_total_price * 0.6; $this_receiver_profit = $this_gift_total_price * $this->user_rate;
}else{ }else{
$this_receiver_profit = $this_gift_total_price * 0.57; $this_receiver_profit = $this_gift_total_price * $this->guild_user_rate;
} }
@@ -1038,7 +1045,7 @@ class Gift extends Model
$this_room_owner_profit = $this_room_owner_profits * (1 - $room_host_commission); $this_room_owner_profit = $this_room_owner_profits * (1 - $room_host_commission);
$this_room_host_profit = $this_room_owner_profits * $room_host_commission; $this_room_host_profit = $this_room_owner_profits * $room_host_commission;
// $this_receiver_profit = $this_gift_total_price * $config['gift_earnings_rate'];//接收人收益 // $this_receiver_profit = $this_gift_total_price * $config['gift_earnings_rate'];//接收人收益
$this_receiver_profit = $this_gift_total_price * 0.6;//接收人收益 $this_receiver_profit = $this_gift_total_price * $this->user_rate;//接收人收益
$this_platform_profit = $this_gift_total_price - $this_room_owner_profits - $this_receiver_profit;//平台收益 $this_platform_profit = $this_gift_total_price - $this_room_owner_profits - $this_receiver_profit;//平台收益
$data = []; $data = [];
$data['uid'] = $uid; $data['uid'] = $uid;
@@ -1246,7 +1253,7 @@ class Gift extends Model
} }
$config = get_uncache_system_config(); $config = get_uncache_system_config();
if($config['gift_earnings_rate'] > 1){ if($config['gift_earnings_rate'] > 1){
$config['gift_earnings_rate'] = 0.6; $config['gift_earnings_rate'] = $this->user_rate;
} }
$map = []; $map = [];
$map['rid'] = $rid; $map['rid'] = $rid;
@@ -1874,9 +1881,9 @@ class Gift extends Model
// $this_receiver_profit = $this_gift_total_price * 0.6;//接收人收益 // $this_receiver_profit = $this_gift_total_price * 0.6;//接收人收益
if(!empty($user_guild_id)){ if(!empty($user_guild_id)){
$this_receiver_profit = $this_gift_total_price * 0.6;//接收人收益 $this_receiver_profit = $this_gift_total_price * $this->user_rate;//接收人收益
}else{ }else{
$this_receiver_profit = $this_gift_total_price * 0.57;//接收人收益 $this_receiver_profit = $this_gift_total_price * $this->guild_user_rate;//接收人收益
} }
$this_platform_profit = $this_gift_total_price - $this_room_owner_profits - $this_receiver_profit - $this_producer_profit;//平台收益 $this_platform_profit = $this_gift_total_price - $this_room_owner_profits - $this_receiver_profit - $this_producer_profit;//平台收益