created_at

This commit is contained in:
邓皓元 2019-03-15 20:30:52 +08:00
parent 9a767f2cff
commit 354a84e6bb
2 changed files with 4 additions and 3 deletions

View File

@ -87,8 +87,8 @@ class AddedOrderSync extends Command
$endtime = $this->datetime->copy()->endOfMonth()->endOfDay();
$orders = DB::table($virtualTable)->selectRaw('sim,MAX(order_id)')
->where('create_time', '>=', $starttime->timestamp)
->where('create_time', '<=', $endtime->timestamp)
->where('created_at', '>=', $starttime)
->where('created_at', '<=', $endtime)
->whereIn('sim', array_pluck($data, 'sim'))
->groupBy('sim')->get()->pluck('order_id', 'sim');

View File

@ -46,7 +46,8 @@ class OrderBaseSync extends Command
$this->line('插入订单关联数据,条数:'.count($cards));
foreach (array_chunk($cards, $this->chunks) as $data) {
$this->getOutput()->write('.');
$orders = DB::table('virtual_order_cards')->select(['sim', 'order_id'])->whereIn('sim', array_pluck($data, 'sim'))->get()->pluck('order_id', 'sim');
$orders = DB::table('virtual_order_cards')->select(['sim', 'order_id'])
->whereIn('sim', array_pluck($data, 'sim'))->get()->pluck('order_id', 'sim');
foreach ($data as &$value) {
$value['virtual_order_id'] = $orders[$value['sim']] ?? 0;