DESTOON是一款B2B網站管理系統他是基于PHP+MYSQL,二次開發及后期維護方便,小編對這款系統還比較了解,今天就以替換短信接口為例為大家講解一下如何進行二次開發,我們今天講解的是7.0版本,使用的短信接口是我們短信寶短信群發平頭的短信接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
第一步我們替換后臺模版文件,打開項目\admin\template\setting.tpl.php文件,我們修改1085~1129行左右,修改代碼為:
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
|
<td class = "tl" >短信寶用戶名</td> <td><input name= "config[cloud_uid]" type= "text" id= "cloud_uid" value= "<?php echo $cloud_uid;?>" size= "30" /> <a href= "http://www.gjrencai.com" target= "_blank" class = "t" >[沒有賬號點此申請帳號]</a></td> </tr> <tr> <td class = "tl" >短信寶密碼</td> <td><input name= "config[cloud_key]" type= "text" id= "cloud_key" value= "<?php echo $cloud_key;?>" size= "30" onfocus= "if(this.value.indexOf('**')!=-1)this.value='';" /></td> </tr> <tr> <td class = "tl" >提示信息</td> <td class = "f_red" >以下云服務需要先填寫正確的帳號和密鑰方可開啟成功</td> </tr> <tr> <td class = "tl" >手機短信</td> <td> <input type= "radio" name= "setting[sms]" value= "1" <?php if ( $sms ){ ?>checked <?php } ?> onclick= "Ds('dsms');" /> 開啟 <input type= "radio" name= "setting[sms]" value= "0" <?php if (! $sms ){ ?>checked <?php } ?> onclick= "Dh('dsms');" /> 關閉 </td> </tr> <tbody id= "dsms" style= "display:<?php if(!$sms) echo 'none';?>" > <tr> <td class = "tl" >每日上限</td> <td><input name= "setting[sms_max]" type= "text" value= "<?php echo $sms_max;?>" size= "5" /> 條 <?php tips( '特指會員注冊、找回密碼、手機驗證等需要發送驗證碼場景,同一手機號碼或會員每日最大發送數量,填0為不限制,建議填5左右的數字,以免惡意發送' );?></td> </tr> <tr style= "display:none;" > <td class = "tl" >短信長度</td> <td><input name= "setting[sms_len]" type= "text" value= "<?php echo $sms_len;?>" size= "5" /> 字/條</td> </tr> <tr style= "display:none;" > <td class = "tl" >成功標識</td> <td><input name= "setting[sms_ok]" type= "text" value= "<?php echo $sms_ok;?>" size= "10" /> <?php tips( '短信發送成功標識字符,系統根據此字符確定是否扣除會員短信余額' );?></td> </tr> <tr> <td class = "tl" >短信內容簽名</td> <td><input name= "setting[sms_sign]" type= "text" value= "<?php echo $sms_sign;?>" size= "30" /> <?php tips( '將顯示在短信內容結尾,以便會員識別,請盡量簡短,正確的格式為【簽名】,例如 【某某網】。包含簽名的短信會被運營商認為是更正規的短信,從而進入更快的發送通道' );?></td> </tr> </tbody> <tr> <td class = "tl" >快遞追蹤</td> <td> <input type= "radio" name= "setting[cloud_express]" value= "1" <?php if ( $cloud_express ){ ?>checked <?php } ?>/> 開啟 <input type= "radio" name= "setting[cloud_express]" value= "0" <?php if (! $cloud_express ){ ?>checked <?php } ?>/> 關閉 </td> </tr> </table> </div> |
修改完成后,后臺顯示界面就變成我們短信寶的了,接下來我們去修改發送短信的接口代碼,打開項目\include\global.func.php 文件,修改send_sms方法,在298行左右,修改代碼為:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
function send_sms( $mobile , $message , $word = 0, $time = 0) { global $DT , $_username ; if (! $DT [ 'sms' ] || !DT_CLOUD_UID || !DT_CLOUD_KEY || !is_mobile( $mobile ) || strlen ( $message ) < 5) return false; $word or $word = word_count( $message ); $sms_message = $message ; $data = 'u=' .DT_CLOUD_UID. '&p=' .md5(DT_CLOUD_KEY). '&m=' . $mobile . '&c=' .rawurlencode( $sms_message ); if ( $code == 0) { $code = explode ( 'destoon_sms_code=' , $code ); $code = $code [1]; } else { $code = 'Can Not Connect SMS Server' ; } DB::query( "INSERT INTO " .DT_PRE. "sms (mobile,message,word,editor,sendtime,ip,code) VALUES ('$mobile','$message','$word','$_username','" .DT_TIME. "','" .DT_IP. "','$code')" ); return $code ; } |
好了經過以上替換,短信寶短信平臺就替換成功了,我們去進行測試發送:
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,并且免審核了,短信內容3~5秒就可送達。
另外:我們已經開發好完整的DESTOON網站管理系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類