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


待發短信

在線客服
產品支持 短信寶客服
合作渠道 渠道合作
服務咨詢

4001-021-502

工作時間

9:00-21:00

獨立版-啦啦外賣45.6新增短信寶短信接口

啦啦外賣跑腿是一款用PHP+MYSQL開發的一套外賣跑腿送餐系統,是一款非常不錯的系統,小編今天就以替換短信接口為例帶大家進行二次開發,我們使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用
1:打開項目:addons\we7_wmall\template\web\config\sms.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
<div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-2 control-label">短信/語音平臺</label>
        <div class="col-sm-9 col-xs-12">
            <div class="radio radio-inline" onclick="$('.setting-aliyun').show(); $('.setting-smsbao').hide(); $('.apply-aliyun').show(); $('.apply-smsbao').hide();">
                <input type="radio" value="aliyun" name="type" id="type-aliyun" {if $sms['type'] == 'aliyun' || !$sms['type']}checked{/if} required="true">
                <label for="type-aliyun">阿里云</label>
                <div></div>
            </div>
            <div class="radio radio-inline" onclick="$('.setting-smsbao').show(); $('.setting-aliyun').hide(); $('.apply-smsbao').show(); $('.apply-aliyun').hide();">
                <input type="radio" value="smsbao" name="type" id="type-smsbao" {if $sms['type'] == 'smsbao'}checked{/if} required="true">
                <label for="type-smsbao">短信寶</label>
            </div>
            <div class="apply-aliyun" {if $sms['type'] == 'aliyun' || !$sms['type']}style="display: block;"{else}style="display: none;"{/if}>
                <div class="help-block">
                    <a href=" target="_blank">立即申請 "阿里云"短信平臺</a>
                </div>
            </div>
            <div class="apply-smsbao" {if $sms['type'] == 'smsbao'}style="display: block;"{else}style="display: none;"{/if}>
                <div class="help-block">
                    <a href="http://www.gjrencai.com/" target="_blank">立即申請 "短信寶"消息&短信服務</a>
                </div>
                <div class="help-block">
                    <a href="http://www.gjrencai.com/" target="_blank">立即申請 "短信寶"語音通話服務</a>
                </div>
            </div>
        </div>
    </div>
<div class="setting-smsbao" {if $sms['type'] == 'smsbao'}style="display: block;"{else}style="display: none;"{/if}>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">短信寶賬號</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" class="form-control" name="app_key" value="{$sms['smsbao']['app_key']}">
                <span class="help-block">還沒有短信賬號? <a href=" target="_blank">現在去創建</a></span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">短信寶密碼</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" class="form-control" name="app_secret" value="{$sms['smsbao']['app_secret']}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">短信簽名</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" class="form-control" name="signature" value="{$sms['smsbao']['signature']}">
                <span class="help-block">請填寫短信簽名.</span>
            </div>
        </div>
    </div>

2:打開項目:addons\we7_wmall\inc\web\config\sms.inc.php修改保存方法大概19行

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
if ($op == "set") {
    $_W["page"]["title"] = "短信平臺";
    if ($_W["ispost"]) {
        $type = trim($_GPC["type"]);
        if (!in_array($type, array("aliyun","smsbao"))) {
            imessage(error(-1, "請選擇短信/語音平臺"), """ajax");
        }
        if ($type == "smsbao") {
            intval($_GPC["status"]);
            trim($_GPC["app_key"]);
            trim($_GPC["app_secret"]);
            trim($_GPC["signature"]);
            $sms = array("status" => intval($_GPC["status"]), "type" => $type, "smsbao" => array("app_key" => trim($_GPC["app_key"]), "app_secret" => trim($_GPC["app_secret"]), "signature" => trim($_GPC["signature"])));
        else {
            if ($type == "aliyun") {
                intval($_GPC["status"]);
                intval($_GPC["version"]);
                trim($_GPC["key"]);
                trim($_GPC["secret"]);
                trim($_GPC["sign"]);
                $sms = array("status" => intval($_GPC["status"]), "type" => $type, "version" => intval($_GPC["version"]), "key" => trim($_GPC["key"]), "secret" => trim($_GPC["secret"]), "sign" => trim($_GPC["sign"]));
            }
        }
        set_system_config('sms.set', $sms);
        imessage(error(0, '短信平臺設置成功'), ireferer(), 'ajax');
    }
    $sms = $_config["sms"]["set"];
}

3:打開項目:addons\we7_wmall\inc\mobile\system\common\code.inc.php 修改為短信寶發送類型

1
2
3
4
5
6
7
8
if (is_error($result)) {
    if ($config_sms["set"]["type"] == "smsbao") {
        slog("huaweiSms""短信寶短信通知驗證碼", $content, $result["message"]);
    else {
        slog('alidayuSms''阿里大魚短信通知驗證碼', $content, $result["message"]);
    }
    exit($result["message"]);
}

4:打開項目:addons\we7_wmall\class\sms.class.php 修改大概25行 增加短信寶類

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public static function create($type = "", $scene = "code")
{
    global $_W;
    if (empty($type)) {
        if ($scene == "yinsihao") {
            $config = get_plugin_config("yinsihao.basic");
        else {
            $config = $_W["we7_wmall"]["config"]["sms"]["set"];
        }
        $type = !empty($config["type"]) ? $config["type"] : "aliyun";
    }
    if ($type == "smsbao") {
        mload()->classs("smsbao.sms");
        return new SmsbaoSms();
    }
    if (check_plugin_perm('iglobal') && $_W["we7_wmall"]["config"]["iglobal"]["sms_type"] == 1) {
        mload()->classs("aliglobal.sms");
        return new AliGlobalSms();
    }
    mload()->classs('aliyun.sms');
    return new AliyunSms();
}

5:打開項目:addons\we7_wmall\class 當前目錄增加smsbao.sms.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
defined('IN_IA') or exit('Access Denied');
load()->func('communication');
 
class SmsbaoSms{
 
    public function __construct() {
 
    }
 
    public function sendCode($template, $mobile, $content, $sid) {
        global $_W;
        $config_sms = $_W['we7_wmall']['config']['sms'];
        if(!is_array($config_sms['set'])) {
            return error(-1, '平臺沒有設置短信參數');
        }
        if(empty($config_sms['set']['status'])) {
            return error(-1, '平臺已關閉短信功能');
        }
        $appKey = $config_sms['set']['smsbao']['app_key'];
        $appSecret = $config_sms['set']['smsbao']['app_secret'];
        $signature = $config_sms['set']['smsbao']['signature'];
        $statusStr = array(
            "0" => "短信發送成功",
            "-1" => "參數不全",
            "-2" => "服務器空間不支持,請確認支持curl或者fsocket,聯系您的空間商解決或者更換空間!",
            "30" => "密碼錯誤",
            "40" => "賬號不存在",
            "41" => "余額不足",
            "42" => "帳戶已過期",
            "43" => "IP地址限制",
            "50" => "內容含有敏感詞"
        );
        $smsapi = ';
        $user = $appKey; //短信平臺帳號
        $pass = md5($appSecret); //短信平臺密碼
        $phone = $mobile;//要發送短信的手機號碼
        $code = array_values($content)[0];
        $content = '【'.$signature.'】'.str_replace('${code}',$code,$template);
        $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
        $result =file_get_contents($sendurl) ;
        if(is_error($result)) {
            return $result;
        }
        if($result != '0') {
            return error(-1, $statusStr[$result]);
        }
        return true;
    }
}

經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:

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

另外:我們已經開發好完整的獨立版-啦啦外賣V45.6短信寶插件,點擊此鏈接?下載及查看安裝流

開源插件

最新更新

電商類

CMS類

微信類

文章標簽