江湖家居 是一款專業的裝修門戶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.gjrencai.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秒就可送達。
最新更新
電商類
CMS類
微信類