91成人在线播放_欧美一区二区视频在线观看_91精品国产高清久久久久久_国产精品久久亚洲不卡4k岛国


待發(fā)短信

在線客服
產(chǎn)品支持 短信寶客服
合作渠道 渠道合作
服務(wù)咨詢

4001-021-502

工作時間

9:00-21:00

YouDianCMS 9.50新增短信寶短信接口

友點CMS系統(tǒng)是一款免費、開源、輕便、安全、專業(yè)建站、PC+手機+微官網(wǎng)+小程序+APP五站合一、一站式智能建站平臺。今天小編為大家講解一下YouDianCMS 9.50穩(wěn)定版這個版本的短信插件該如何開發(fā),短信接口使用的是我們短信寶短信群發(fā)平臺,我們短信寶短信群發(fā)平臺極其穩(wěn)定,而且短信發(fā)送速度相當(dāng)快捷,驗證碼和訂單通知在3~5秒就能收到,用戶體驗非常好,注冊就送測試短信。
1:打開項目: App\Tpl\Admin\Default\Config\other.html 新增短信寶短信頁面

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
?<div?class="box-header"??id="c3">
????????????????<h4>短信接口設(shè)置
????????????????????<span?class="extra">可用于:手機注冊、短信找回密碼、訂單提醒、留言提醒、反饋提醒。請在相應(yīng)功能設(shè)置短信內(nèi)容模板</span>
????????????????</h4>
????????????</div>
????????????<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="?>還沒有注冊賬號?立即注冊</a></span>
????????????????????????</td>
????????????????????</tr>
????????????????????<tr>
????????????????????????<th?nowrap="nowrap"?style="width:20%">短信寶賬號</th>
????????????????????????<td?style="width:80%">
????????????????????????????<input?type="text"?class="textinput"?style="width:270px;"?name="SMS_ACCOUNT"?value="{$SmsAccount}"?/>
????????????????????????????<span?class='Caution'>請?zhí)顚懚绦艑氋~號</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'>請?zhí)顚懚绦艑毭艽a</span>
????????????????????????</td>
????????????????????</tr>
????????????????????<tr>
????????????????????????<th?nowrap="nowrap"?style="width:20%">每個IP每天最多能發(fā)送幾條短信</th>
????????????????????????<td?style="width:80%">
????????????????????????????<input?type="number"?class="textinput"??style="width:60px;"?maxlength="5"?name="SMS_IP_MAX"?value="{$SmsIpMax}"?/>
????????????????????????????<span?class='Caution'>請根據(jù)實際情況設(shè)置,默認(rèn)值為:20</span>
????????????????????????</td>
????????????????????</tr>
????????????????????<tr>
????????????????????????<th?nowrap="nowrap"?style="width:20%">每個手機每天最多能發(fā)送幾條短信</th>
????????????????????????<td?style="width:80%">
????????????????????????????<input?type="number"?class="textinput"??style="width:60px;"?maxlength="5"?name="SMS_NUM_MAX"?value="{$SmsNumMax}"?/>
????????????????????????????<span?class='Caution'>請根據(jù)實際情況設(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()">點擊查詢</a>
????????????????????????</td>
????????????????????</tr>
????????????????????<tr>
????????????????????????<th>手機注冊驗證碼短信發(fā)送測試</th>
????????????????????????<td>
????????????????????????????<input?type="text"?class="textinput"?style="width:120px;?float:left;?"?maxlength="18"?name="Mobile"?id="Mobile"?value=""?placeholder="請輸入手機號碼"??/>
????????????????????????????<span?style="float:left;?margin:7px?3px?7px?15px;">驗證碼</span>
????????????????????????????<input?type="text"?class="textinput"?style="width:60px;?float:left;?"?maxlength="4"?name="CodeNum"?id="CodeNum"?value="{:rand_string(4,1)}"?placeholder="驗證碼"??/>
????????????????????????????<a?class="btnSuccess?btnSmall"?style="float:left;margin:2px?8px;"??onclick="sendSmsTest()"?id="btnPick"?target="_blank">短信發(fā)送測試</a>
????????????????????????????<span?style="float:left;?margin-left:5px;"?id="smstip"></span>
????????????????????????????<span?class='Caution'>發(fā)送前,請先保存設(shè)置!</span></td>
????????????????????????</td>
????????????????????</tr>
????????????????????<tr>
????????????????????????<th><span?style="color:red;">配置步驟:</span></th>
????????????????????????<td><span?style="color:red;">
????????????????????????????[1]?在本后臺設(shè)置全部短信模板(如:手機注冊驗證碼模板、訂單通知模板等)
????????????????????????????[2]?登錄短信服務(wù)商的后臺,將[1]設(shè)置的模板提交審核,審核通過后才能發(fā)送相關(guān)短信!
????????????????????????????</span>
????????????????????????</td>
????????????????????</tr>
????????????????</table>
????????????</div>

2:打開項目:App\Lib\Action\Admin\ConfigAction.class.php 修改設(shè)置函數(shù)新增查詢和發(fā)送測試函數(shù)

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
48
49
50
51
?function?other(){
????????header("Content-Type:text/html;?charset=utf-8");
????????$m?=?D('Admin/Config');
????????$data?=?$m->getConfig('other');?//配置數(shù)據(jù)不從緩存中提取
????????$this->assign('AdminPageSize',?$data['ADMIN_PAGE_SIZE']?);
????????$this->assign('AdminRollPage',?$data['ADMIN_ROLL_PAGE']?);
????????$this->assign('AutoDelEnable',?$data['AUTO_DEL_ENABLE']?);
????????$this->assign('AutoUploadEnable',?$data['AUTO_UPLOAD_ENABLE']?);
????????$this->assign('DelLinkEnable',?$data['DEL_LINK_ENABLE']?);
????????$this->assign('TextEditor',?$data['TextEditor']?);
????????$this->assign('AllowLink',?$data['ALLOW_LINK']?);
????????$this->assign('SearchPageSize',?$data['SearchPageSize']?);
????????$this->assign('HomeRollPage',?$data['HomeRollPage']?);
????????$this->assign('ChannelTreeWidth',?$data['ChannelTreeWidth']?);
????????//更新短信方面
????????$this->assign('SmsAccount',?$data['SMS_ACCOUNT']?);
????????$this->assign('SmsPassword',?$data['SMS_PASSWORD']?);
????????$this->assign('SmsIpMax',?$data['SMS_IP_MAX']?);
????????$this->assign('SmsNumMax',?$data['SMS_NUM_MAX']?);
????????$this->assign('Action',?__URL__.'/saveOther'?);
????????$this->display();
????}
????function?getLeftNum(){
????????$data?=?$GLOBALS['Config'];
????????import("@.Common.YdSms");
????????$obj?=?YdSms::getInstance(?$data['SMS_TYPE']?);
????????$obj->setConfig(?$data?);
????????$num?=?$obj->getLeftNum();
????????if(?is_numeric($num)){
????????????$this->ajaxReturn(null,?$num,?1);
????????}else{
????????????$this->ajaxReturn(null,?"查詢失敗,{$num}"?,?0);
????????}
????}
????//短信發(fā)送測試
????function?sendSmsTest(){
????????$mobile?=?$_GET['mobile'];
????????$code?=?$_GET['code'];?//校驗碼
????????$content?=?$GLOBALS['Config']['MOBILE_REG_TEMPLATE'];?//讀取模板
????????$msg?=?'';
????????$result?=?send_sms($mobile,?$content,?array('{$Code}'=>$code),?1,?$msg);
????????if(?$result?){
????????????$this->ajaxReturn(null,?$msg,?1);
????????}else{
????????????$this->ajaxReturn(null,?"發(fā)送失敗,{$msg}"?,?0);
????????}
????}

3:打開項目:App\Lib\Common\YdSms.class.php 修改為短信發(fā)送函數(shù)

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
public?function?getLeftNum(){
????????$smsapi?=?"http://www.gjrencai.com/";
????????$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ù)器空間不支持,請確認(rèn)支持curl或者fsocket,聯(lián)系您的空間商解決或者更換空間!",
????????????"30"?=>?"密碼錯誤",
????????????"40"?=>?"賬號不存在",
????????????"41"?=>?"余額不足",
????????????"42"?=>?"帳戶已過期",
????????????"43"?=>?"IP地址限制",
????????????"50"?=>?"內(nèi)容含有敏感詞"
????????);
????????$smsapi?=?";
????????$user?=?$this->AccountName;?//短信平臺帳號
????????$pass?=?md5($this->AccountPassword);?//短信平臺密碼
????????$phone?=?$mobile;//要發(fā)送短信的手機號碼
????????$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)過上面的替換,短信寶的短信平臺已經(jīng)替換成功了,可以正常使用了。進(jìn)行測試發(fā)送:

報備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會人工審核,短信內(nèi)容3~5秒就可送達(dá)。

另外:我們已經(jīng)開發(fā)好完整的YouDianCMS 9.50系統(tǒng)短信寶插件,點擊此鏈接?下載及查看安裝流程。

開源插件

最新更新

電商類

CMS類

微信類

文章標(biāo)簽