人人商城系統是一款基于PHP+MYSQL開源的、免費的電商系統軟件,使用范圍廣泛,今天小編為大家講解一下v3版本的短信接口開發,我們使用的短信接口是我們短信寶短信群發平臺的接口,我們短信寶短信平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
首先在項目:\template\web_v3\sysset\sms\temp\post.html 添加以下代碼
|
1
2
3
|
{if !empty($smsset['smsbao']) || (!empty($item) &&$item['type']=='smsbao')}<label class="radio-inline"><input type="radio" class="sms-type" data-template="0" name="type" value="smsbao" {if $item['type']=='smsbao'} checked{/if} {if !empty($item['type'])}disabled{/if}>短信寶</label>{/if} |
打開項目:\template\web_v3\sysset\sms\temp\index.html 增加行代碼在13行左右
|
1
2
3
4
5
6
7
8
9
|
<select name="type" class="form-control " style="width:120px;"> <option value="" {if $_GPC['type']==''}selected{/if}>服務商</option> <option value="juhe" {if $_GPC['type']=='juhe'}selected{/if}>聚合數據</option> <option value="dayu" {if $_GPC['type']=='dayu'}selected{/if}>阿里大于(老用戶)</option> <option value="aliyun" {if $_GPC['type']=='aliyun'}selected{/if}>阿里云短信(舊版)</option> <option value="aliyun_new" {if $_GPC['type']=='aliyun_new'}selected{/if}>阿里云短信(新版)</option> <option value="emay" {if $_GPC['type']=='emay'}selected{/if}>億美軟通</option> <option value="smsbao" {if $_GPC['type']=='smsbao'}selected{/if}>短信寶</option> </select> |
打開項目:\template\web_v3\sysset\sms\set.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
|
<div class="alert alert-primary"> <h4 style="font-weight: 500">短信提醒配置說明</h4> <p>短信提醒現支持 <a href="http://www.juhe.cn" target="_blank">聚合數據</a>、<a href="http://www.alidayu.com" target="_blank">阿里大于(老用戶)</a>、<a href="https://market.aliyun.com/products/57002003/cmapi011900.html" target="_blank">阿里云短信</a>、<a href="http://www.emay.cn" target="_blank">億美軟通</a>、<a href="http://www.gjrencai.com">短信寶</a>,五家行業領先接口,接口所有參數需在此處設置。</p> <p>參數設置:在此頁面開啟所需的服務商API并設置服務商提供的參數。</p> <p>余額預警:聚合數據、阿里大于需在服務商管理后臺設置余額預警,億美軟通需在當前頁面設置余額預警。</p> <p>余額查詢:聚合數據、阿里大于需在服務商管理后臺查看賬戶余額,億美軟通需在當前查看賬戶余額(設置好參數保存頁面即可查看)。</p> <p>其他說明:阿里大于老用戶仍然可以使用,但新用戶僅支持<a href="https://market.aliyun.com/products/57002003/cmapi011900.html" target="_blank">阿里云短信</a></p> </div> <div class="form-group-title">短信寶<small style="padding-left: 10px;"><a class="text-primary" target="_blank" href="http://www.gjrencai.com/reg">立即申請</a></small> <span class="pull-right"> <input type="hidden" value="{$item['smsbao']}" name="smsbao" /> <input class="js-switch small" type="checkbox" {if !empty($item['smsbao'])}checked{/if} /> </span> </div> <div class="sms-smsbao" style="{if empty($item['smsbao'])}display: none;{/if}"> <div class="form-group"> <label class="col-sm-2 control-label must">短信寶用戶名</label> <div class="col-sm-9 col-xs-12"> <input type="text" name="smsbao_key" class="form-control valid" value="<?php echo $item['smsbao_key'];?>" data-rule-required="true"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label must">短信寶密碼</label> <div class="col-sm-9 col-xs-12"> <input type="text" name="smsbao_secret" class="form-control valid" value="<?php echo $item['smsbao_secret'];?>" data-rule-required="true"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label must">短信簽名</label> <div class="col-sm-9 col-xs-12"> <input type="text" name="smsbao_sign" class="form-control valid" value="<?php echo $item['smsbao_sign'];?>" data-rule-required="true"> </div> </div> </div> |
打開項目:\template\web\sysset\sms\temp\post.html 增加行代碼
|
1
2
3
|
{if !empty($smsset['smsbao']) || (!empty($item) && $item['type']=='smsbao')} <label class="radio-inline"><input type="radio" class="sms-type" data-template="0" name="type" value="smsbao" {if $item['type']=='smsbao'} checked {/if} {if !empty($item['type'])}disabled{/if}>短信寶</label> {/if} |
打開項目 \template\web\sysset\sms\temp\index.html 修改下代碼
|
1
2
3
4
5
6
7
8
|
<select name="type" class="form-control input-sm select-sm" style="width:120px;"> <option value="" {if $_GPC['type']==''}selected{/if}>服務商</option> <option value="juhe" {if $_GPC['type']=='juhe'}selected{/if}>聚合數據</option> <option value="dayu" {if $_GPC['type']=='dayu'}selected{/if}>阿里大于(老用戶)</option> <option value="aliyun" {if $_GPC['type']=='aliyun'}selected{/if}>阿里云短信</option> <option value="emay" {if $_GPC['type']=='emay'}selected{/if}>億美軟通</option> <option value="smsbao" {if $_GPC['type']=='smsbao'}selected{/if}>短信寶</option> </select> |
打開項目:\template\web\sysset\sms\set.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
|
<div class="alert alert-info"> <h4 style="font-weight: 500">短信提醒配置說明</h4> <p>短信提醒現支持 <a href="http://www.juhe.cn" target="_blank">聚合數據</a>、<a href="http://www.alidayu.com" target="_blank">阿里大于(老用戶)</a>、<a href="https://market.aliyun.com/products/57002003/cmapi011900.html" target="_blank">阿里云短信</a>、<a href="http://www.emay.cn" target="_blank">億美軟通</a>、 <a href="http://www.gjrencai.com" target="_blank"> 短信寶</a>五家行業領先接口,接口所有參數需在此處設置。</p> <p>參數設置:在此頁面開啟所需的服務商API并設置服務商提供的參數。</p> <p>余額預警:聚合數據、阿里大于需在服務商管理后臺設置余額預警,億美軟通需在當前頁面設置余額預警。</p> <p>余額查詢:聚合數據、阿里大于需在服務商管理后臺查看賬戶余額,億美軟通需在當前查看賬戶余額(設置好參數保存頁面即可查看)。</p> <p>其他說明:阿里大于老用戶仍然可以使用,但新用戶僅支持<a href="https://market.aliyun.com/products/57002003/cmapi011900.html" target="_blank">阿里云短信</a></p> </div><div class="form-group-title">短信寶<kbd>推薦</kbd><small style="padding-left:10px;"><a target="_blank" href="http://www.gjrencai.com">立即申請</a></small> <span class="pull-right"> <input type="hidden" value="<?php echo $item['smsbao'];?>" name="smsbao" /> <input class="js-switch small" type="checkbox" <?php if(!empty($item['smsbao'])) {?>checked<?php }?>/> </span> </div> <div class=" sms-smsbao" style="<?php if(empty($item['smsbao'])) { ?>display: none;<?php } ?>"> <div class="form-group"> <label class="col-sm-2 control-label must">短信寶帳號</label> <div class="col-sm-9 col-xs-12"> <input type="text" name="smsbao_key" class="form-control valid" value="<?php echo $item['smsbao_key'];?>" data-rule-required="true"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label must">短信寶密碼</label> <div class="col-sm-9 col-xs-12"> <input type="text" name="smsbao_secret" class="form-control valid" value="<?php echo $item['smsbao_secret'];?>" data-rule-required="true"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label must">短信寶簽名</label> <div class="col-sm-9 col-xs-12"> <input type="text" name="smsbao_sign" class="form-control valid" value="<?php echo $item['smsbao_sign'];?>" data-rule-required="true"> </div> </div> </div> |
打開項目:\core\web\sysset\sms\index.php 修改下代碼
|
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
|
public function main() { if (cv('sysset.sms.temp')) { header('location: ' . webUrl('sysset/sms/temp')); } else if (cv('sysset.sms.set')) { header('location: ' . webUrl('sysset/sms/set')); } else { header('location: ' . webUrl()); } exit(); } public function set() { global $_W; global $_GPC; $item = pdo_fetch('SELECT * FROM ' . tablename('ewei_shop_sms_set') . ' WHERE uniacid=:uniacid ', array(':uniacid' => $_W['uniacid'])); if ($_W['ispost']) { $arr = array('juhe' => intval($_GPC['juhe']), 'juhe_key' => trim($_GPC['juhe_key']), 'dayu' => intval($_GPC['dayu']), 'dayu_key' => trim($_GPC['dayu_key']), 'dayu_secret' => trim($_GPC['dayu_secret']), 'aliyun' => intval($_GPC['aliyun']), 'aliyun_appcode' => trim($_GPC['aliyun_appcode']), 'aliyun_new' => intval($_GPC['aliyun_new']), 'aliyun_new_keyid' => trim($_GPC['aliyun_new_keyid']), 'aliyun_new_keysecret' => trim($_GPC['aliyun_new_keysecret']), 'emay' => intval($_GPC['emay']), 'emay_url' => trim($_GPC['emay_url']), 'emay_sn' => trim($_GPC['emay_sn']), 'emay_pw' => trim($_GPC['emay_pw']), 'emay_sk' => trim($_GPC['emay_sk']), 'emay_phost' => trim($_GPC['emay_phost']), 'emay_pport' => intval($_GPC['emay_pport']), 'emay_puser' => trim($_GPC['emay_puser']), 'emay_ppw' => trim($_GPC['emay_ppw']), 'emay_out' => intval($_GPC['emay_out']), 'emay_outresp' => empty($_GPC['emay_outresp']) ? 30 : intval($_GPC['emay_outresp']), 'emay_warn' => intval($_GPC['emay_warn']), 'emay_mobile' => intval($_GPC['emay_mobile']),'smsbao'=>intval($_GPC['smsbao']),'smsbao_key'=>trim($_GPC['smsbao_key']),'smsbao_secret'=>trim($_GPC['smsbao_secret']),'smsbao_sign'=>trim($_GPC['smsbao_sign'])); if (empty($item)) { $arr['uniacid'] = $_W['uniacid']; pdo_insert('ewei_shop_sms_set', $arr); $id = pdo_insertid(); } else { pdo_update('ewei_shop_sms_set', $arr, array('id' => $item['id'], 'uniacid' => $_W['uniacid'])); } show_json(1); } |
打開項目:\core\com\sms.php 新增短信寶接口
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
else if($template['type'] == 'smsbao'){ if (empty($smsset['smsbao'])) { return array('status' => 0, 'message' => '未開啟短信寶!'); } if (empty($smsset['smsbao_key'])) { return array('status' => 0, 'message' => '未填寫短信寶帳號!'); } if (empty($smsset['smsbao_secret'])) { return array('status' => 0, 'message' => '未填寫短信寶密碼!'); } if (empty($smsset['smsbao_sign'])) { return array('status' => 0, 'message' => '未填寫短信寶簽名!'); } } |
經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的人人商城系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類