|
@@ -12,6 +12,7 @@ use App\Filters\RechargeOrderFilter;
|
|
use App\Filters\UserFilter;
|
|
use App\Filters\UserFilter;
|
|
use App\Filters\WalletLogFilter;
|
|
use App\Filters\WalletLogFilter;
|
|
use App\Filters\WorkOrderFilter;
|
|
use App\Filters\WorkOrderFilter;
|
|
|
|
+use App\Models\AdminMerchant;
|
|
use App\Models\AdminUser;
|
|
use App\Models\AdminUser;
|
|
use App\Models\Bike;
|
|
use App\Models\Bike;
|
|
use App\Models\CardRidingOrder;
|
|
use App\Models\CardRidingOrder;
|
|
@@ -47,18 +48,21 @@ class AggregateStatisticsController extends AppBaseController
|
|
$area_ids = self::$areaIds;
|
|
$area_ids = self::$areaIds;
|
|
// 总用户
|
|
// 总用户
|
|
$totalUser = User::query()
|
|
$totalUser = User::query()
|
|
|
|
+ ->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->count('id');
|
|
->count('id');
|
|
|
|
|
|
// 押金用户
|
|
// 押金用户
|
|
$depositUser = User::query()
|
|
$depositUser = User::query()
|
|
|
|
+ ->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->where('is_deposit', User::DEPOSIT_OK)
|
|
->where('is_deposit', User::DEPOSIT_OK)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->count('id');
|
|
->count('id');
|
|
//有效用户
|
|
//有效用户
|
|
$cardUser = User::query()
|
|
$cardUser = User::query()
|
|
|
|
+ ->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
@@ -66,6 +70,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
|
|
|
|
//今日新增
|
|
//今日新增
|
|
$todayAddUser = User::query()
|
|
$todayAddUser = User::query()
|
|
|
|
+ ->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('created_at', '>', Carbon::today())
|
|
@@ -74,6 +79,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
|
|
|
|
// 今日活跃
|
|
// 今日活跃
|
|
$todayActiveOrder = Order::query()
|
|
$todayActiveOrder = Order::query()
|
|
|
|
+ ->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('created_at', '>', Carbon::today())
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
@@ -108,48 +114,48 @@ class AggregateStatisticsController extends AppBaseController
|
|
$data = [];
|
|
$data = [];
|
|
$area_ids = self::$areaIds;
|
|
$area_ids = self::$areaIds;
|
|
// 总车辆数
|
|
// 总车辆数
|
|
- $data['total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->count('id');
|
|
->count('id');
|
|
// 上线车辆数
|
|
// 上线车辆数
|
|
- $data['put_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['put_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('put_status', Bike::PUT_STATUS_YES)
|
|
->where('put_status', Bike::PUT_STATUS_YES)
|
|
->count('id');
|
|
->count('id');
|
|
// 在线车辆数
|
|
// 在线车辆数
|
|
- $data['line_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['line_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('is_link', Bike::LINK_ONLINE)
|
|
->where('is_link', Bike::LINK_ONLINE)
|
|
->count('id');
|
|
->count('id');
|
|
//故障车辆
|
|
//故障车辆
|
|
- $data['trouble_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['trouble_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('is_trouble', Bike::TROUBLE_YES)
|
|
->where('is_trouble', Bike::TROUBLE_YES)
|
|
->count('id');
|
|
->count('id');
|
|
//今日使用
|
|
//今日使用
|
|
- $data['today_use_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['today_use_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('last_use_bike_end_time', '>', Carbon::today())
|
|
->where('last_use_bike_end_time', '>', Carbon::today())
|
|
->count('id');
|
|
->count('id');
|
|
//低电量
|
|
//低电量
|
|
- $data['low_battery_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['low_battery_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('is_low_battery_power', Bike::BATTERY_POWER_LOW)
|
|
->where('is_low_battery_power', Bike::BATTERY_POWER_LOW)
|
|
->count('id');
|
|
->count('id');
|
|
//骑行中
|
|
//骑行中
|
|
- $data['riding_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['riding_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('is_riding', Bike::RIDING_YES)
|
|
->where('is_riding', Bike::RIDING_YES)
|
|
->count('id');
|
|
->count('id');
|
|
//未使用
|
|
//未使用
|
|
- $data['not_riding_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data['not_riding_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('is_riding', Bike::RIDING_NO)
|
|
->where('is_riding', Bike::RIDING_NO)
|
|
@@ -170,25 +176,25 @@ class AggregateStatisticsController extends AppBaseController
|
|
{
|
|
{
|
|
$area_ids = self::$areaIds;
|
|
$area_ids = self::$areaIds;
|
|
// 总订单数
|
|
// 总订单数
|
|
- $order_total = Order::query()
|
|
|
|
|
|
+ $order_total = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->count('id');
|
|
->count('id');
|
|
- $order_rent_total = OrderRent::query()
|
|
|
|
|
|
+ $order_rent_total = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->count('id');
|
|
->count('id');
|
|
$order_total += $order_rent_total;
|
|
$order_total += $order_rent_total;
|
|
// 今日新增订单数
|
|
// 今日新增订单数
|
|
- $today_add_order = Order::query()
|
|
|
|
|
|
+ $today_add_order = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->count('id');
|
|
->count('id');
|
|
- $today_add_order_rent = OrderRent::query()
|
|
|
|
|
|
+ $today_add_order_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
@@ -201,24 +207,24 @@ class AggregateStatisticsController extends AppBaseController
|
|
// Order::STATUS_CLOSE_BIKE, // 待支付
|
|
// Order::STATUS_CLOSE_BIKE, // 待支付
|
|
Order::STATUS_PAUSE_BIKE,
|
|
Order::STATUS_PAUSE_BIKE,
|
|
];
|
|
];
|
|
- $riding_order = Order::query()
|
|
|
|
|
|
+ $riding_order = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->whereIn('status', $riding_status)
|
|
->whereIn('status', $riding_status)
|
|
->count('id');
|
|
->count('id');
|
|
- $riding_order_rent = OrderRent::query()
|
|
|
|
|
|
+ $riding_order_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('status', OrderRent::STATUS_RENT_BIKE)
|
|
->where('status', OrderRent::STATUS_RENT_BIKE)
|
|
->count('id');
|
|
->count('id');
|
|
$riding_order += $riding_order_rent;
|
|
$riding_order += $riding_order_rent;
|
|
// 待支付
|
|
// 待支付
|
|
- $waiting_pay_order = Order::query()
|
|
|
|
|
|
+ $waiting_pay_order = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('status', Order::STATUS_CLOSE_BIKE)
|
|
->where('status', Order::STATUS_CLOSE_BIKE)
|
|
->count('id');
|
|
->count('id');
|
|
- $waiting_pay_rent = OrderRent::query()
|
|
|
|
|
|
+ $waiting_pay_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('status', OrderRent::STATUS_CLOSE_RENT_BIKE)
|
|
->where('status', OrderRent::STATUS_CLOSE_RENT_BIKE)
|
|
@@ -226,13 +232,13 @@ class AggregateStatisticsController extends AppBaseController
|
|
$waiting_pay_order += $waiting_pay_rent;
|
|
$waiting_pay_order += $waiting_pay_rent;
|
|
|
|
|
|
// 今日新增收入
|
|
// 今日新增收入
|
|
- $today_add_money = Order::query()
|
|
|
|
|
|
+ $today_add_money = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $today_add_money_rent = OrderRent::query()
|
|
|
|
|
|
+ $today_add_money_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
@@ -261,7 +267,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
public function workOrderStatistics(WorkOrderFilter $filter)
|
|
public function workOrderStatistics(WorkOrderFilter $filter)
|
|
{
|
|
{
|
|
$area_ids = self::$areaIds;
|
|
$area_ids = self::$areaIds;
|
|
- $type_num = WorkOrder::query()
|
|
|
|
|
|
+ $type_num = WorkOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->where('status', WorkOrder::STATUS_NO)
|
|
->where('status', WorkOrder::STATUS_NO)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
@@ -322,7 +328,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- $planned_num = WorkOrder::query()
|
|
|
|
|
|
+ $planned_num = WorkOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->groupBy('planned')
|
|
->groupBy('planned')
|
|
->select('planned', DB::raw('COUNT(id) as planned_num'))
|
|
->select('planned', DB::raw('COUNT(id) as planned_num'))
|
|
@@ -384,19 +390,19 @@ class AggregateStatisticsController extends AppBaseController
|
|
// ->filter($walletLogFilter)
|
|
// ->filter($walletLogFilter)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->sum('money');
|
|
// ->sum('money');
|
|
- $totalOrderProfit = Order::query()
|
|
|
|
|
|
+ $totalOrderProfit = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $totalOrderRentProfit = OrderRent::query()
|
|
|
|
|
|
+ $totalOrderRentProfit = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
$totalProfit = bcadd($totalOrderProfit, $totalOrderRentProfit, 0);
|
|
$totalProfit = bcadd($totalOrderProfit, $totalOrderRentProfit, 0);
|
|
// 总押金
|
|
// 总押金
|
|
- $depositTotal = DepositOrder::query()
|
|
|
|
|
|
+ $depositTotal = DepositOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
@@ -409,13 +415,13 @@ class AggregateStatisticsController extends AppBaseController
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->where('created_at', '>', Carbon::today())
|
|
// ->where('created_at', '>', Carbon::today())
|
|
// ->sum('money');
|
|
// ->sum('money');
|
|
- $todayOrderProfit = Order::query()
|
|
|
|
|
|
+ $todayOrderProfit = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $todayOrderRentProfit = OrderRent::query()
|
|
|
|
|
|
+ $todayOrderRentProfit = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
@@ -423,7 +429,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
$todayProfit = bcadd($todayOrderProfit, $todayOrderRentProfit, 0);
|
|
$todayProfit = bcadd($todayOrderProfit, $todayOrderRentProfit, 0);
|
|
// 今日新增押金
|
|
// 今日新增押金
|
|
- $depositToday = DepositOrder::query()
|
|
|
|
|
|
+ $depositToday = DepositOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
@@ -437,13 +443,13 @@ class AggregateStatisticsController extends AppBaseController
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->where('created_at', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
// ->where('created_at', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
// ->sum('money');
|
|
// ->sum('money');
|
|
- $monthOrderProfit = Order::query()
|
|
|
|
|
|
+ $monthOrderProfit = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('pay_time', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
->where('pay_time', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $monthOrderRentProfit = OrderRent::query()
|
|
|
|
|
|
+ $monthOrderRentProfit = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
@@ -451,39 +457,39 @@ class AggregateStatisticsController extends AppBaseController
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
$monthProfit = bcadd($monthOrderProfit, $monthOrderRentProfit, 0);
|
|
$monthProfit = bcadd($monthOrderProfit, $monthOrderRentProfit, 0);
|
|
// 骑行卡订单总收益
|
|
// 骑行卡订单总收益
|
|
- $riddingCardOrderTotalProfit = CardRidingOrder::query()
|
|
|
|
|
|
+ $riddingCardOrderTotalProfit = CardRidingOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($cardRidingOrderFilter)
|
|
->filter($cardRidingOrderFilter)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 骑行卡订单今日收益
|
|
// 骑行卡订单今日收益
|
|
- $riddingCardOrderTodayProfit = CardRidingOrder::query()
|
|
|
|
|
|
+ $riddingCardOrderTodayProfit = CardRidingOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($cardRidingOrderFilter)
|
|
->filter($cardRidingOrderFilter)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 充值总收益
|
|
// 充值总收益
|
|
- $rechargeOrderTotalProfit = RechargeOrder::query()
|
|
|
|
|
|
+ $rechargeOrderTotalProfit = RechargeOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($rechargeOrderFilter)
|
|
->filter($rechargeOrderFilter)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 充值今日收益
|
|
// 充值今日收益
|
|
- $rechargeOrderTodayProfit = RechargeOrder::query()
|
|
|
|
|
|
+ $rechargeOrderTodayProfit = RechargeOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($rechargeOrderFilter)
|
|
->filter($rechargeOrderFilter)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 免押金卡总收益
|
|
// 免押金卡总收益
|
|
- $depositCardTotalProfit = DepositCardOrder::query()
|
|
|
|
|
|
+ $depositCardTotalProfit = DepositCardOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($depositCardOrderFilter)
|
|
->filter($depositCardOrderFilter)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 免押金卡总收益
|
|
// 免押金卡总收益
|
|
- $depositCardTodayProfit = DepositCardOrder::query()
|
|
|
|
|
|
+ $depositCardTodayProfit = DepositCardOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($depositCardOrderFilter)
|
|
->filter($depositCardOrderFilter)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|
|
@@ -513,26 +519,26 @@ class AggregateStatisticsController extends AppBaseController
|
|
$area_ids = self::$areaIds;
|
|
$area_ids = self::$areaIds;
|
|
$area_id = $request->get('area_id');
|
|
$area_id = $request->get('area_id');
|
|
// 总用户
|
|
// 总用户
|
|
- $totalUser = User::query()
|
|
|
|
|
|
+ $totalUser = User::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->count('id');
|
|
->count('id');
|
|
|
|
|
|
// 押金用户
|
|
// 押金用户
|
|
- $depositUser = User::query()
|
|
|
|
|
|
+ $depositUser = User::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->where('is_deposit', User::DEPOSIT_OK)
|
|
->where('is_deposit', User::DEPOSIT_OK)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->count('id');
|
|
->count('id');
|
|
//有效用户
|
|
//有效用户
|
|
- $cardUser = User::query()
|
|
|
|
|
|
+ $cardUser = User::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->filter($filter)
|
|
->filter($filter)
|
|
->count('id');
|
|
->count('id');
|
|
|
|
|
|
//今日新增
|
|
//今日新增
|
|
- $todayAddUser = User::query()
|
|
|
|
|
|
+ $todayAddUser = User::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('register_area_id', $area_ids)
|
|
->whereIn('register_area_id', $area_ids)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->where('is_card_certified', User::CARD_OK)
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('created_at', '>', Carbon::today())
|
|
@@ -540,7 +546,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
->count('id');
|
|
->count('id');
|
|
|
|
|
|
// 今日活跃
|
|
// 今日活跃
|
|
- $todayActiveOrder = Order::query()
|
|
|
|
|
|
+ $todayActiveOrder = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('created_at', '>', Carbon::today())
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
@@ -559,73 +565,73 @@ class AggregateStatisticsController extends AppBaseController
|
|
'todayActiveUser' => $todayActiveUser ?? 0
|
|
'todayActiveUser' => $todayActiveUser ?? 0
|
|
];
|
|
];
|
|
|
|
|
|
- $data2['total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->count('id');
|
|
->count('id');
|
|
// 上线车辆数
|
|
// 上线车辆数
|
|
- $data2['put_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['put_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->where('put_status', Bike::PUT_STATUS_YES)
|
|
->where('put_status', Bike::PUT_STATUS_YES)
|
|
->count('id');
|
|
->count('id');
|
|
// 在线车辆数
|
|
// 在线车辆数
|
|
- $data2['line_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['line_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->where('is_link', Bike::LINK_ONLINE)
|
|
->where('is_link', Bike::LINK_ONLINE)
|
|
->count('id');
|
|
->count('id');
|
|
//故障车辆
|
|
//故障车辆
|
|
- $data2['trouble_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['trouble_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->where('is_trouble', Bike::TROUBLE_YES)
|
|
->where('is_trouble', Bike::TROUBLE_YES)
|
|
->count('id');
|
|
->count('id');
|
|
//今日使用
|
|
//今日使用
|
|
- $data2['today_use_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['today_use_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->where('last_use_bike_end_time', '>', Carbon::today())
|
|
->where('last_use_bike_end_time', '>', Carbon::today())
|
|
->count('id');
|
|
->count('id');
|
|
//低电量
|
|
//低电量
|
|
- $data2['low_battery_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['low_battery_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->where('is_low_battery_power', Bike::BATTERY_POWER_LOW)
|
|
->where('is_low_battery_power', Bike::BATTERY_POWER_LOW)
|
|
->count('id');
|
|
->count('id');
|
|
//骑行中
|
|
//骑行中
|
|
- $data2['riding_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['riding_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->where('is_riding', Bike::RIDING_YES)
|
|
->where('is_riding', Bike::RIDING_YES)
|
|
->count('id');
|
|
->count('id');
|
|
//未使用
|
|
//未使用
|
|
- $data2['not_riding_total_bikes'] = Bike::query()
|
|
|
|
|
|
+ $data2['not_riding_total_bikes'] = Bike::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('put_area_id', $area_ids)
|
|
->whereIn('put_area_id', $area_ids)
|
|
->filter($bikeFilter)
|
|
->filter($bikeFilter)
|
|
->where('is_riding', Bike::RIDING_NO)
|
|
->where('is_riding', Bike::RIDING_NO)
|
|
->count('id');
|
|
->count('id');
|
|
|
|
|
|
// 总订单数
|
|
// 总订单数
|
|
- $order_total = Order::query()
|
|
|
|
|
|
+ $order_total = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->count('id');
|
|
->count('id');
|
|
- $order_rent_total = OrderRent::query()
|
|
|
|
|
|
+ $order_rent_total = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->count('id');
|
|
->count('id');
|
|
$order_total += $order_rent_total;
|
|
$order_total += $order_rent_total;
|
|
// 今日新增订单数
|
|
// 今日新增订单数
|
|
- $today_add_order = Order::query()
|
|
|
|
|
|
+ $today_add_order = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('created_at', '>', Carbon::today())
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->count('id');
|
|
->count('id');
|
|
- $today_add_order_rent = OrderRent::query()
|
|
|
|
|
|
+ $today_add_order_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
@@ -638,24 +644,24 @@ class AggregateStatisticsController extends AppBaseController
|
|
// Order::STATUS_CLOSE_BIKE, // 待支付
|
|
// Order::STATUS_CLOSE_BIKE, // 待支付
|
|
Order::STATUS_PAUSE_BIKE,
|
|
Order::STATUS_PAUSE_BIKE,
|
|
];
|
|
];
|
|
- $riding_order = Order::query()
|
|
|
|
|
|
+ $riding_order = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->whereIn('status', $riding_status)
|
|
->whereIn('status', $riding_status)
|
|
->count('id');
|
|
->count('id');
|
|
- $riding_order_rent = OrderRent::query()
|
|
|
|
|
|
+ $riding_order_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('status', OrderRent::STATUS_RENT_BIKE)
|
|
->where('status', OrderRent::STATUS_RENT_BIKE)
|
|
->count('id');
|
|
->count('id');
|
|
$riding_order += $riding_order_rent;
|
|
$riding_order += $riding_order_rent;
|
|
// 待支付
|
|
// 待支付
|
|
- $waiting_pay_order = Order::query()
|
|
|
|
|
|
+ $waiting_pay_order = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_CLOSE_BIKE)
|
|
->where('status', Order::STATUS_CLOSE_BIKE)
|
|
->count('id');
|
|
->count('id');
|
|
- $waiting_pay_rent = OrderRent::query()
|
|
|
|
|
|
+ $waiting_pay_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('status', OrderRent::STATUS_CLOSE_RENT_BIKE)
|
|
->where('status', OrderRent::STATUS_CLOSE_RENT_BIKE)
|
|
@@ -663,13 +669,13 @@ class AggregateStatisticsController extends AppBaseController
|
|
$waiting_pay_order += $waiting_pay_rent;
|
|
$waiting_pay_order += $waiting_pay_rent;
|
|
|
|
|
|
// 今日新增收入
|
|
// 今日新增收入
|
|
- $today_add_money = Order::query()
|
|
|
|
|
|
+ $today_add_money = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $today_add_money_rent = OrderRent::query()
|
|
|
|
|
|
+ $today_add_money_rent = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
@@ -685,7 +691,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
'waiting_pay' => $waiting_pay_order ?? 0,
|
|
'waiting_pay' => $waiting_pay_order ?? 0,
|
|
];
|
|
];
|
|
|
|
|
|
- $type_num = WorkOrder::query()
|
|
|
|
|
|
+ $type_num = WorkOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->where('status', WorkOrder::STATUS_NO)
|
|
->where('status', WorkOrder::STATUS_NO)
|
|
->filter($workOrderFilter)
|
|
->filter($workOrderFilter)
|
|
@@ -746,7 +752,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- $planned_num = WorkOrder::query()
|
|
|
|
|
|
+ $planned_num = WorkOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->filter($workOrderFilter)
|
|
->filter($workOrderFilter)
|
|
->groupBy('planned')
|
|
->groupBy('planned')
|
|
->select('planned', DB::raw('COUNT(id) as planned_num'))
|
|
->select('planned', DB::raw('COUNT(id) as planned_num'))
|
|
@@ -790,19 +796,19 @@ class AggregateStatisticsController extends AppBaseController
|
|
// ->filter($walletLogFilter)
|
|
// ->filter($walletLogFilter)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->sum('money');
|
|
// ->sum('money');
|
|
- $totalOrderProfit = Order::query()
|
|
|
|
|
|
+ $totalOrderProfit = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $totalOrderRentProfit = OrderRent::query()
|
|
|
|
|
|
+ $totalOrderRentProfit = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
$totalProfit = bcadd($totalOrderProfit, $totalOrderRentProfit, 0);
|
|
$totalProfit = bcadd($totalOrderProfit, $totalOrderRentProfit, 0);
|
|
// 总押金
|
|
// 总押金
|
|
- $depositTotal = DepositOrder::query()
|
|
|
|
|
|
+ $depositTotal = DepositOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
@@ -815,13 +821,13 @@ class AggregateStatisticsController extends AppBaseController
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->where('created_at', '>', Carbon::today())
|
|
// ->where('created_at', '>', Carbon::today())
|
|
// ->sum('money');
|
|
// ->sum('money');
|
|
- $todayOrderProfit = Order::query()
|
|
|
|
|
|
+ $todayOrderProfit = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $todayOrderRentProfit = OrderRent::query()
|
|
|
|
|
|
+ $todayOrderRentProfit = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
@@ -829,7 +835,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
$todayProfit = bcadd($todayOrderProfit, $todayOrderRentProfit, 0);
|
|
$todayProfit = bcadd($todayOrderProfit, $todayOrderRentProfit, 0);
|
|
// 今日新增押金
|
|
// 今日新增押金
|
|
- $depositToday = DepositOrder::query()
|
|
|
|
|
|
+ $depositToday = DepositOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositOrder::PAY_STATUS_OK)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->where('is_refund', DepositOrder::REFUND_NO)
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
@@ -843,13 +849,13 @@ class AggregateStatisticsController extends AppBaseController
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->whereIn('type', WalletLog::$subType)
|
|
// ->where('created_at', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
// ->where('created_at', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
// ->sum('money');
|
|
// ->sum('money');
|
|
- $monthOrderProfit = Order::query()
|
|
|
|
|
|
+ $monthOrderProfit = Order::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderFilter)
|
|
->filter($orderFilter)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('status', Order::STATUS_COMPLETE_ORDER)
|
|
->where('created_at', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
->where('created_at', '>', Carbon::today()->format('Y-m-01 00:00:00'))
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
- $monthOrderRentProfit = OrderRent::query()
|
|
|
|
|
|
+ $monthOrderRentProfit = OrderRent::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($orderRentFilter)
|
|
->filter($orderRentFilter)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
->where('status', OrderRent::STATUS_COMPLETE_ORDER)
|
|
@@ -857,13 +863,13 @@ class AggregateStatisticsController extends AppBaseController
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
$monthProfit = bcadd($monthOrderProfit, $monthOrderRentProfit, 0);
|
|
$monthProfit = bcadd($monthOrderProfit, $monthOrderRentProfit, 0);
|
|
// 骑行卡订单总收益
|
|
// 骑行卡订单总收益
|
|
- $riddingCardOrderTotalProfit = CardRidingOrder::query()
|
|
|
|
|
|
+ $riddingCardOrderTotalProfit = CardRidingOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($cardRidingOrderFilter)
|
|
->filter($cardRidingOrderFilter)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 骑行卡订单今日收益
|
|
// 骑行卡订单今日收益
|
|
- $riddingCardOrderTodayProfit = CardRidingOrder::query()
|
|
|
|
|
|
+ $riddingCardOrderTodayProfit = CardRidingOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($cardRidingOrderFilter)
|
|
->filter($cardRidingOrderFilter)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
->where('pay_status', CardRidingOrder::PAY_STATUS_OK)
|
|
@@ -871,7 +877,7 @@ class AggregateStatisticsController extends AppBaseController
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 充值总收益
|
|
// 充值总收益
|
|
// DB::enableQueryLog();
|
|
// DB::enableQueryLog();
|
|
- $rechargeOrderTotalProfit = RechargeOrder::query()
|
|
|
|
|
|
+ $rechargeOrderTotalProfit = RechargeOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->filter($rechargeOrderFilter)
|
|
->filter($rechargeOrderFilter)
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
@@ -879,20 +885,20 @@ class AggregateStatisticsController extends AppBaseController
|
|
// $logs = DB::getQueryLog();
|
|
// $logs = DB::getQueryLog();
|
|
// Log::info($logs);
|
|
// Log::info($logs);
|
|
// 充值今日收益
|
|
// 充值今日收益
|
|
- $rechargeOrderTodayProfit = RechargeOrder::query()
|
|
|
|
|
|
+ $rechargeOrderTodayProfit = RechargeOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($rechargeOrderFilter)
|
|
->filter($rechargeOrderFilter)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
->where('pay_status', RechargeOrder::PAY_STATUS_OK)
|
|
->where('pay_time', '>', Carbon::today())
|
|
->where('pay_time', '>', Carbon::today())
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 免押金卡总收益
|
|
// 免押金卡总收益
|
|
- $depositCardTotalProfit = DepositCardOrder::query()
|
|
|
|
|
|
+ $depositCardTotalProfit = DepositCardOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($depositCardOrderFilter)
|
|
->filter($depositCardOrderFilter)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|
|
->sum('pay_money');
|
|
->sum('pay_money');
|
|
// 免押金卡总收益
|
|
// 免押金卡总收益
|
|
- $depositCardTodayProfit = DepositCardOrder::query()
|
|
|
|
|
|
+ $depositCardTodayProfit = DepositCardOrder::query()->where(AdminMerchant::getMerchantWhere())
|
|
->whereIn('area_id', $area_ids)
|
|
->whereIn('area_id', $area_ids)
|
|
->filter($depositCardOrderFilter)
|
|
->filter($depositCardOrderFilter)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|
|
->where('pay_status', DepositCardOrder::PAY_STATUS_OK)
|