report union

main
fly 2025-12-14 14:00:46 +08:00
parent 56cb94b5b3
commit e1016aefea
5 changed files with 7 additions and 7 deletions

View File

@ -42,7 +42,7 @@ class ReportShopOrderController extends AdminController
$orders = Order::select([
'shop_id',
DB::raw('SUM(IF(type = 3, union_money, money)) AS money')
DB::raw('SUM(IF(type = 3, IF(id=pid, money, 0), money)) AS money')
])
->where('pay_state', PayState::SUCCESS)
->whereIn('lottery_state', [LottState::WIN, LottState::LOSS, LottState::WAIT, LottState::SEND])

View File

@ -54,7 +54,7 @@ class GenerateDaySeller extends Command
public function report(Seller $seller, $cdate)
{
$chupiaoMoneyRow = Order::select([
DB::raw('sum(IF(type = 3, union_money, money)) as m')
DB::raw('sum(IF(type = 3, IF(id=pid, money, 0), money)) as m')
])
->usable()
->where('draft_date', $cdate)

View File

@ -62,7 +62,7 @@ class GenerateDayShop extends Command
public function report(Shop $shop, $cdate)
{
$chupiaoMoneyRow = Order::select([
DB::raw('sum(IF(type = 3, union_money, money)) as m')
DB::raw('sum(IF(type = 3, IF(id=pid, money, 0), money)) as m')
])
->usable()
->where('draft_date', $cdate)

View File

@ -1234,7 +1234,7 @@ class CustomerController extends BaseController
$orders = Order::select([
'customer_id',
DB::raw('SUM(IF(type = 3, union_money, money)) AS money')
DB::raw('SUM(IF(type = 3, IF(id=pid, money, 0), money)) AS money')
])->agentUsable()
->whereIn('customer_id',$customerIdList)
->where('pay_state', PayState::SUCCESS)

View File

@ -253,7 +253,7 @@ class ReportController extends BaseController
}
$query = Order::select([
DB::raw('sum(IF(type = 3, union_money, money)) as money'),
DB::raw('sum(IF(type = 3, IF(id=pid, money, 0), money)) as money'),
DB::raw('count(*) as count'),
'lottery_type_id',
])
@ -747,7 +747,7 @@ class ReportController extends BaseController
'created_at',
'updated_at',
'created_date',
DB::raw('IF(type = 3, union_money, money) AS money')
DB::raw('IF(type = 3, IF(id=pid, money, 0), money) AS money')
])
->agentUsable()
->where('shop_id', $this->shopId())
@ -758,7 +758,7 @@ class ReportController extends BaseController
->paging($size);
$allMoneyData = Order::select(
DB::raw('SUM(IF(type = 3, union_money, money)) AS money')
DB::raw('SUM(IF(type = 3, IF(id=pid, money, 0), money)) AS money')
)
->agentUsable()
->where('shop_id', $this->shopId())