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


待發短信

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

4001-021-502

工作時間

9:00-21:00

大商創短信寶短信插件使用

大商創,是一款功能強大的B2B2C多用戶商城系統,二次開發進行功能擴展很方便,最近有個客戶找到我們想要替換原來的短信接口,因為原來的短信接口不穩定,我們短信寶的短信接口既穩定,又快速。接收驗證碼短信,通知類的短信,速度真的杠杠滴,推薦大家嘗試一下。

第一步:我們需要替換一些配置文件,打開項目/languages/zh_cn/admin/common.php文件,修改代碼在350行左右,代碼如下:

?
1
$_LANG['huyi_configure'] = '短信寶短信配置';

打開項目/languages/zh_cn/admin/shop_config.php文件,修改代碼在53以及129,130左右,修改代碼如下:

?
1
2
3
$_LANG['cfg_range']['sms_type']['0'] = '短信寶';
$_LANG['cfg_name']['sms_ecmoban_user'] = '短信寶用戶名';
$_LANG['cfg_name']['sms_ecmoban_password'] = '短信寶密碼';

配置文件修改成功后 我們需要修改一下發送短信的業務代碼,修改項目/includes/cls_sms.php文件中的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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
public function sms()
    $this->sms_name = $GLOBALS['_CFG']['sms_ecmoban_user'];
        $this->sms_password = $GLOBALS['_CFG']['sms_ecmoban_password'];
        $this->sms_sign = $GLOBALS['_CFG']['shop_name'];
    }
 
 public function send($phones$msg ''$send_date ''$send_num = 1, $sms_type ''$version '1.0', &$sms_error ''$mobile_code '')
    {
        if ($GLOBALS['_CFG']['sms_type'] == 0) {
            $contents $this->get_contents($phones$msg);
            if (!$contents) {
                return false;
            }
 
            $sms_url 'http://api.smsbao.com/sms?';
 
 
            if (1 < count($contents)) {
                foreach ($contents as $key => $val) {
                    $post_data 'u=' $this->sms_name . '&p=' $this->sms_password . '&m=' $val['phones'] . '&c=【' .$this->sms_sign.'】' . rawurlencode($val['content']);
 
                    $get file_get_contents($sms_url.$post_data);
                    $gets['code']=$get;
                    $gets['msg']='發送成功';
                    // $get = $this->Post($post_data, $sms_url);
                    // $gets = $this->xml_to_array($get);
                    sleep(1);
                }
            }
            else {
                $post_data 'u=' $this->sms_name . '&p=' $this->sms_password . '&m=' $contents[0]['phones'] . '&c=【' .$this->sms_sign.'】' . rawurlencode($contents[0]['content']);
 
                $get file_get_contents($sms_url.$post_data);
                $gets['code'] = $get;
                $gets['msg'] = '發送成功';
                // $get = $this->Post($post_data, $sms_url);
                // $gets = $this->xml_to_array($get);
            }
 
            if ($get == '0') {
                return true;
            }
            else {
                $statusStr array(
                    "0" => "短信發送成功",
                    "-1" => "參數不全",
                    "-2" => "服務器空間不支持,請確認支持curl或者fsocket,聯系您的空間商解決或者更換空間!",
                    "30" => "密碼錯誤",
                    "40" => "賬號不存在",
                    "41" => "余額不足",
                    "42" => "帳戶已過期",
                    "43" => "IP地址限制",
                    "50" => "內容含有敏感詞"
                    );
                $sms_error $phones .$statusStr["$get"];
                $this->logResult($sms_error);
                return false;
            }
        }
        else if ($GLOBALS['_CFG']['sms_type'] == 1) {
            $msg $this->get_usser_sms_msg($msg);
 
            if (!empty($msg['sms_value'])) {
                $smsParams array('mobile_phone' => $phones'code' => $msg['code']);
                $send_time $msg['sms_value'];
            }
            else {
                $smsParams array('mobile_phone' => $phones'code' => $msg['code'], 'product' => $msg['product']);
                $send_time 'sms_signin';
            }
 
            $result = sms_ali($smsParams$send_time);
            $resp $GLOBALS['ecs']->ali_yu($result);
 
            if ($resp->code == 0) {
                return true;
            }
            else {
                if ($resp->sub_msg) {
                    $sms_error $phones $resp->sub_msg;
                }
                else {
                    $sms_error $phones ':' $resp->msg;
                }
 
                $this->logResult($sms_error);
                return false;
            }
        }
    }

最后我們修改模版文件,項目/admin/templates/website.dwt文件,修改代碼在13行左右,代碼如下:

?
1
 <li {if $menu_select.current eq 'huyi_configure'}class="curr"{/if}><a href="huyi_configure.php?act=list">短信寶短信配置</a></li>

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

報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,并且免審核了,短信內容3~5秒就可送達。
開源插件

最新更新

電商類

CMS類

微信類

文章標簽