Browse Source

发短信

sunhao 5 years ago
parent
commit
b506acec53
1 changed files with 23 additions and 3 deletions
  1. 23 3
      app/libs/sms/YPSMS.php

+ 23 - 3
app/libs/sms/YPSMS.php

@@ -11,7 +11,8 @@ class YPSMS{
11 11
 
12 12
     private static $order_tpl = [
13 13
         1 => '3210114', //新订单审核提醒管理员
14
-        2 => '3210120',  //新订单提醒仓管
14
+        //2 => '3210120',  //新订单提醒仓管
15
+        2 => '3211800',  //新订单提醒仓管
15 16
         3 => '3210134',   //订单发货提醒销售
16 17
         4 => '3210146',   //订单审核通过提醒销售
17 18
         5 => '3210312',   //订单审核驳回提醒销售
@@ -33,7 +34,7 @@ class YPSMS{
33 34
         return $ch;
34 35
 
35 36
     }
36
-    public static function sendMsg($phone,$type,$order_id = null){
37
+    public static function sendMsg($phone,$type,$order_id = null, $send_date = null){
37 38
         $tpl = self::$order_tpl;
38 39
         $tpl_id = $tpl[$type];
39 40
         $ch=self::init();       
@@ -45,7 +46,9 @@ class YPSMS{
45 46
                 ];
46 47
         if( in_array($type, [3,5]) ){
47 48
             $data['tpl_value'] = ('#order_id#').'='.$order_id;
48
-        }     
49
+        }elseif( $type == 2){
50
+	    $data['tpl_value'] = ('#order_id#').'='.$order_id.'&'. ('#send_date#').'='.$send_date;
51
+	}    
49 52
         $json_data = self::tpl_send($ch,$data);
50 53
         //print_r($json_data);    ******************************maybe影响验证码发出
51 54
          $array = json_decode($json_data,true);
@@ -54,6 +57,23 @@ class YPSMS{
54 57
         return $array;
55 58
     }
56 59
 
60
+    public static function sendSMS($phone,$text){
61
+        $ch=self::init();
62
+
63
+        // $data = array('tpl_id' => YP_TPL_ID, 'tpl_value' => ('#code#').'='.urlencode($code), 'apikey' => YP_SMS_KEY, 'mobile' => $phone);
64
+        // $json_data = self::tpl_send($ch,$data);
65
+        // $array = json_decode($json_data,true);
66
+        // echo '<pre>';print_r($array);
67
+        $data=array('tpl_id' => YP_TPL_ID,'text'=>$text,'apikey'=>YP_SMS_KEY,'mobile'=>$phone);
68
+
69
+        $json_data = self::send($ch,$data);
70
+        //print_r($json_data);    ******************************maybe影响验证码发出
71
+         $array = json_decode($json_data,true);
72
+        // echo '<pre>';print_r($array);
73
+        curl_close($ch);
74
+        return $array;
75
+    }	
76
+
57 77
     public static function sendRedSMS($phone,$text,$id){
58 78
         $ch=self::init();
59 79
         $data=array('tpl_id' => $id,'text'=>$text,'apikey'=>YP_SMS_YHQ,'mobile'=>$phone);