微擎是一款免費(fèi)開(kāi)源的公眾平臺(tái)管理系統(tǒng),基于web2.0技術(shù)架構(gòu),他有很多的擴(kuò)展模塊,二次開(kāi)發(fā)也非常方便。超級(jí)粉絲社區(qū)是微擎應(yīng)用市場(chǎng)中唯一支持樂(lè)視云直播和騰訊云直播的系統(tǒng)模塊的社區(qū)系統(tǒng)。小編對(duì)他還是很了解,今天小編就以替換短信接口為例告訴大家如何進(jìn)行二次開(kāi)發(fā),我們講解的是V6.7版本,使用的短信接口是我們短信寶短信群發(fā)平臺(tái)的接口,我們短信寶短信群發(fā)平臺(tái)非常穩(wěn)定,發(fā)送速度快,注冊(cè)就送測(cè)試短信,推薦大家使用。
1:打開(kāi)項(xiàng)目: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> 總消息模板開(kāi)關(guān)</h4> <div class="row"> <div class="col-md-6"> <label>開(kāi)關(guān)</label> {if $this->settings['alidayu_key'] == 'open'} <button class="form-control btn btn-sm btn-success" onclick="doSave('alidayu_key','close')">已開(kāi)啟短信發(fā)送</button> {else} <button class="form-control btn btn-sm btn-danger" onclick="doSave('alidayu_key','open')">已關(guān)閉短信發(fā)送</button> {/if} <p class="help-block">控制是否開(kāi)啟短信發(fā)送,開(kāi)啟后請(qǐng)務(wù)必配置好下面設(shè)置項(xiàng)</p> </div> </div> <br> <!-- 短信配置--> <h4><span class='glyphicon glyphicon-circle-arrow-right'></span> 短信配置</h4> <div class="row"> <div class="col-md-6"> <label>短信寶用戶(hù)名</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">請(qǐng)保證短信模板中的變量為${product}和${code},其他變量將導(dǎo)致發(fā)送失敗</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:打開(kāi)項(xiàng)目: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
|
<?phpclass 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 : '快來(lái)租我'; $content = str_replace(['${product}','${code}'],["$settings_product","$captcha"],sunshine_huayueModuleSite::$_SET['alidayu_tpl_id']); $statusStr = array( "0" => "短信發(fā)送成功", "-1" => "參數(shù)不全", "-2" => "服務(wù)器空間不支持,請(qǐng)確認(rèn)支持curl或者fsocket,聯(lián)系您的空間商解決或者更換空間!", "30" => "密碼錯(cuò)誤", "40" => "賬號(hào)不存在", "41" => "余額不足", "42" => "帳戶(hù)已過(guò)期", "43" => "IP地址限制", "50" => "內(nèi)容含有敏感詞" ); $user = sunshine_huayueModuleSite::$_SET['alidayu_ak']; //短信平臺(tái)帳號(hào) $pass = md5(sunshine_huayueModuleSite::$_SET['alidayu_sk']); //短信平臺(tái)密碼 $content="【".sunshine_huayueModuleSite::$_SET['alidayu_sign_name']."】".$content; $phone = $mobile;//要發(fā)送短信的手機(jī)號(hào)碼 $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; } }} |
經(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ā)好完整的超級(jí)粉絲社區(qū)V6.7系統(tǒng)系統(tǒng)短信寶插件,點(diǎn)擊此鏈接 下載及查看安裝流程。
最新更新
電商類(lèi)
CMS類(lèi)
微信類(lèi)