91成人在线播放_欧美一区二区视频在线观看_91精品国产高清久久久久久_国产精品久久亚洲不卡4k岛国


待發短信

在線客服
產品支持 短信寶客服
合作渠道 渠道合作
服務咨詢

4001-021-502

工作時間

9:00-21:00

啦啦外賣跑腿系統新增短信寶短信接口

啦啦外賣跑腿是一款基于微擎框架用PHP+MYSQL開發的一套外賣跑腿送餐系統,是一款非常不錯的系統,小編今天就以替換短信接口為例帶大家進行二次開發,我們使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。

首先我們打開項目:\template\web\config\notice-sms.html 文件,增加以下代碼

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<div class="alert alert-warning">開啟此功能需要先開啟短信功能并正確配置短信寶用戶名和短信寶密碼,<a href="{php echo iurl('config/sms/set');}" target="_blank">現在去配置>></a></div>
  <h3>店員通知</h3>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">開啟通知店員功能</label>
   <div class="col-sm-9 col-xs-12"><div class="radio radio-inline">
     <input type="radio" value="1" name="clerk[status]" id="clerk-status-1" {if $sms['clerk']['status'] == 1}checked{/if}>
     <label for="clerk-status-1">開啟</label>   
 
</div>
    <div class="radio radio-inline">
     <input type="radio" value="0" name="clerk[status]" id="clerk-status-0" {if !$sms['clerk']['status']}checked{/if}>
     <label for="clerk-status-0">關閉</label>   
 
</div>
    <div class="help-block">
     <span class="text-danger">開啟此功能需要先開啟短信功能并正確配置短信寶用戶名和短信寶密碼</span>
    </div></div></div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">通知模板</label>
   <div class="col-sm-9 col-xs-12">
    <input type="text" class="form-control" name="clerk[tts_code]" value="{$sms['clerk']['tts_code']}">
    <span class="help-block"><a href="http://www.gjrencai.com" target="_blank">聯系短信寶客服</a>報備模板后到達速度更快</span>
    <span class="help-block">
     <strong class="text-danger">模板標題: 新外賣訂單通知</strong>     <br>
     <strong class="text-danger">模板內容: 您好name,您的店鋪store,有新的訂單,訂單總金額price元,請及時處理</strong>
    </span>
</div>  
</div>
  <h3>外賣訂單配送員通知</h3>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">開啟通知配送員功能</label>
   <div class="col-sm-9 col-xs-12">
    <div class="radio radio-inline">
     <input type="radio" value="1" name="deliveryer[status]" id="deliveryer-status-1" {if $sms['deliveryer']['status'] == 1}checked{/if}>
     <label for="deliveryer-status-1">開啟</label>    </div>
    <div class="radio radio-inline">
     <input type="radio" value="0" name="deliveryer[status]" id="deliveryer-status-0" {if !$sms['deliveryer']['status']}checked{/if}>
     <label for="deliveryer-status-0">關閉</label>    </div>
    <div class="help-block">
     <span class="text-danger">開啟此功能需要先開啟短信功能并正確配置短信寶用戶名和短信寶密碼</span>
    </div>
</div>
</div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">通知模板</label>
   <div class="col-sm-9 col-xs-12">
    <input type="text" class="form-control" name="deliveryer[tts_code]" value="{$sms['deliveryer']['tts_code']}">
    <span class="help-block"><a href="http://www.gjrencai.com" target="_blank">聯系短信寶客服</a>報備模板后到達速度更快 </span>
    <span class="help-block">
     <strong class="text-danger">模板標題: 新外賣配送訂單通知</strong>     <br>
     <strong class="text-danger">模板內容: 您好name, 門店store有新的配送訂單,快去搶單吧</strong>
    </span>
</div>
</div>
  {if check_plugin_perm('errander')}
   <h3>跑腿訂單配送員通知</h3>
   <div class="form-group">
    <label class="col-xs-12 col-sm-3 col-md-2 control-label">開啟通知配送員功能</label>
    <div class="col-sm-9 col-xs-12">
     <div class="radio radio-inline">
      <input type="radio" value="1" name="errander_deliveryer[status]" id="errander-deliveryer-status-1" {if $sms['errander_deliveryer']['status'] == 1}checked{/if}>
      <label for="errander-deliveryer-status-1">開啟</label>     </div>
     <div class="radio radio-inline">
      <input type="radio" value="0" name="errander_deliveryer[status]" id="errander-deliveryer-status-0" {if !$sms['errander_deliveryer']['status']}checked{/if}>
      <label for="errander-deliveryer-status-0">關閉</label>     </div>
     <div class="help-block">
      <span class="text-danger">開啟此功能需要先開啟短信功能并正確配置短信寶用戶名和短信寶密碼</span>
     </div>
</div>
</div>
   <div class="form-group">
    <label class="col-xs-12 col-sm-3 col-md-2 control-label">通知模板</label>
    <div class="col-sm-9 col-xs-12">
     <input type="text" class="form-control" name="errander_deliveryer[tts_code]" value="{$sms['errander_deliveryer']['tts_code']}">
     <span class="help-block"><a href="http://www.gjrencai.com" target="_blank">聯系短信寶客服</a>報備模板后到達速度更快</span>
     <span class="help-block">
      <strong class="text-danger">模板標題: 新跑腿配送訂單通知</strong>      <br>
      <strong class="text-danger">模板內容: 您好name,平臺有新的配送訂單,本單可收益deliveryerfee元,快去搶單吧</strong>
     </span>
</div>
</div>
  {/if}
  <h3>平臺管理員變更配送員工作狀態通知</h3>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">開啟通知配送員功能</label>
   <div class="col-sm-9 col-xs-12">
    <div class="radio radio-inline">
     <input type="radio" value="1" name="work_status_change[status]" id="work_status_change-1" {if $sms['work_status_change']['status'] == 1}checked{/if}>
     <label for="work_status_change-1">開啟</label>    </div>
    <div class="radio radio-inline">
     <input type="radio" value="0" name="work_status_change[status]" id="work_status_change-0" {if !$sms['work_status_change']['status']}checked{/if}>
     <label for="work_status_change-0">關閉</label>    </div>
    <div class="help-block">
     <span class="text-danger">開啟此功能需要先開啟短信功能并正確配置短信寶用戶名和短信寶密碼</span>
    </div></div></div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">通知模板</label>
   <div class="col-sm-9 col-xs-12">
    <input type="text" class="form-control" name="work_status_change[tts_code]" value="{$sms['work_status_change']['tts_code']}">
    <span class="help-block"><a href="http://www.gjrencai.com" target="_blank">聯系短信寶客服</a>報備模板后到達速度更快 </span>
     <span class="help-block">      <strong class="text-danger">模板標題: 配送員工作狀態變更通知</strong>      <br>
      <strong class="text-danger">模板內容: 您好name,您的工作狀態已變更為work_status_cn,如有疑問,請聯系平臺負責人</strong>
     </span>
   </div>
  </div>

接著打開項目:\template\web\config\sms.html 文件件,替換以下代碼

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{itemplate 'public/header'}
{if $op == 'set'}
<div class="page clearfix">
 <h2>{$_W['page']['title']}</h2>
 <form class="form-horizontal form form-validate" id="form1" action="" method="post" enctype="multipart/form-data">
  <div class="alert alert-warning">短信使用"短信寶"短信平臺"。<a href="http://www.gjrencai.com/reg" target="_blank">立即申請</a></div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">開啟短信功能</label>
   <div class="col-sm-9 col-xs-12">
    <div class="radio radio-inline">
     <input type="radio" value="1" name="status" id="status-1" {if $sms['status'] == 1}checked{/if} required="true">
     <label for="status-1">開啟</label>    </div>
    <div class="radio radio-inline">
     <input type="radio" value="0" name="status" id="status-0" {if !$sms['status']}checked{/if} required="true">
     <label for="status-0">關閉</label>    </div>
    <div class="help-block">開啟短信功能后,所有門店都可以使用該短信設置.</div>   </div>
  </div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">接口類型</label>
   <div class="col-sm-9 col-xs-12">
    <div class="radio radio-inline">
     <input type="radio" value="1" name="version" id="version-1" {if $sms['version'] == 1 || empty($sms['version'])}checked{/if}>
     <label for="version-1">舊版</label>    </div>
    <div class="radio radio-inline">
     <input type="radio" value="2" name="version" id="version-2" {if $sms['version'] == 2}checked{/if}>
     <label for="version-2">新版(2017年6月之后申請的)</label>
    </div>
    <div class="radio radio-inline">
     <input type="radio" value="3" name="version" id="version-3" {if $sms['version'] == 3}checked{/if}>
     <label for="version-3">短信寶短信平臺</label>
    </div>
    <span class="help-block">由于阿里大于接口調整,需要根據申請時間來區分支付接口</span>
   </div>
  </div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">短信寶用戶名(AppKey)</label>
   <div class="col-sm-9 col-xs-12">
    <input type="text" class="form-control" name="key" value="{$sms['key']}">
    <span class="help-block">還沒有短信賬號? <a href="http://www.gjrencai.com/reg" target="_blank">現在去創建</a>。 如果是新版接口,此處填寫:Access Key ID</span>
   </div>
  </div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">短信寶密碼(AppSecret)</label>
   <div class="col-sm-9 col-xs-12">
    <input type="text" class="form-control" name="secret" value="{$sms['secret']}">
    <span class="help-block">如果是新版接口,此處填寫:Access Key Secret</span>
   </div> </div>
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">短信簽名</label>
   <div class="col-sm-9 col-xs-12">
    <input type="text" class="form-control" name="sign" value="{$sms['sign']}">
    <span class="help-block">請填寫短信簽名.</span>
   </div> 
 
</div>
  <div class="form-group">
   <div class="col-sm-9 col-xs-9 col-md-9">
    <input type="hidden" name="token" value="{$_W['token']}">
    <input type="submit" value="提交" class="btn btn-primary">
   </div> 
</div>
 </form>
</div>
{/if}
{if $op == 'template'}
<div class="page clearfix">
 <h2>{$_W['page']['title']}</h2>
 <form class="form-horizontal form form-validate" id="form1" action="" method="post" enctype="multipart/form-data">
  <div class="form-group">
   <label class="col-xs-12 col-sm-3 col-md-2 control-label">身份驗證驗證碼 模版</label>
   <div class="col-sm-9 col-xs-12">
    <input type="text" class="form-control" name="verify_code_tpl" value="{$sms['verify_code_tpl']}" required="true">
    <span class="help-block"><a href="http://www.gjrencai.com" target="_blank">聯系短信寶客服</a>報備模板后到達速度更快</span>
    <span class="help-block">
     <strong class="text-danger">
      模板名稱: 通用驗證碼<br>
      模板詳情: 驗證碼code,您正在使用***平臺(注意:這里改成你自己的平臺),需要進行驗證,15分鐘內有效,打死也不能告訴別人哦
     </strong> 
</span></div>
  </div>
  <div class="form-group">
   <div class="col-sm-9 col-xs-9 col-md-9">
    <input type="hidden" name="token" value="{$_W['token']}">
    <input type="submit" value="提交" class="btn btn-primary">
   </div>
  </div>
 </form>
</div>
{/if}
{itemplate 'public/footer'}

最后打開項目:\model\sms.mod.php 文件,替換sms_send 方法

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
function sms_send($type$mobile$content$sid = 0)
{
 global $_W;
 $config_sms $_W['we7_wmall']['config']['sms'];
 if (!is_array($config_sms['set'])) {
  return error(-1, '平臺沒有設置短信參數');
 }
 
 if (empty($config_sms['set']['status'])) {
  return error(-1, '平臺已關閉短信功能');
 }
 if ($config_sms['set']['version'] == 2) {
  date_default_timezone_set('GMT');
  $post array('PhoneNumbers' => $mobile'SignName' => $config_sms['set']['sign'], 'TemplateCode' => trim($type), 'TemplateParam' => json_encode($content), 'OutId' => '''RegionId' => 'cn-hangzhou''AccessKeyId' => $config_sms['set']['key'], 'Format' => 'json''SignatureMethod' => 'HMAC-SHA1''SignatureVersion' => '1.0''SignatureNonce' => uniqid(), 'Timestamp' => date('Y-m-d\\TH:i:s\\Z'), 'Action' => 'SendSms''Version' => '2017-05-25');
  ksort($post);
  $str '';
  foreach ($post as $key => $value) {
   $str .= '&' . percentencode($key) . '=' . percentencode($value);
  }
  $stringToSign 'GET' '&%2F&' . percentencode(substr($str, 1));
  $signature base64_encode(hash_hmac('sha1'$stringToSign$config_sms['set']['secret'] . '&', true));
  $post['Signature'] = $signature;
  $url '' . http_build_query($post);
  $result = ihttp_get($url);
  if (is_error($result)) {
   return $result;
  }
 
  $result = @json_decode($result['content'], true);
 
  if ($result['Code'] != 'OK') {
   return error(-1, $result['Message']);
  }
 }
 
 elseif($config_sms['set']['version'] == 1){
  $post array('method' => 'alibaba.aliqin.fc.sms.num.send''app_key' => $config_sms['set']['key'], 'timestamp' => date('Y-m-d H:i:s'), 'format' => 'json''v' => '2.0''sign_method' => 'md5''sms_type' => 'normal''sms_free_sign_name' => $config_sms['set']['sign'], 'rec_num' => $mobile'sms_template_code' => trim($type), 'sms_param' => json_encode($content));
  ksort($post);
  $str '';
 
  foreach ($post as $key => $val) {
   $str .= $key $val;
  }
 
  $secret $config_sms['set']['secret'];
  $post['sign'] = strtoupper(md5($secret $str $secret));
  $query '';
 
  foreach ($post as $key => $val) {
   $query .= $key '=' . urlencode($val) . '&';
  }
  $query substr($query, 0, -1);
  $url '  ' $query;
  $result = ihttp_get($url);
  if (is_error($result)) {
   return $result;
  }
  $result = @json_decode($result['content'], true);
  if (!empty($result['error_response'])) {
   if (isset($result['error_response']['sub_code'])) {
    $msg = sms_error_code($result['error_response']['sub_code']);
 
    if (empty($msg)) {
     $msg['msg'] = $result['error_response']['sub_msg'];
    }
   }
 
   else {
    $msg['msg'] = $result['error_response']['msg'];
   }
   return error(-1, $msg['msg']);
  }
 }else{
 $tpl str_replace(array_keys($content), array_values($content), $type);
 $url 'http://api.smsbao.com/sms?u='.$config_sms['set']['key'].'&p='.md5($config_sms['set']['secret']).'&m='.$mobile.'&c=【'.$config_sms['set']['sign'].'】'.$tpl;
  $result file_get_contents($url);
  if ($result == '0') {
   return true;
  }else{
   return false;
  }
 }
 return true;
}

經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:

報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。

另外:我們已經開發好完整的啦啦外賣跑腿系統短信寶插件,點擊此鏈接 下載及查看安裝流程

開源插件

最新更新

電商類

CMS類

微信類

文章標簽