佐優家教管理系統是立足于互聯網,面向廣大家教教員及學員提供專業家教服務的管理平臺,小編對于這套系統還是比較了解的。今天就以替換短信接口為例告訴大家如何進行二次開發,使用的短信接口是我們短信寶短信群發平臺的接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
首頁我們打開項目:\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.gjrencai.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類
微信類