DESTOON是一款B2B网站管理系统他是基于PHP+MYSQL,二次开发及后期维护方便,小编对这款系统还比较了解,今天就以替换短信接口为例为大家讲解一下如何进行二次开发,我们今天讲解的是6.0版本,使用的短信接口是我们短信宝短信群发平头的短信接口,我们短信宝短信群发平台非常稳定,发送速度快,注册就送测试短信,推荐大家使用。
第一步我们替换后台模版文件,打开项目\admin\template\setting.tpl.php文件,我们修改1095~1137行左右,修改代码为:
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
46
47
|
< div id = "Tabs7" style = "display:none" > < div class = "tt" >云服务</ div > < table cellpadding = "2" cellspacing = "1" class = "tb" > < tr > < 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.smsbao.com/reg" 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 > </ table > < div class = "tt" >手机短信</ div > < table cellpadding = "2" cellspacing = "1" class = "tb" > < 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 > < td class = "tl" >短信内容签名</ td > < td > < input name = "setting[sms_sign]" type = "text" value="<?php echo $sms_sign;?>" size="30"/> <? php tips('将显示在短信内容结尾,以便会员识别,请尽量简短,正确的格式为【签名】,例如 【某某网】。包含签名的短信会被运营商认为是更正规的短信,从而进入更快的发送通道');?> </ td > </ tr > </ tbody > </ table > < div class = "tt" >快递追踪</ div > < table cellpadding = "2" cellspacing = "1" class = "tb" > < 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方法,修改代码为:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
function send_sms( $mobile , $message , $word = 0, $time = 0) { global $db , $DT , $DT_TIME , $DT_IP , $_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 = convert( $message , DT_CHARSET, 'UTF-8' ); $data = 'u=' .DT_CLOUD_UID. '&p=' .md5(DT_CLOUD_KEY). '&m=' . $mobile . '&c=' .rawurlencode( $sms_message ); if ( $code == 0) { $code = true; } else { $code = 'Can Not Connect SMS Server' ; } $db ->query( "INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$message','$word','$_username','$DT_TIME','$code')" ); return $code ; } |
好了经过以上替换,短信宝短信平台就替换成功了,我们去进行测试发送:
报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,并且免审核了,短信内容3~5秒就可送达。
最新更新
电商类
CMS类
微信类