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


待發(fā)短信

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

4001-021-502

工作時(shí)間

9:00-21:00

微擎框架系統(tǒng)新增短信寶短信接口

微擎是一款免費(fèi)開(kāi)源的公眾平臺(tái)管理系統(tǒng),基于web2.0技術(shù)架構(gòu),他有很多的擴(kuò)展模塊,二次開(kāi)發(fā)也非常方便,小編對(duì)于這套系統(tǒng)還是比較了解的,今天小編就以微擎_1.8版本的替換短信接口為例告訴大家如何進(jìn)行二次開(kāi)發(fā),使用的短信接口是我們短信寶短信群發(fā)平臺(tái)的接口,我們短信寶短信群發(fā)平臺(tái)非常穩(wěn)定,發(fā)送速度快,注冊(cè)就送測(cè)試短信,推薦大家使用。

首先我們打開(kāi)項(xiàng)目:\web\themes\default\system\user-setting.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
{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}

接著在項(xiàng)目:\web\themes\default\system\user-setting-header.html文件中添加以下代碼

?
1
<li {if $do == 'sms'}class="active"{/if}><a href="{php echo url('system/usersetting', array('do' => 'sms'))}">短信配置</a></li>

接著打開(kāi)項(xiàng)目:\web\source\system\usersetting.ctrl.php 文件替換8~28行代碼

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$dos array('login''binding','sms');
$do = in_array($do$dos) ? $do 'login';
 
$settings $_W['setting']['copyright'];
if(empty($settings) || !is_array($settings)) {
 $settings array();
else {
 $settings['slides'] = iunserializer($settings['slides']);
}
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');
    }
}

最后我們打開(kāi)項(xiàng)目:\framework\model\cloud.mod.php 文件,替換cloud_sms_send方法

?
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
function cloud_sms_send($mobile$content$postdata array(), $custom_sign '') {
        global $_W;
        
        if(!preg_match('/^1\d{10}$/'$mobile) || empty($content)) {
                return error(1, '發(fā)送短信失敗, 原因: 手機(jī)號(hào)錯(cuò)誤或內(nèi)容為空.');
        }
        
 if (empty($_W['uniacid'])) {
  $sms_info = cloud_sms_info();
  $balance empty($sms_info['sms_count']) ? 0 : $sms_info['sms_count'];
  if (!empty($custom_sign)) {
   $sign $custom_sign;
   
  }
 
 else {
        $row = pdo_get('uni_settings' array('uniacid' => $_W['uniacid']), array('notify'));
        $row['notify'] = @iunserializer($row['notify']);
 
        $config $row['notify']['sms'];
        $balance intval($config['balance']);
        
        $sign $config['signature'];
 }
        if(empty($sign)) {
                $sign '短信寶';
        }
        //判斷剩余條數(shù)
      if($balance<1){
                return error(-1, '短信發(fā)送失敗, 原因:余額不足');
        
        //短信寶賬號(hào)
       // $smsbao_info=pdo_get('uni_settings' , array('uniacid' => $_W['uniacid']), array('copyright'));
  //$smsbao_info=setting_load($key = 'copyright');
        $sms_param['u']=$_W['setting']['copyright']['sms_name'];
        $sms_param['p']=md5($_W['setting']['copyright']['sms_password']);
        $sms_param['m']=$mobile;
        $sms_param['c']="【".$_W['setting']['copyright']['sms_sign']."】".$content;
  $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)容含有敏感詞"
        );
        $response file_get_contents("http://api.smsbao.com/sms?".http_build_query($sms_param));
        if (trim($response)!='0') {
                return error($response'短信發(fā)送失敗, 原因:'.$statusStr[$response]);
        }
 
        if (trim($response)=='0') {
           if (!empty($_W['uniacid'])) {   
                $row['notify']['sms']['balance'] = $row['notify']['sms']['balance'] - 1;
                if ($row['notify']['sms']['balance'] < 0) {
                        $row['notify']['sms']['balance'] = 0;
                }
                pdo_update('uni_settings'array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid']));
                uni_setting_save('notify'$row['notify']);
     }
 
        }
 return true;
}

經(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ā)好完整的微擎系統(tǒng)短信寶插件,點(diǎn)擊此鏈接 下載及查看安裝流程。

開(kāi)源插件

最新更新

電商類(lèi)

CMS類(lèi)

微信類(lèi)

文章標(biāo)簽