友點(diǎn)CMS系統(tǒng)是一款免費(fèi)、開(kāi)源、輕便、安全、專業(yè)建站、PC+手機(jī)+微官網(wǎng)+小程序+APP五站合一、一站式智能建站平臺(tái)。今天小編為大家講解一下YouDianCMS 9.31穩(wěn)定版這個(gè)版本的短信插件該如何開(kāi)發(fā),短信接口使用的是我們短信寶短信群發(fā)平臺(tái),我們短信寶短信群發(fā)平臺(tái)極其穩(wěn)定,而且短信發(fā)送速度相當(dāng)快捷,驗(yàn)證碼和訂單通知在3~5秒就能收到,用戶體驗(yàn)非常好,注冊(cè)就送測(cè)試短信。
1:打開(kāi)項(xiàng)目:App\Tpl\Admin\Default\Config\other.html 修改為短信寶設(shè)置頁(yè)面
|
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
|
<div class="box-content"> <table class="boxtable"> <tr> <th nowrap="nowrap" style="width:20%">短信寶</th> <td style="width:80%"> <select name="SMS_TYPE"> <option value="Huyi">短信寶</option> </select> <span style="color:#F30; padding-left:3px;"><a target="_blank" href="https://smsbao.com/reg" >還沒(méi)有注冊(cè)賬號(hào)?立即注冊(cè)</a></span> </td> </tr> <tr> <th nowrap="nowrap" style="width:20%">短信寶賬號(hào)</th> <td style="width:80%"> <input type="text" class="textinput" style="width:270px;" name="SMS_ACCOUNT" value="{$SmsAccount}" /> <span class='Caution'>請(qǐng)?zhí)顚懚绦艑氋~號(hào)</span></td> </td> </tr> <tr> <th nowrap="nowrap" style="width:20%">短信寶密碼</th> <td style="width:80%"> <input type="text" class="textinput" style="width:270px;" name="SMS_PASSWORD" value="{$SmsPassword}" /> <span class='Caution'>請(qǐng)?zhí)顚懚绦艑毭艽a</span> </td> </tr> <tr> <th nowrap="nowrap" style="width:20%">每個(gè)IP每天最多能發(fā)送幾條短信</th> <td style="width:80%"> <input type="text" class="textinput" style="width:50px;" maxlength="5" name="SMS_IP_MAX" value="{$SmsIpMax}" /> <span class='Caution'>請(qǐng)根據(jù)實(shí)際情況設(shè)置,默認(rèn)值為:20</span> </td> </tr> <tr> <th nowrap="nowrap" style="width:20%">每個(gè)手機(jī)每天最多能發(fā)送幾條短信</th> <td style="width:80%"> <input type="text" class="textinput" style="width:50px;" maxlength="5" name="SMS_NUM_MAX" value="{$SmsNumMax}" /> <span class='Caution'>請(qǐng)根據(jù)實(shí)際情況設(shè)置,默認(rèn)值為:60</span> </td> </tr> <tr> <th nowrap="nowrap" style="width:20%">剩余短信條數(shù)</th> <td style="width:80%; padding:8px 0;"> <span id="leftnum" style="font-weight:bold;color:blue; margin-right:8px;"></span> <a class="btnSuccess btnSmall" onclick="getLeftNum()">點(diǎn)擊查詢</a> </td> </tr> |
2:打開(kāi)項(xiàng)目 App\Lib\Common\YdSms.class.php 修改成短信寶發(fā)送接口
|
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
|
public function getLeftNum(){ $sendurl = $smsapi."query?u=".$this->AccountName."&p=".md5($this->AccountPassword); $result =file_get_contents($sendurl) ; $result = explode(',',$result); $num = $result[1] ? $result[1] : ''; if($num > 0 ){ return $num; }else{ return $num; } } public function sendNotifyMessage($mobile, $content){ if( !$this->check($mobile) ) { $this->writeLog($mobile, $content, "發(fā)送失敗,".$this->Message); return false; } $content = $this->parsePlaceholder($content); $statusStr = array( "0" => "短信發(fā)送成功", "-1" => "參數(shù)不全", "-2" => "服務(wù)器空間不支持,請(qǐng)確認(rèn)支持curl或者fsocket,聯(lián)系您的空間商解決或者更換空間!", "30" => "密碼錯(cuò)誤", "40" => "賬號(hào)不存在", "41" => "余額不足", "42" => "帳戶已過(guò)期", "43" => "IP地址限制", "50" => "內(nèi)容含有敏感詞" ); $user = $this->AccountName; //短信平臺(tái)帳號(hào) $pass = md5($this->AccountPassword); //短信平臺(tái)密碼 $phone = $mobile;//要發(fā)送短信的手機(jī)號(hào)碼 $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content); $result =file_get_contents($sendurl) ; $this->Message = $statusStr[$result]; if( $result == 0 ){ $this->writeLog($mobile, $content, $statusStr[$result]); return true; }else{ $this->writeLog($mobile, $content, "發(fā)送失敗,".$statusStr[$result]); return false; } } |
經(jīng)過(guò)上面的替換,短信寶的短信平臺(tái)已經(jīng)替換成功了,可以正常使用了。進(jìn)行測(cè)試發(fā)送:
報(bào)備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會(huì)人工審核,短信內(nèi)容3~5秒就可送達(dá)。
另外:我們已經(jīng)開(kāi)發(fā)好完整的YouDianCMSV9.31系統(tǒng)短信寶插件,點(diǎn)擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類