sunhao 5 years ago
parent
commit
770ccbab85
2 changed files with 13 additions and 6 deletions
  1. 12 5
      app/Console/Commands/SendOrder.php
  2. 1 1
      app/libs/sms/YPSMS.php

+ 12 - 5
app/Console/Commands/SendOrder.php

@@ -26,24 +26,31 @@ class SendOrder extends Command {
26 26
     public function SendOrder(){
27 27
         #今日
28 28
         $today = date('Y-m-d');
29
+	$_start = '2019-09-18';
29 30
         //A仓
30
-        $orders = DB::table('order')->where('delivery_date', $today)->where('warehouse', 1)->where(function($query) use($today){
31
+        $orders = DB::table('order')->where('delivery_date', '<=', $today)->where('delivery_date', '>=', $_start)->where('warehouse', 1)->where(function($query) use($today){
31 32
             $query->where('logistics_id','=','')->orWhere('logistics_id','is',null);
32 33
         })->lists('id');
33 34
         if(!empty($orders)){
34 35
             $orders = json_decode(json_encode($orders), true);
35 36
             $order_ids = implode(',',$orders);
36
-            $res = YPSMS::sendMsg('15695966629', 2, $order_ids, $today);
37
+            $res = YPSMS::sendMsg('15695966629', 2, $order_ids, $today.'前');
38
+            $res = YPSMS::sendMsg('13511074691', 2, $order_ids, $today.'前');
39
+            $res = YPSMS::sendMsg('18501257479', 2, $order_ids, $today.'前');
40
+var_dump($res);
37 41
         } 
38
-
39 42
         //B仓
40
-        $orders = DB::table('order')->where('delivery_date', $today)->where('warehouse', 2)->where(function($query) use($today){
43
+	$orders = DB::table('order')->where('delivery_date', '<=', $today)->where('delivery_date', '>=', $_start)->where('warehouse', 2)->where(function($query) use($today){
41 44
             $query->where('logistics_id','=','')->orWhere('logistics_id','is',null);
42 45
         })->lists('id');
43 46
         if(!empty($orders)){
44 47
             $orders = json_decode(json_encode($orders), true);
45 48
             $order_ids = implode(',',$orders);
46
-            $res = YPSMS::sendMsg('13055396000', 2, $order_ids, $today);
49
+            $res = YPSMS::sendMsg('13055396000', 2, $order_ids, $today.'前');
50
+            $res = YPSMS::sendMsg('13511074691', 2, $order_ids, $today.'前');
51
+            $res = YPSMS::sendMsg('18501257479', 2, $order_ids, $today.'前');
52
+var_dump($res);
53
+
47 54
         } 
48 55
     }
49 56
 

+ 1 - 1
app/libs/sms/YPSMS.php

@@ -47,7 +47,7 @@ class YPSMS{
47 47
         if( in_array($type, [3,5]) ){
48 48
             $data['tpl_value'] = ('#order_id#').'='.$order_id;
49 49
         }elseif( $type == 2){
50
-	    $data['tpl_value'] = ('#order_id#').'='.$order_id.'&'. ('#send_date#').'='.$send_date;
50
+	    $data['tpl_value'] = ('#order_id#').'='.$order_id.'&'. ('#send_date#').'='.urldecode($send_date);
51 51
 	}    
52 52
         $json_data = self::tpl_send($ch,$data);
53 53
         //print_r($json_data);    ******************************maybe影响验证码发出