江湖家居 是一款专业的装修门户O2O系统,PHP源码开源,支持二次开发,小编对于这款软件还是比较了解的,今天小编就分享一下如何进行二次开发,我以替换短信接口为例,一步一步教大家如何开发,使用的接口是我们短信宝短信群发平台的短信接口,我们短信宝短信群发平台发送速度快,非常稳定,注册就送测试短信,推荐大家使用。
进行短信接口替换,首先我们需要替换后台的显示页面,打开项目/system/admin/view/config/sms.html,修改12~32行左右,替换代码如下:
|
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
|
<div class="page-data"> <h4 class="tip-notice" style="color:black;">需要短息服务的用户通过(<a href="http://www.smsbao.com" style="color:red;">短信宝官网</a>)联系购买。</h4> <form action="?system/config-sms.html" mini-form="config-form" method="post" > <input type="hidden" name="K" value="sms" /> <table width="100%" border="0" cellspacing="0" class="table-data form"> <tr> <th>显示错误提示:</th> <td> <label><input type="radio" name="config[show_error]" <{if $config.show_error}>checked="checked"<{/if}> value="1"/>开启</label> <label><input type="radio" name="config[show_error]" <{if empty($config.show_error)}>checked="checked"<{/if}> value="0"/>关闭</label> <span class="tip-comment">当短息发送失败时,是否显示相应的提示,建议在调试时打开</span> </td> </tr> <tr> <th>帐号:</th> <td><input type="text" name="config[uname]" value="<{$config.uname|default:''}>" class="input w-200"/></td> </tr> <tr> <th>密码:</th> <td><input type="password" name="config[passwd]" value="<{$config.passwd|default:''}>" class="input w-200"/></td> </tr> <tr> <th>管理员手机:</th> <td> <input type="text" name="config[mobile]" value="<{$config.mobile|default:''}>" class="input w-200"/> <span class="tip-comment">用于接收网站通知,多个手机号用英文,隔开</span> </td> </tr> <tr> <th class="clear-th-bottom"></th> <td class="clear-td-bottom" colspan="10"><input type="submit" class="bt-big" value="提交数据" /></td> </tr> </table> </form></div> |
后台显示页面修改完成后我们需要修改短信接口的配置文件,打开项目/system/schemas/config/sms.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
37
38
39
40
41
42
43
44
|
<?php/** * Copy Right Abc576.com * Each engineer has a duty to keep the code elegant * Author @shzhrui<Anhuike@gmail.com> * $Id: sms.php 2504 2013-12-25 07:00:36Z langzhong $ */if(!defined('__CORE_DIR')){ exit("Access Denied");}return array ( 'uname' => array ( 'label' => '帐号', 'field' => 'uname', 'type' => 'text', 'default' => '', 'comment' => '', 'html' => false, 'empty' => false, ), 'passwd' => array ( 'label' => '密码', 'field' => 'passwd', 'type' => 'text', 'default' => '', 'comment' => '', 'html' => false, 'empty' => false, ), 'mobile' => array ( 'label' => '管理员接受短信的账号', 'field' => 'mobile', 'type' => 'text', 'default' => '', 'comment' => '', 'html' => false, 'empty' => false, ),); |
修改完成后我们修改,接口的发送代码,打开项目/sysytem/models/sms文件,新建一个smsbao.mdl.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
37
38
39
40
41
42
43
44
|
<?phpImport::I('sms');class Mdl_Sms_Smsbao implements Sms_Interface{ protected $_cfg = array(); public $lastmsg = ''; public $lastcode = 1; public function __construct($system) { $this->_cfg = $system->config->get('sms'); } public function send($mobile, $content) { $url = $this->gateway.'u='.$this->_cfg['uname'].'&p='.md5($this->_cfg['passwd']).'&m='.$mobile.'&c='.$content; $ret = file_get_contents($url); if($ret == 0){ return true; }else{ switch($ret){ case 30:$error='密码错误';break; case 40:$error='账号不存在';break; case 41:$error='余额不足';break; case 42:$error='账号过期';break; case 43:$error='IP地址限制';break; case 50:$error='内容含有敏感词';break; case 51:$error='手机号码不正确';break; } $this->lastcode = $ret; $this->lastmsg = $error; } }} |
好了,经过以上的替换,短信宝的短信平台已经替换成功了,可以正常使用了。报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,并且免审核了,短信内容3~5秒就可送达。
- 上一篇:iWebShop电商平台短信接口替换 下一篇:江湖家政短信接口替换

