房主收益计算

This commit is contained in:
2025-10-09 10:26:49 +08:00
parent 255841e3dc
commit 7b93166495

View File

@@ -128,4 +128,29 @@ class Test
} }
} }
public function RoomOwners()
{
$room = Db::name('vs_room')->where(['room_status' => 1,'apply_status' => 2])->select();
$arr = [];
foreach ($room as $key => $value) {
$liushui = Db::name('vs_give_gift')->where(['from_id' => $value['id'],'from' => 2])->sum('total_price');
$usercode = Db::name('user')->where(['id' => $value['user_id']])->value('user_code');
$nickname = Db::name('user')->where(['id' => $value['user_id']])->value('nickname');
$arr[] = [
'room_id' => $value['id'],
'user_id' => $value['user_id'],
'user_code' => $usercode,
'nickname' => $nickname,
'liushui' => $liushui
];
}
//房主的收益
foreach ($arr as $key => $v){
$shouyi = db::name('vs_user_money_log')->where(['user_id' => $v['user_id'],'change_type' => 18,'money_type' =>2,'createtime'=>['<',1759585380]])->sum('change_value');
$arr[$key]['shouyi'] = $shouyi;
}
var_dump($arr);
}
} }