工会流水计算
This commit is contained in:
@@ -113,13 +113,21 @@ class Guild extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取所有工会房间ID
|
//获取所有工会房间ID
|
||||||
$room_ids = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id')->select();
|
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id,createtime,quit_time')->select();
|
||||||
$room_ids = array_column($room_ids, 'room_id');
|
$transaction = 0;
|
||||||
$transaction = db::name('vs_give_gift')
|
foreach ($guild_user_data as $k => $v) {
|
||||||
->whereIn('from_id',$room_ids)
|
if($v['createtime'] && $stoday < $v['createtime']){
|
||||||
->where(['from'=>['in',[2,3,6]]])
|
$stoday = $v['createtime'];
|
||||||
->where($where)
|
}
|
||||||
->sum('total_price');
|
if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
||||||
|
$etoday = $v['quit_time'];
|
||||||
|
}
|
||||||
|
$transaction_one = db::name('vs_give_gift')
|
||||||
|
->whereIn('from_id',$v['room_id'])
|
||||||
|
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday, $etoday]]])
|
||||||
|
->sum('total_price');
|
||||||
|
$transaction += $transaction_one;
|
||||||
|
}
|
||||||
return $transaction;
|
return $transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user