房间流水统计
This commit is contained in:
@@ -497,6 +497,7 @@ class Room extends Model
|
|||||||
//如果没有传参数默认查询本月
|
//如果没有传参数默认查询本月
|
||||||
$stime = empty($stime) ? date('Y-m-01') : $stime;
|
$stime = empty($stime) ? date('Y-m-01') : $stime;
|
||||||
$etime = empty($etime) ? date('Y-m-d') : $etime;
|
$etime = empty($etime) ? date('Y-m-d') : $etime;
|
||||||
|
$end_time = empty($etime) ? time() : $etime;
|
||||||
|
|
||||||
$total_amount = 0;//房间总流水
|
$total_amount = 0;//房间总流水
|
||||||
$list_data_array=[];
|
$list_data_array=[];
|
||||||
@@ -560,7 +561,7 @@ class Room extends Model
|
|||||||
}else{
|
}else{
|
||||||
$total_earning = db::name('user_earnings_log')
|
$total_earning = db::name('user_earnings_log')
|
||||||
->where(['user_id' => $userId,'room_id' => $room_id,'change_type' => 19])
|
->where(['user_id' => $userId,'room_id' => $room_id,'change_type' => 19])
|
||||||
->where('createtime', 'between', [strtotime($stime), strtotime($etime.' 23:59:59')])
|
->where('createtime', 'between', [strtotime($stime), $end_time])
|
||||||
->sum('earnings');
|
->sum('earnings');
|
||||||
}
|
}
|
||||||
return ['code' => 1, 'msg' => '成功', 'data' => ['total_amount' => $total_amount, 'total_earning' => $total_earning,'list' => $list_data_array]];
|
return ['code' => 1, 'msg' => '成功', 'data' => ['total_amount' => $total_amount, 'total_earning' => $total_earning,'list' => $list_data_array]];
|
||||||
|
|||||||
Reference in New Issue
Block a user