微擎是一款免費開源的公眾平臺管理系統,基于web2.0技術架構,他有很多的擴展模塊,二次開發也非常方便。超級粉絲社區是微擎應用市場中唯一支持樂視云直播和騰訊云直播的系統模塊的社區系統。小編對他還是很了解,今天小編就以替換短信接口為例告訴大家如何進行二次開發,我們講解的是V6.7版本,使用的短信接口是我們短信寶短信群發平臺的接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
1:打開項目:addons\sunshine_huayue\template\set_alidayu.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
|
<div class= "container-fluid" > <h4><span class= 'glyphicon glyphicon-circle-arrow-right' ></span> 總消息模板開關</h4> <div class= "row" > <div class= "col-md-6" > <label>開關</label> { if $ this ->settings[ 'alidayu_key' ] == 'open' } <button class= "form-control btn btn-sm btn-success" onclick= "doSave('alidayu_key','close')" >已開啟短信發送</button> { else } <button class= "form-control btn btn-sm btn-danger" onclick= "doSave('alidayu_key','open')" >已關閉短信發送</button> {/ if } <p class= "help-block" >控制是否開啟短信發送,開啟后請務必配置好下面設置項</p> </div> </div> <br> <!-- 短信配置--> <h4><span class= 'glyphicon glyphicon-circle-arrow-right' ></span> 短信配置</h4> <div class= "row" > <div class= "col-md-6" > <label>短信寶用戶名</label> <input type= "text" class= "form-control" value= "{php echo $this->settings['alidayu_ak']}" id= 'alidayu_ak' placeholder= '' > <p class= "help-block" ></p> <button class= "btn btn-sm btn-info" onclick= "doSave('alidayu_ak')" >保存</button> <br> </div> </div> <br> <div class= "row" > <div class= "col-md-6" > <label>短信寶密碼</label> <input type= "text" class= "form-control" value= "{php echo $this->settings['alidayu_sk']}" id= 'alidayu_sk' placeholder= '' > <p class= "help-block" ></p> <button class= "btn btn-sm btn-info" onclick= "doSave('alidayu_sk')" >保存</button> <br> </div> </div> <br> <div class= "row" > <div class= "col-md-6" > <label>短信模板</label> <input type= "text" class= "form-control" value= "{php echo $this->settings['alidayu_tpl_id']}" id= 'alidayu_tpl_id' placeholder= '' > <p class= "help-block" >請保證短信模板中的變量為${product}和${code},其他變量將導致發送失敗</p> <button class= "btn btn-sm btn-info" onclick= "doSave('alidayu_tpl_id')" >保存</button> <br> </div> </div> <br> <div class= "row" > <div class= "col-md-6" > <label>短信寶簽名</label> <input type= "text" class= "form-control" value= "{php echo $this->settings['alidayu_sign_name']}" id= 'alidayu_sign_name' placeholder= '' > <p class= "help-block" ></p> <button class= "btn btn-sm btn-info" onclick= "doSave('alidayu_sign_name')" >保存</button> <br> </div> </div> <br> |
2:打開項目:addons\sunshine_huayue\Component\SmsComponent.class.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
|
<?php class SmsComponent { static function sendCaptcha($mobile,$captcha,$openid = '' ) { include dirname(dirname(__FILE__)). '/plugin/alidayu/TopSdk.php' ; $settings_product = sunshine_huayueModuleSite::$_SET[ 'alidayu_product' ]; $settings_product = $settings_product ? $settings_product : '快來租我' ; $content = str_replace([ '${product}' , '${code}' ],[ "$settings_product" , "$captcha" ],sunshine_huayueModuleSite::$_SET[ 'alidayu_tpl_id' ]); $statusStr = array( "0" => "短信發送成功" , "-1" => "參數不全" , "-2" => "服務器空間不支持,請確認支持curl或者fsocket,聯系您的空間商解決或者更換空間!" , "30" => "密碼錯誤" , "40" => "賬號不存在" , "41" => "余額不足" , "42" => "帳戶已過期" , "43" => "IP地址限制" , "50" => "內容含有敏感詞" ); $user = sunshine_huayueModuleSite::$_SET[ 'alidayu_ak' ]; //短信平臺帳號 $pass = md5(sunshine_huayueModuleSite::$_SET[ 'alidayu_sk' ]); //短信平臺密碼 $content= "【" .sunshine_huayueModuleSite::$_SET[ 'alidayu_sign_name' ]. "】" .$content; $phone = $mobile; //要發送短信的手機號碼 $sendurl = $smsapi. "sms?u=" .$user. "&p=" .$pass. "&m=" .$phone. "&c=" .urlencode($content); $result =file_get_contents($sendurl); WeUtility::logging( 'sunshine_huayue_SmsComponent' , var_export($result, true )); if ($result == '0' ) { return true ; } else { return false ; } } } |
經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的超級粉絲社區V6.7系統系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類