人人商城系统是一款基于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.smsbao.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.smsbao.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.smsbao.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.smsbao.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秒就可送达。
另外:我们已经开发好完整的人人商城系统短信宝插件,点击此链接 下载及查看安装流程。
- 上一篇:zzzPhp新增短信宝短信接口 下一篇:大米cms_v6新增短信宝短信接口

