|
@@ -0,0 +1,50 @@
|
|
1
|
+<?php
|
|
2
|
+namespace App\Console\Commands;
|
|
3
|
+
|
|
4
|
+use Illuminate\Console\Command;
|
|
5
|
+use Symfony\Component\Console\Input\InputOption;
|
|
6
|
+use Symfony\Component\Console\Input\InputArgument;
|
|
7
|
+use TopClient;
|
|
8
|
+use DB;
|
|
9
|
+use YPSMS;
|
|
10
|
+class SendOrder extends Command {
|
|
11
|
+
|
|
12
|
+ protected $signature = 'SendOrder';
|
|
13
|
+
|
|
14
|
+ /**
|
|
15
|
+ * The console command description.
|
|
16
|
+ *
|
|
17
|
+ * @var string
|
|
18
|
+ */
|
|
19
|
+ protected $description = '提醒仓管新订单短信';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+ public function handle()
|
|
23
|
+ {
|
|
24
|
+ $this->SendOrder();
|
|
25
|
+ }
|
|
26
|
+ public function SendOrder(){
|
|
27
|
+ #今日
|
|
28
|
+ $today = date('Y-m-d');
|
|
29
|
+ //A仓
|
|
30
|
+ $orders = DB::table('order')->where('delivery_date', $today)->where('warehouse', 1)->where(function($query) use($today){
|
|
31
|
+ $query->where('logistics_id','=','')->orWhere('logistics_id','is',null);
|
|
32
|
+ })->lists('id');
|
|
33
|
+ if(!empty($orders)){
|
|
34
|
+ $orders = json_decode(json_encode($orders), true);
|
|
35
|
+ $order_ids = implode(',',$orders);
|
|
36
|
+ $res = YPSMS::sendMsg('15695966629', 2, $order_ids, $today);
|
|
37
|
+ }
|
|
38
|
+
|
|
39
|
+ //B仓
|
|
40
|
+ $orders = DB::table('order')->where('delivery_date', $today)->where('warehouse', 2)->where(function($query) use($today){
|
|
41
|
+ $query->where('logistics_id','=','')->orWhere('logistics_id','is',null);
|
|
42
|
+ })->lists('id');
|
|
43
|
+ if(!empty($orders)){
|
|
44
|
+ $orders = json_decode(json_encode($orders), true);
|
|
45
|
+ $order_ids = implode(',',$orders);
|
|
46
|
+ $res = YPSMS::sendMsg('13055396000', 2, $order_ids, $today);
|
|
47
|
+ }
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+}
|