主持人受益,
This commit is contained in:
@@ -245,14 +245,14 @@ class GiveGift extends Model
|
|||||||
}else{
|
}else{
|
||||||
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
|
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
|
||||||
//计算房主收益//room_author_ratio
|
//计算房主收益//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){
|
if($room_owner_earnings > 0){
|
||||||
//主持人收益
|
//主持人收益
|
||||||
//在主持位的主持人
|
//在主持位的主持人
|
||||||
$host_id = Db::name('vs_room_pit')->where(['room_id'=>$from_id,'pit_number'=>9])->value('user_id');
|
$host_id = Db::name('vs_room_pit')->where(['room_id'=>$from_id,'pit_number'=>9])->value('user_id');
|
||||||
if($host_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){
|
if($host_earnings > 0){
|
||||||
//增加主持人收益并记录日志
|
//增加主持人收益并记录日志
|
||||||
$host_earnings_earning = $this -> change_user_cion_or_earnings_log($host_id,$host_earnings,$from_id,2,19,'主持人收益');
|
$host_earnings_earning = $this -> change_user_cion_or_earnings_log($host_id,$host_earnings,$from_id,2,19,'主持人收益');
|
||||||
|
|||||||
@@ -313,8 +313,15 @@ class Room extends Model
|
|||||||
$v['is_use_code'] = 1;
|
$v['is_use_code'] = 1;
|
||||||
$v['room_number'] = $liang;
|
$v['room_number'] = $liang;
|
||||||
}
|
}
|
||||||
//今日收益
|
if($type == 1) {//1-我主持的
|
||||||
$v['today_profit'] = $this->get_room_today_profit($v['room_id']) * 10;
|
//今日收益
|
||||||
|
$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();
|
$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;
|
return $cp_room;
|
||||||
}
|
}
|
||||||
|
|
||||||
//房间今日收益
|
//房间今日流水
|
||||||
public function get_room_today_profit($room_id)
|
public function get_room_today_profit($room_id)
|
||||||
{
|
{
|
||||||
$room_type = db::name('vs_room')->where('id', $room_id)->value('type_id');
|
$room_type = db::name('vs_room')->where('id', $room_id)->value('type_id');
|
||||||
@@ -389,6 +396,18 @@ class Room extends Model
|
|||||||
return $profit;
|
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){
|
public function room_ubsidy($room_id){
|
||||||
$room_type = db::name('vs_room')->where('id', $room_id)->value('type_id');
|
$room_type = db::name('vs_room')->where('id', $room_id)->value('type_id');
|
||||||
|
|||||||
Reference in New Issue
Block a user