12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use DB;
- use App\OrderGoodsSkus;
- use App\GoodsSkus;
- use App\Order;
- class SyncSkuToRedis extends Command {
- protected $signature = 'SyncSkuToRedis';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '同步订单到卖家云';
- public function handle()
- {
- $this->SyncSkuToRedis();
-
- }
- public function SyncSkuToRedis(){
- $order_ids = Order::where('warehouse', 3)->where('is_del', 0)->whereNull('orderCode')->lists('id');
- $res = OrderGoodsSkus::select(DB::raw('sum(num) as num , sku_id'))->whereIn('order_id', $order_ids)->where('mj_status', 0)->where('is_del', 0)->groupBy('sku_id')->get();
- $res = json_decode(json_encode($res), true);
- Order::diffSkuToRedis('', $res);
- }
- }
|