微擎是一款免費(fèi)開(kāi)源的公眾平臺(tái)管理系統(tǒng),基于web2.0技術(shù)架構(gòu),他有很多的擴(kuò)展模塊,二次開(kāi)發(fā)也非常方便,小編最近發(fā)現(xiàn)微擎升級(jí)到了2.7.4版本,今天小編就以微擎2.7.4版本的替換短信接口為例告訴大家如何進(jìn)行二次開(kāi)發(fā),使用的短信接口是我們短信寶短信群發(fā)平臺(tái)的接口,我們短信寶短信群發(fā)平臺(tái)非常穩(wěn)定,發(fā)送速度快,注冊(cè)就送測(cè)試短信,推薦大家使用
1:打開(kāi)項(xiàng)目:\web\themes\default\system\user-setting.html 新增短信寶接口頁(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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
{template 'common/header' } {template 'system/user-setting-header' } <form action= "" method= "post" class= "we7-form" > { if $ do == 'login' } <div id= "login" > <div class= "form-group" > <label class= "col-sm-2 control-label" style= "text-align:left;" >圖形驗(yàn)證碼</label> <div class= "col-sm-8 form-control-static" > <input type= "radio" id= "verifycode-1" name= "verifycode" { if $settings[ 'verifycode' ] == 1} checked= "checked" {/ if } value= "1" /> <label class= "radio-inline" for = "verifycode-1" > 開(kāi)啟 </label> <input type= "radio" id= "verifycode-0" name= "verifycode" { if $settings[ 'verifycode' ] == 0} checked= "checked" {/ if } value= "0" /> <label class= "radio-inline" for = "verifycode-0" > 關(guān)閉 </label> <span class= "help-block" > 開(kāi)啟后,用戶登錄需要輸入圖形驗(yàn)證碼</span> </div> </div> <div class= "form-group" > <label class= "col-sm-2 control-label" style= "text-align:left;" >用戶首頁(yè)設(shè)置</label> <div class= "col-sm-8" > <select name= "welcome_link" class= "form-control" > <option value= "{WELCOME_DISPLAY_TYPE}" { if $settings[ 'welcome_link' ]==WELCOME_DISPLAY_TYPE}selected{/ if }>用戶歡迎頁(yè)</option> <option value= "{PLATFORM_DISPLAY_TYPE}" { if $settings[ 'welcome_link' ]==PLATFORM_DISPLAY_TYPE}selected{/ if }>平臺(tái)</option> </select> <div class= "help-block" >統(tǒng)一設(shè)置用戶登錄后跳轉(zhuǎn)的頁(yè)面,用戶也可以自行設(shè)置,以用戶設(shè)置的為準(zhǔn)</div> </div> </div> </div> {/ if } { if $ do == 'binding' } <div id= "binding" > <div class= "form-group" > <label class= "col-sm-2 control-label" style= "text-align:left;" >強(qiáng)制綁定信息</label> <div class= "col-sm-8 form-control-static" > <input type= "radio" id= "bind_status-0" name= "bind" value= "" { if empty($settings[ 'bind' ])}checked{/ if }/> <label class= "radio-inline" for = "bind_status-0" > 無(wú) </label> <input type= "radio" id= "bind_status-1" name= "bind" value= "qq" { if $settings[ 'bind' ] == 'qq' }checked{/ if }/> <label class= "radio-inline" for = "bind_status-1" > qq </label> <input type= "radio" id= "bind_status-2" name= "bind" value= "wechat" { if $settings[ 'bind' ] == 'wechat' }checked{/ if }/> <label class= "radio-inline" for = "bind_status-2" > 微信 </label> <input type= "radio" id= "bind_status-3" name= "bind" value= "mobile" { if $settings[ 'bind' ] == 'mobile' }checked{/ if }/> <label class= "radio-inline" for = "bind_status-3" > 手機(jī)號(hào) </label> <span class= "help-block" > 選擇后,用戶登錄后,將強(qiáng)制綁定所選方式</span> </div> </div> <div class= "form-group" > <label class= "col-sm-2 control-label" style= "text-align:left;" >第三方登錄入口</label> <div class= "col-sm-8 form-control-static" > <input type= "radio" name= "oauth_bind" id= "oauth_bind-1" value= "1" { if $settings[ 'oauth_bind' ] == 1}checked{/ if } /> <label class= "radio-inline" for = "oauth_bind-1" > 是 </label> <input type= "radio" name= "oauth_bind" id= "oauth_bind-0" value= "0" { if $settings[ 'oauth_bind' ] == 0}checked{/ if }/> <label class= "radio-inline" for = "oauth_bind-0" > 否 </label> <div class= "help-block" >開(kāi)啟后,登錄頁(yè)面顯示第三方登錄入口,可以登錄已關(guān)聯(lián)賬戶或注冊(cè)新帳號(hào)</div> </div> </div> </div> {/ if } { if $ do == 'sms' } <div id= "sms" > <div class= "form-group" > <label class= "col-sm-2 control-label" style= "text-align:left;" >短信寶賬號(hào)</label> <div class= "col-sm-8" > <input type= "text" name= "sms_name" class= "form-control" value= "{$settings['sms_name']}" /> <span class= "help-block" >沒(méi)有短信寶賬號(hào)?點(diǎn)擊<a class= "btn btn-primary span3" target= "_blank" href= "http://www.gjrencai.com" >免費(fèi)注冊(cè)</a></span> </div> </div> <div class= "form-group" > <label class= "col-sm-2 control-label" style= "text-align:left;" >短信寶密碼</label> <div class= "col-sm-8" > <input type= "password" name= "sms_password" class= "form-control" value= "{$settings['sms_password']}" /> </div> </div> <div class= "form-group" > <label class= "col-sm-2 control-label" style= "text-align:left;" >短信簽名</label> <div class= "col-sm-8" > <input type= "text" name= "sms_sign" class= "form-control" value= "{$settings['sms_sign']}" /> </div> </div> </div> {/ if } <input type= "submit" name= "submit" value= "提交" class= "btn btn-primary" style= "padding: 6px 50px;" > <input type= "hidden" name= "token" value= "{$_W['token']}" /> </form> {template 'common/footer' } |
2:打開(kāi)項(xiàng)目:\web\source\utility\verifycode.ctrl.php 修改下send_code 方法
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
|
if ( 'send_code' == $ do ) { $verifycode_table = table( 'uni_verifycode' ); $row = $verifycode_table->getByReceiverVerifycode($_W[ 'uniacid' ], $receiver, '' ); $record = array(); $code = random(6, true ); if (!empty($row)) { $imagecode = intval($_GPC[ 'imagecode' ]); $failed_count = table( 'uni_verifycode' )->getFailedCountByReceiver($receiver); if ($need_checkcaptcha && $failed_count >= 3) { if (empty($imagecode)) { iajax(-3, '請(qǐng)輸入圖形驗(yàn)證碼!' ); } if (!checkcaptcha($imagecode)) { iajax(-1, '圖形驗(yàn)證碼錯(cuò)誤!' ); } } if ($row[ 'total' ] >= 5) { iajax(-1, '您的操作過(guò)于頻繁,請(qǐng)稍后再試' ); } $record[ 'total' ] = $row[ 'total' ] + 1; } else { $record[ 'uniacid' ] = $_W[ 'uniacid' ]; $record[ 'receiver' ] = $receiver; $record[ 'total' ] = 1; } $record[ 'verifycode' ] = $code; $record[ 'createtime' ] = TIMESTAMP; if (!empty($row)) { pdo_update( 'uni_verifycode' , $record, array( 'id' => $row[ 'id' ])); } else { pdo_insert( 'uni_verifycode' , $record); } if ( 'email' == $receiver_type) { load()->func( 'communication' ); $content = "您的郵箱驗(yàn)證碼為: {$code} 您正在使用{$uniacid_arr['name']}相關(guān)功能, 需要你進(jìn)行身份確認(rèn)." ; $result = ihttp_email($receiver, "{$uniacid_arr['name']}身份確認(rèn)驗(yàn)證碼" , $content); } else { load()->model( 'cloud' ); $r = cloud_prepare(); if (is_error($r)) { iajax(-1, $r[ 'message' ]); } $setting = uni_setting($_W[ 'uniacid' ], 'notify' ); $content = "您的短信驗(yàn)證碼為: {$code} 您正在使用{$uniacid_arr['name']}相關(guān)功能, 需要你進(jìn)行身份確認(rèn)" ; $result = cloud_sms_send($receiver, $content, array(), $custom_sign); /* $postdata = array('verify_code' => $code, 'module' => $uniacid_arr['name']); $result = cloud_sms_send($receiver, '800002', $postdata, $custom_sign); */ } if (is_error($result)) { iajax(-1, $result[ 'message' ]); } iajax(0, '短信發(fā)送成功!' ); } |
3:打開(kāi)項(xiàng)目:\web\source\system\usersetting.ctrl.php 在16行左右新增短信配置
1
2
3
4
5
6
7
8
9
10
11
|
if ($ do == 'sms' ) { $_W[ 'page' ][ 'title' ] = '短信配置' ; if (checksubmit( 'submit' )) { $settings[ 'sms_name' ] = $_GPC[ 'sms_name' ]; $settings[ 'sms_password' ] = $_GPC[ 'sms_password' ]; $settings[ 'sms_sign' ] = $_GPC[ 'sms_sign' ]; setting_save($settings, 'copyright' ); itoast( '更新設(shè)置成功!' , '' , 'success' ); } } |
4:打開(kāi)項(xiàng)目:\web\source\system\ 新增user-setting-header.html
1
2
3
4
5
6
7
|
<ul class= "we7-page-tab" > <!--<li { if $type == 'system' }class= "active" {/ if }><a href= "{php echo url('system/thirdlogin', array('type' => 'system'))}" >系統(tǒng)登錄</a></li>--> <li { if $action == 'registerset' && $ do == 'display' }class= "active" {/ if }><a href= "{php echo url('user/registerset/display');}" >登錄/注冊(cè)設(shè)置</a></li> <li { if $action == 'thirdlogin' }class= "active" {/ if }><a href= "{php echo url('system/thirdlogin')}" >第三方配置</a></li> <li { if $ do == 'clerk' }class= "active" {/ if }><a href= "{php echo url('user/registerset/clerk')}" >應(yīng)用操作員登錄/注冊(cè)設(shè)置</a></li> <li { if $ do == 'sms' }class= "active" {/ if }><a href= "{php echo url('system/usersetting', array('do' => 'sms'))}" >短信配置</a></li> </ul> |
經(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ā)好完整的微擎V_2.7.4系統(tǒng)短信寶插件,點(diǎn)擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類