佐优家教管理系统是立足于互联网,面向广大家教教员及学员提供专业家教服务的管理平台,小编对于这套系统还是比较了解的。今天就以替换短信接口为例告诉大家如何进行二次开发,使用的短信接口是我们短信宝短信群发平台的接口,我们短信宝短信群发平台非常稳定,发送速度快,注册就送测试短信,推荐大家使用。
首页我们打开项目:\app\Bhadmin\View\default\System\sysmsg.tpl 新增下短信宝页面
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
|
<form name= "sysmailset" method= "post" action= "" > <table width= "100%" border= "0" align= "center" cellpadding= "0" cellspacing= "0" class= "{:tabstyle()}" > <tr> <td width= "10%" height= "30" align= "left" valign= "middle" >参数说明</td> <td height= "30" align= "left" valign= "middle" >参数值</td> </tr> <tr> <td height= "25" align= "left" valign= "middle" >短信宝账号<br/> </td> <td height= "25" align= "left" valign= "middle" >{:input(array( 'icon' => 'user' , 'width' =>25, 'place' => '短信宝账号' , 'name' => 'msguser' , 'val' =>$data[ 'msguser' ], 'tips' => '输入短信账号' ))} <a style= "padding:10px;color: red;" target= "_blank" href= "http://www.smsbao.com/reg" >还没有注册账号!点击注册账号</a></td> </tr> <tr> <td height= "25" align= "left" valign= "middle" >短信宝密码</td> <td height= "25" align= "left" valign= "middle" >{:input(array( 'faicon' => 'unlock' , 'type' => 'password' , 'width' =>25, 'place' => '短信宝密码' , 'name' => 'msgpass' , 'val' =>$data[ 'msgpass' ], 'tips' => '输入短信密码' ))}</td> </tr> <tr> <td height= "25" align= "left" valign= "middle" >短信宝签名<br/>例如:百恒网络</td> <td height= "25" align= "left" valign= "middle" >{:input(array( 'faicon' => 'commenting' , 'width' =>25, 'place' => '短信宝签名' , 'name' => 'msgsuff' , 'val' =>$data[ 'msgsuff' ], 'tips' => '输入短信宝签名' ))}</td> </tr> <tr> <td height= "25" align= "left" valign= "middle" >短信设置测试<br/><span class= "full999" style= "font-size:11px;" >请填写接受测试的手机号码</span> </td> <td height= "25" align= "left" valign= "middle" > <input type= "text" value= "" name= "phonetest" class= "text phonetest" style= "width:220px" /> <?php echo '<a href="javascript:void(0)" class="sendphone">' .btn(array( 'vals' => '发送测试短信' , 'faicon' => 'commenting' , 'scene' => 'primary' , 'tips' => '点击发送系统测试短信,检测短信服务器是否调试正常' )). '</a>' ;?> </td> </tr> <tr> <td height= "25" align= "left" valign= "middle" ></td> <td height= "35" align= "left" valign= "middle" >{:btn(array( 'vals' => '确定保存' , 'size' =>3, 'type' => 'submit' , 'icon' => 'cog' , 'scene' => 'primary' ))}</td> </tr> </table> </form> |
2:打开项目:\app\Common\Common\function.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
|
//短信发送 function aliSendMsg($phone, $parame, $Msg) { if ($phone !== '' ) { $response = $ this ->sendSms($phone, $Msg); if ($response == "0" ) { return 1; } else { return 0; writelog( 'Msg' , $response); } } else { return 0; } } //短信发送 function sendmsg($phone, $msgtxt) { if ($phone != '' && $msgtxt != '' ) { $pset = M( "baseconfig" )->field( 'msguser,msgpass,msgsuff' )->where( 'Id=1' )->find(); $user = $pset[ 'msguser' ]; //短信平台帐号 $pass = md5($pset[ 'msgpass' ]); //短信平台密码 $content= "【" .$pset[ 'msgsuff' ]. "】" .$msgtxt; //要发送的短信内容 $phone = $phone; //要发送短信的手机号码 $sendurl = $smsapi. "sms?u=" .$user. "&p=" .$pass. "&m=" .$phone. "&c=" .urlencode($content); $result =file_get_contents($sendurl) ; if ($result == 0){ return 1; } else { return 0; } } else { return 0; } } |
3:打开项目:\app\Common\Model\ApiModel.class.php 修改下34行代码
1
2
3
4
5
6
7
|
$Msg = date( "m月d日 H:i:s" ). ',您本次请求的验证码为' .$code. ',请在30分钟内完成操作,感谢您使用' ; if (aliSendMsg($phone, array( 'code' =>$code),$Msg)){ cookie( "phonecode" ,md5(md5($code).$phone),(time()+1800)); return array( 'success' =>1, 'msg' => '' ); } else { return array( 'success' =>0, 'msg' => '短信验证码发送失败,请重新再试' ); } |
经过上面的替换,短信宝的短信平台已经替换成功了,可以正常使用了。
报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。
另外我们开发好的佐优家教管理系统 V2.0.2插件已经开发好了,点击此链接 下载及查看安装流程。
最新更新
电商类
CMS类
微信类