主持人受益,

This commit is contained in:
2025-09-17 00:16:08 +08:00
parent 7097b08f28
commit e213070985
2 changed files with 24 additions and 5 deletions

View File

@@ -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');