From e213070985100dcfa202ba64a84a1d1c41f5ff42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 17 Sep 2025 00:16:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E6=8C=81=E4=BA=BA=E5=8F=97=E7=9B=8A?= =?UTF-8?q?=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/GiveGift.php | 4 ++-- application/api/model/Room.php | 25 ++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index 2c4e06a..2437c52 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -245,14 +245,14 @@ class GiveGift extends Model }else{ $room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id'); //计算房主收益//room_author_ratio - $room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,99); + $room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,99);//结果是钻石 if($room_owner_earnings > 0){ //主持人收益 //在主持位的主持人 $host_id = Db::name('vs_room_pit')->where(['room_id'=>$from_id,'pit_number'=>9])->value('user_id'); if($host_id){ //计算主持人收益 - $host_earnings = $this -> receiver_earnings($host_id,$room_owner_earnings,98,$from_id); + $host_earnings = $this -> receiver_earnings($host_id,$room_owner_earnings*get_system_config_value('rmb_coin_ratio'),98,$from_id); if($host_earnings > 0){ //增加主持人收益并记录日志 $host_earnings_earning = $this -> change_user_cion_or_earnings_log($host_id,$host_earnings,$from_id,2,19,'主持人收益'); diff --git a/application/api/model/Room.php b/application/api/model/Room.php index 939d175..27b3642 100644 --- a/application/api/model/Room.php +++ b/application/api/model/Room.php @@ -313,8 +313,15 @@ class Room extends Model $v['is_use_code'] = 1; $v['room_number'] = $liang; } - //今日收益 - $v['today_profit'] = $this->get_room_today_profit($v['room_id']) * 10; + if($type == 1) {//1-我主持的 + //今日收益 + $v['today_profit'] = $this->get_room_today_earnings($v['room_id'],$uid); + }else{ + //今日流水 + //金币与魅力比例 + $ratio = get_system_config_value('coin_charm_exp'); + $v['today_profit'] = $this->get_room_today_profit($v['room_id']) * $ratio; + } //关注数 $v['follow_num'] = db::name('user_follow')->where('follow_id', $v['room_id'])->where('type', 2)->count(); //访问数 @@ -374,7 +381,7 @@ class Room extends Model return $cp_room; } - //房间今日收益 + //房间今日流水 public function get_room_today_profit($room_id) { $room_type = db::name('vs_room')->where('id', $room_id)->value('type_id'); @@ -389,6 +396,18 @@ class Room extends Model return $profit; } + //房间今日主持收益 + public function get_room_today_earnings($room_id,$user_id) + { + $today_start_time = strtotime(date('Y-m-d')); + $today_end_time = $today_start_time + 86400; + return Db::name('vs_user_money_log') + ->where(['room_id' => $room_id,'user_id' => $user_id,'change_type' =>19]) + ->whereBetween('createtime', [$today_start_time, $today_end_time]) + ->sum('change_value'); + + } + //房间补贴 public function room_ubsidy($room_id){ $room_type = db::name('vs_room')->where('id', $room_id)->value('type_id');