存活数
This commit is contained in:
parent
3fc93b725b
commit
eb37b84f46
@ -184,9 +184,15 @@ class PropertyService extends Service
|
||||
return $item->company_id . '_' . $item->package_id;
|
||||
})->toArray();
|
||||
|
||||
|
||||
$actives = app(OrderCardPartitionRepository::class)->selectRaw('company_id, package_id, count(*) as counts')
|
||||
->withConditions(['type' => 0, 'card_status' => 2])->groupBy(['company_id', 'package_id'])->get()->keyBy(function ($item) {
|
||||
return $item->company_id . '_' . $item->package_id;
|
||||
})->toArray();
|
||||
|
||||
$carrierOperators = app(Dicts::class)->get('carrier_operator');
|
||||
|
||||
$list = $product->map(function ($item) use ($properties, $sells, $carrierOperators) {
|
||||
$list = $product->map(function ($item) use ($properties, $sells, $actives, $carrierOperators) {
|
||||
$item = $item->toArray();
|
||||
$package = PackageService::load($item['package_id']);
|
||||
$item['company_name'] = CompanyService::load($item['company_id'])['name'] ?? '';
|
||||
@ -196,7 +202,9 @@ class PropertyService extends Service
|
||||
$item['carrier_operator_name'] = $carrierOperators[$item['carrier_operator']] ?? '未知';
|
||||
$property = $properties[$item['company_id'] . '_' . $item['package_id']];
|
||||
$sell = $sells[$item['company_id'] . '_' . $item['package_id']];
|
||||
$active = $actives[$item['company_id'] . '_' . $item['package_id']];
|
||||
$item['counts'] = $sell ? $sell['counts'] : 0;
|
||||
$item['actives'] = $active ? $active['counts'] : 0;
|
||||
return array_merge($item, $property ?: self::$default);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user