待发短信

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

4001-021-502

工作时间

9:00-18:00

MccmsV1.1.2新增短信宝短信接口

Mccms 是一款采用Ci框架为核心开发的漫画+小说系统,功能强大,支持一键采集、一键解析,五分钟就能让您拥有一个丰富完整的漫画+小说网站。编对这款系统还比较了解,今天就以替换短信接口为例为大家讲解一下如何进行二次开发,使用的短信接口是我们短信宝短信群发平头的短信接口,我们短信宝短信群发平台非常稳定,发送速度快,注册就送测试短信,推荐大家使用

1:打开项目:\template\admin\setting\user.tpl 更改下333行代码

?
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
                       <div class="layui-tab-item">
                            <div class="layui-form layui-text" style="max-width: 700px;padding-top: 25px;">
                                <div class="layui-form-item w120">
                                    <label class="layui-form-label">短信服务商:</label>
                                    <div class="layui-input-inline" style="display: block;width: auto;float: none;">
                                        <input lay-filter="sms" type="radio" name="Sms_Mode" value="0" title="关闭短信"<?php if(Sms_Mode == 0) echo ' checked';?>>
                                        <input lay-filter="sms" type="radio" name="Sms_Mode" value="1" title="短信宝短信"<?php if(Sms_Mode == 1) echo ' checked';?>>
                                        <input lay-filter="sms" type="radio" name="Sms_Mode" value="2" title="腾讯云短信"<?php if(Sms_Mode == 2) echo ' checked';?>>
                                        <input lay-filter="sms" type="radio" name="Sms_Mode" value="3" title="聚合数据短信"<?php if(Sms_Mode == 3) echo ' checked';?>>
                                    </div>
                                </div>
                                <div class="layui-form-item w120" id="sms"<?php if(Sms_Mode == 3) echo ' style="display: none;"';?>>
                                    <label class="layui-form-label">AppId:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Sms_Appid" placeholder="短信宝对应的账号,腾讯云对应KeyId" value="<?=Sms_Appid?>" class="layui-input"/>
                                    </div>
                                </div>
                                <div class="layui-form-item w120">
                                    <label class="layui-form-label">AppKey:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Sms_Appkey" placeholder="短信宝对应的密码,腾讯云对应AppKey" value="<?=Sms_Appkey?>" class="layui-input"/>
                                    </div>
                                </div>
                                <div class="layui-form-item w120">
                                    <label class="layui-form-label">短信签名:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Sms_Name" placeholder="短信签名,如:漫城cms" value="<?=Sms_Name?>" class="layui-input"/>
                                    </div>
                                </div>
                                <div class="layui-form-item w120">
                                    <label class="layui-form-label">注册登陆模版:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Sms_Tpl_Log" placeholder="模板需要在服务商短信控制台中申请" value="<?=Sms_Tpl_Log?>" class="layui-input"/>
                                    </div>
                                </div>
                                <div class="layui-form-item w120">
                                    <label class="layui-form-label">绑定手机模版:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Sms_Tpl_Bind" placeholder="模板需要在服务商短信控制台中申请" value="<?=Sms_Tpl_Bind?>" class="layui-input"/>
                                    </div>
                                </div>
                                <div class="layui-form-item w120">
                                    <label class="layui-form-label">找回密码模版:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="Sms_Tpl_Pass" placeholder="模板需要在服务商短信控制台中申请" value="<?=Sms_Tpl_Pass?>" class="layui-input"/>
                                    </div>
                                </div>
                                <blockquote class="layui-elem-quote layui-quote-nm">
                                    提示信息:<br>
                                    请务必按照短信接口服务商的要求做好短信签名和短信内容的设置。<br>
                                    腾讯云短信:https://cloud.tencent.com/product/sms<br>
                                    腾讯云短信模板例子:<br>
                                    尊敬的用户,您的验证码为:{1},请勿泄漏于他人!<br>
                                    验证码为:{1},您正在绑定手机,若非本人操作,请勿泄露。<br>
                                    验证码为:{1},您正在进行密码重置操作,如非本人操作,请忽略本短信!<br>
                                    短信宝短信:https://www.smsbao.com/<br>
                                    短信宝短信模板例子:<br>
                                    尊敬的用户,您的验证码为:${code},请勿泄漏于他人!<br>
                                    验证码为:${code},您正在绑定手机,若非本人操作,请勿泄露。<br>
                                    验证码为:${code},您正在进行密码重置操作,如非本人操作,请忽略本短信!
                                </blockquote>

2:打开项目:\sys\apps\libraries\Sms.php 将95行短信发送方法改成短信宝

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    //短信宝
    public function alyun($tel,$code,$tplid){
        $smsapi = "http://api.smsbao.com/";
        $user = $this->appid; //短信平台帐号
        $pass = md5($this->appkey); //短信平台密码
        $content='【'.$this->signname.'】'.$tplid;//要发送的短信内容
        $content = str_replace('${code}',$code,$content);
        $phone = $tel;//要发送短信的手机号码
        $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
        $result =file_get_contents($sendurl) ;
        if($result == '0'){
            return true;
        }
        return false;
    }

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

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

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

 
开源插件
文章标签