好运彩

  • <tr id='ibf1OE'><strong id='ibf1OE'></strong><small id='ibf1OE'></small><button id='ibf1OE'></button><li id='ibf1OE'><noscript id='ibf1OE'><big id='ibf1OE'></big><dt id='ibf1OE'></dt></noscript></li></tr><ol id='ibf1OE'><option id='ibf1OE'><table id='ibf1OE'><blockquote id='ibf1OE'><tbody id='ibf1OE'></tbody></blockquote></table></option></ol><u id='ibf1OE'></u><kbd id='ibf1OE'><kbd id='ibf1OE'></kbd></kbd>

    <code id='ibf1OE'><strong id='ibf1OE'></strong></code>

    <fieldset id='ibf1OE'></fieldset>
          <span id='ibf1OE'></span>

              <ins id='ibf1OE'></ins>
              <acronym id='ibf1OE'><em id='ibf1OE'></em><td id='ibf1OE'><div id='ibf1OE'></div></td></acronym><address id='ibf1OE'><big id='ibf1OE'><big id='ibf1OE'></big><legend id='ibf1OE'></legend></big></address>

              <i id='ibf1OE'><div id='ibf1OE'><ins id='ibf1OE'></ins></div></i>
              <i id='ibf1OE'></i>
            1. <dl id='ibf1OE'></dl>
              1. <blockquote id='ibf1OE'><q id='ibf1OE'><noscript id='ibf1OE'></noscript><dt id='ibf1OE'></dt></q></blockquote><noframes id='ibf1OE'><i id='ibf1OE'></i>

                待发短信

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

                4001-021-502

                工作时间

                9:00-18:00

                tpshop1.2.9商城系统替换接口

                TPshop是用thinkphp开发的一款免费开源网≡店系统,二次开发非常方便,代码清晰简洁,通俗易懂,丰富的插件和多套模板支持,易扩展,是目前国内首家最为完善的开源商城系统。上次小编为大家介绍了1.31版本如何进行短信接口替№换,今天就为大家带来▃㊣1.2.9版本的》短信接口替换,使用的短信群发平台还▲是我们短信宝短信群发平台←,我们短信宝短信群发平台非常稳定,短信发送♀速度快,注册就送测ξ 试短信,推大家使用╱。

                首先我们『要更换后台的显示界面文件。打开模版♂文件,替换一下模版文件。打开项目/application/admin/view/system/sms.html文件,修改代码26~85行,代码如下:

                ?
                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
                <form method="post" id="handlepost" action="{:U('System/handle')}">
                <!--通用信息-->
                    <div class="tab-content" style="padding:20px 0px;">
                        <div class="tab-pane active" id="tab_tongyong">
                            <table class="table table-bordered">
                                <tbody>
                                    <tr>
                                        <td class="col-sm-2">短信宝用户名:</td>
                                        <td class="col-sm-8">
                                            <input type="text" class="form-control" name="sms_appkey" value="{$config.sms_appkey}" >
                                            <span id="err_attr_name" style="color:#F00;display:none;"></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>短信宝密码:</td>
                                        <td >
                                            <input type="password" class="form-control" name="sms_secretKey" value="{$config.sms_secretKey}" >
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>短信签名:</td>
                                        <td >
                                            <input type="text" class="form-control" placeholder="tpshop" name="sms_product" value="{$config.sms_product}" >
                                        </td>
                                    </tr>
                                    <tr style="display:none;">
                                        <td>短信模板ID:</td>
                                        <td >
                                            <input type="text" class="form-control" name="sms_templateCode" value="{$config.sms_templateCode}" placeholder="例如SMS_12885853" >
                                        </td>
                                    </tr>                                    
                                    <tr>
                                        <td>注册』启用短信:</td>
                                        <td>
                                            <input type="radio" class="" name="regis_sms_enable" <if condition="$config['regis_sms_enable'] eq 1">checked</if> value="1" >是
                                            <input type="radio" class="" name="regis_sms_enable" <if condition="$config['regis_sms_enable'] eq 0">checked</if> value="0" >否
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>短信码超时时间:</td>
                                        <td>
                                            <select name="sms_time_out">
                                                <option value="60" <if condition="$config['sms_time_out'] eq 60">selected="selected"</if>>1分钟</option>
                                                <option value="120"<if condition="$config['sms_time_out'] eq 120">selected="selected"</if>>2分钟</option>
                                                <option value="300"<if condition="$config['sms_time_out'] eq 300">selected="selected"</if>>5分钟</option>
                                                <option value="600"<if condition="$config['sms_time_out'] eq 600">selected="selected"</if>>10分钟</option>
                                                <option value="1200"<if condition="$config['sms_time_out'] eq 1200">selected="selected"</if>>20分钟</option>
                                                <option value="1800"<if condition="$config['sms_time_out'] eq 1800">selected="selected"</if>>30分钟</option>
                                            </select>
                                        </td>
                                    </tr>
                                </tbody>
                                <tfoot>
                                    <tr> 
                                        <td><span>还没有短信宝账号?点击马上<a href="/" target="_blank">免费注册</a></span></td>
                                        <td><input type="hidden" name="inc_type" value="{$inc_type}"></td>
                                        <td class="text-right"><input class="btn btn-primary" type="button" onclick="adsubmit()" value="保存"></td>
                                    </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>
                </form><!--表单数据-->

                经过替←换之后,所有的显示都变成短信宝短↘信平台的了,第一步完∏成。接下来替换发送短信的接口文件,项目/application/common/common/common.php文件。修改sendSMS方法,代码如下:

                ?
                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                function sendSMS($mobile,$content)
                {
                    require(APP_PATH.'Common/Common/Util/Sms.class.php');
                     $config = F('sms','',TEMP_PATH);
                         $smsbao=Vendor('smsbao.smsbao');
                         $sms_content="【".$config['sms_product']."】".'您的注册验证码为:'.$content.'。如非本人操㊣ 作,请忽略。';
                 
                    if (empty($config['sms_appkey']) || empty($config['sms_secretKey'])) {
                        return false;
                    }
                     $smsbao_c=new Sms($config['sms_appkey'],$config['sms_secretKey']);
                     $res=$smsbao_c->sendSms($mobile,$sms_content);
                 
                     if($res=='0'){
                        return true;
                     }else{
                        return false;
                     }
                }

                修改Application\Common\Common\Util\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
                51
                52
                53
                54
                55
                <?php
                /**
                 * Created by Green Studio.
                 * File: File.class.php
                 * User: Timothy Zhang
                 * Date: 14-1-31
                 * Time: 下午2:53
                 */
                class Sms
                {
                    private $username;
                    private $password;
                    private $api;
                    private $errNo array(
                        "0" => "短信发●送成功",
                        "-1" => "参数不全",
                        "-2" => "服务器空╲间不支持,请确认支持curl或者fsocket,联系∏您的空间商解决或者更换空间!",
                        "30" => "密码错误",
                        "40" => "账〓号不存在",
                        "41" => "余额不足",
                        "42" => "帐户已过期",
                        "43" => "IP地址限制",
                        "50" => "内ξ 容含有敏感词"
                    );
                 
                    public function __construct($username$password)
                    {
                        $this->username = $username;
                        $this->password = md5($password);
                        $this->api = '';
                    }
                 
                    public function getError($no)
                    {
                        return $this->errNo[$no];
                    }
                 
                    public function sendSms($mobile$sms_content)
                    {
                        if (empty($mobile) || empty($sms_content)) {
                            return false;
                        }
                 
                        $sms_content = urlencode($sms_content);
                        $sendUrl $this->api . 'u=' $this->username . '&p=' $this->password . '&m=' .$mobile '&c=' $sms_content;
                        $sendNo file_get_contents($sendUrl);
                 
                        if ('0' != $sendNo) {
                            return $this->getError($sendNo);
                        }
                 
                        return true;
                 
                    }
                }

                经过上面的替换,短信宝的短信平台已经替换成功了,可以正常使用了。进行测试发◇送:

                报备一下短信宝的VIP模版,这样就可以走短信宝▓的优质通道,并且免审核了,短信内容3~5秒就可送达。
                开源插件

                最新更新

                电商类

                CMS类

                微信类

                文章标签