房间流水展示

This commit is contained in:
2026-01-16 17:10:05 +08:00
parent e29f4bd4df
commit 8922fa93f3
3 changed files with 6 additions and 8 deletions

View File

@@ -165,7 +165,9 @@ class Ranking extends Model
$myRoom = db::name('vs_room')->where(['user_id' => UID ,'room_status' => 1])->find();
if($myRoom){
$my_ranking['rank'] = -1;
$my_ranking['total'] = 0;
$totla = db::name('room_daily_income')
->where(['room_id' => $myRoom['id'],'date' => ['between', [$begin_time, $end_time]]])->sum('income')??0 ;
$my_ranking['total'] = $totla * $ratio;
$my_ranking['diff'] = 0;
$my_ranking['room_name'] = $myRoom['room_name'];
$my_ranking['room_cover'] = $myRoom['room_cover'];

View File

@@ -330,7 +330,7 @@ class Room extends Model
//今日流水
//金币与魅力比例
$ratio = get_system_config_value('coin_charm_exp');
$v['today_profit'] = db::name('room_daily_income')->where('room_id', $v['room_id'])->value('income')?? 0 * $ratio;
$v['today_profit'] = model('api/RoomDailyIncome')->getTodayIncome($v['room_id']) * $ratio;
}
//关注数
$v['follow_num'] = db::name('user_follow')->where('follow_id', $v['room_id'])->where('type', 2)->count();

View File

@@ -10,13 +10,9 @@ class RoomDailyIncome extends Model
protected $name = 'room_daily_income';
// 开启自动时间戳TP5.1默认用时间戳格式对应create_time/update_time
protected $autoWriteTimestamp = true;
// protected $autoWriteTimestamp = true;
// 定义字段类型转换(确保金额为浮点型)
protected $type = [
'income' => 'float',
'user_id' => 'integer',
];
/**
* 累加用户当日收益(核心方法)