同步优化
This commit is contained in:
parent
4d26787631
commit
368d0d2567
@ -78,6 +78,8 @@ class AddedOrderSync extends Command
|
||||
|
||||
$this->line('插入订单关联数据,条数:'.count(array_collapse($dataOrderCards)));
|
||||
|
||||
$simArray = [];
|
||||
|
||||
foreach ($dataOrderCards as $type => $orderCards) {
|
||||
foreach (array_chunk($orderCards, $this->chunks) as $data) {
|
||||
$this->getOutput()->write('.');
|
||||
@ -95,10 +97,15 @@ class AddedOrderSync extends Command
|
||||
->where('created_at', '<=', $endtime->format('Y-m-d H:i:s'))
|
||||
->whereIn('sim', array_pluck($data, 'sim'))
|
||||
->whereNull('deleted_at')
|
||||
->get()->groupBy('sim');
|
||||
->orderBy('created_at')
|
||||
->get()
|
||||
->collect()
|
||||
->groupBy('sim')->toArray();
|
||||
|
||||
foreach ($data as &$value) {
|
||||
$value['virtual_order_id'] = $orders[$value['sim']] ?? 0;
|
||||
$i = array_count_values($simArray)[$value['sim']] ?? 0;
|
||||
array_push($simArray, $value['sim']);
|
||||
$value['virtual_order_id'] = $orders[$value['sim']][$i]['order_id'] ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user