待发短信

在线客服
产品支持 短信宝客服
合作渠道 渠道合作
服务咨询

4001-021-502

工作时间

9:00-21:00

小鸟云Zkeys_4.4.3新增短信宝短信接口

ZKEYS业务管理系统通过提供完善的平台来管理包括计算、网络、存储在内的各项资源,其功能模块涵盖了云服务器、虚拟主机、托管等业务的在线弹性购买及秒级开通交付; 平台具有安装简单、维护轻松、成本低廉、业务功能齐全等特点,支持一键安装Linux及Windows等多种环境,只需数十分钟即可轻松的搭建。小编对它还是很了解的,今天小编就以新增短信接口为例,给大家讲解一下如何进行二次开发,使用的短信接口是我们短信宝短信群发平台的短信接口,我们短信宝短信群发平台的接口非常稳定,发送速度快,注册就送测试短信,推荐大家使用。

1:首先打开项目:\template\Admin\Zkeys\PC\Page\Setting\basic.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
<div class="content-block">
                        <div class="content-block-title">
                            短信通道一
                            <span class="show-tip" data-query="zkeys-setting-smg-smgOne"></span>
                        </div>
                        <table class="inner-table edit-table">
                            <tbody>
                            <tr>
                                <th>通道:</th>
                                <td>
                                    短信宝 http://www.smsbao.com
                                    <span class="row-title">注:为确保正常发送短信验证码,请正确填写短信宝的短信通道信息!</span>
                                </td>
                            </tr>
                            <tr>
                                <th>短信宝账号:</th>
                                <td>
                                    <input type="text" name="smgApiId" class="input input-long"
                                           value="{$smg.smgApiId}"/>填写您的短信宝用户名
                                </td>
                            </tr>
                            <tr>
                                <th>短信宝密码:</th>
                                <td>
                                    <input type="password" name="smgApiKey" class="input input-long" value="{$smg.smgApiKey}"/>
                                    填写您的短信宝密码
                                    <span class="row-title">注:留空则不修改</span>
                                </td>
                            </tr>
                            <tr>
                                <th>短信宝签名:</th>
                                <td><input type="text" name="smgSignatureMd" class="input input-long"
                                           value="{$smg.smgSignatureMd}"/>填写您的短信宝签名</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

2:打开项目:\libs\Niaoyun\Common\Sms\EnInfo.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
 public function send($mobile, $content, $id = null)
    {
        $smsapi = $this->config['url'];
        $user = $this->config['apiId']; //短信平台帐号
        $pass = md5($this->config['apiKey']); //短信平台密码
        $content=$this->config['signature'].$content;//要发送的短信内容
        $phone = $mobile;//要发送短信的手机号码
        $sendurl = $smsapi."u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
        $result =file_get_contents($sendurl) ;
 
 
        $statusStr = array(
            "0" => "短信发送成功",
            "-1" => "参数不全",
            "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!",
            "30" => "密码错误",
            "40" => "账号不存在",
            "41" => "余额不足",
            "42" => "帐户已过期",
            "43" => "IP地址限制",
            "50" => "内容含有敏感词"
        );
        if (is_numeric($result) && $result > 0) {
            $this->error = $result . $statusStr[$result];
 
 
            return false;
        }
 
 
        return true;
 
 
//        $this->setApi('mt');
//        $this->setMobile($mobile);
//        $this->setContent($content);
//        $this->setMessageId($id); // id 由控制类生成
//        $this->setUrl($this->config['url'] . '/' . $this->api);
//        $this->setParams();
//        $this->setHeaders(null);
//
//        $result = $this->sendPost($this->url, $this->params, $this->headers);
//
//        return $this->processSendResult($result);
    }

打开项目:\config\smsConfig.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
return [
    1 => [
        'className'   => 'EnInfo',
        'channelName' => '短信宝',
    ],
    2 => [
        'className'   => 'Office',
        'channelName' => '第二办公室短信',
    ],
    3 => [
        'className'   => 'ZkeysSms',
        'channelName' => 'ZKEYS短信',
    ],
 
 
    /**
    * 以下为自己开发短信接口配置demo
    * 数字序号为通道序号,系统默认的为1,2通道,3以上可自行设置
    * 为了系统的稳定,请勿随意更改系统默认的通道信息。
    *
    *  ```php
    *  3 => [
    *       'className'   => 'Others',     // 短信接口实现的类名,需与实现的发送类一致
    *       'channelName' => '其他短信通道', // 短信通道名称,可以为中文,用以展示
    *  ],
    *  ```
    */
];

好了经过以上的添加,短信宝小鸟云zkeys_4.4.3系统增加手机验证就已经安装成功,可以正常使用了

报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。

另外:我们已经开发好完整的小鸟云zkeys_4.4.3系统短信宝插件,点击此链接 下载及查看安装流程。

开源插件

最新更新

电商类

CMS类

微信类

文章标签