chengkun
2025-05-29 a4b758d33b51ad771a11237fb72bc856dd9059b2
短信开发
5 files modified
576 ■■■■ changed files
admin/model/msgconfig.class.php 311 ●●●● patch | view | raw | blame | history
app/include/public.function.php 10 ●●●●● patch | view | raw | blame | history
app/model/notice.model.php 185 ●●●● patch | view | raw | blame | history
app/template/admin/admin_msg_config.htm 64 ●●●● patch | view | raw | blame | history
app/template/admin/admin_settpl.htm 6 ●●●●● patch | view | raw | blame | history
admin/model/msgconfig.class.php
@@ -1,172 +1,173 @@
<?php
class msgconfig_controller extends adminCommon{
    function index_action(){
        $cacheM     =   $this->MODEL('cache');
        $options    =   array('city');
        $cache      =   $cacheM -> GetCache($options);
        $this       ->  yunset($cache);
        $this->yuntpl(array('admin/admin_msg_config'));
    }
    //保存
    function save_action(){
        $configM    =    $this->MODEL('config');
         if($_POST['config']){
            unset($_POST['config']);
            $configM->setConfig($_POST);
            $this->web_config();
            $this->ACT_layer_msg( "短信配置设置成功!",9,1,2,1);
        }
    }
    //短信模板列表
    function tpl_action(){
        $this->yuntpl(array('admin/admin_msg_tpl'));
    }
    //短信模板设置
    function settpl_action(){
        include(CONFIG_PATH."db.tpl.php");
        $this->yunset("arr_tpl",$arr_tpl);
        $templatesM    =    $this->MODEL("templates");
        if($_POST['config']){
            $configNum    =    $templatesM->getNum(array('name'=>trim($_POST['name'])));
            $content    =     str_replace("amp;nbsp;","nbsp;",$_POST['content']);
            if($configNum>0){
                $templatesM->upInfo(array('name'=>trim($_POST['name'])),array('content'=>$content,'title'=>trim($_POST['title'])));
            }else{
                $templatesM->addInfo(array('name'=>trim($_POST['name']),'content'=>$content,'title'=>trim($_POST['title'])));
            }
            $this->ACT_layer_msg( "短信模版配置设置成功!",9,$_SERVER['HTTP_REFERER'],2,1);
        }
        $row    =    $templatesM->getInfo(array('name'=>$_GET['name']));
        $this->yunset("row",$row);
        $this->yuntpl(array('admin/admin_settpl'));
    }
    function get_restnum_action(){
        $returnArr['msgnum'] = $returnArr['businessnum'] = 0;
        //短信检测
        $url        =    'https://u.phpyun.com/feature';
        $url        .=    '?appKey='.$this->config['sy_msg_appkey'].'&appSecret='.$this->config['sy_msg_appsecret'];
        if (extension_loaded('curl')){
            $return     =     CurlGet($url);
        }else if(function_exists('file_get_contents')){
            $return     =     file_get_contents($url);
        }
        if($return){
            $msgInfo = json_decode($return,true);
            if($msgInfo['code'] == '200'){
                $returnArr['msgnum'] = $msgInfo['num'];
            }
            unset($return);
        }
        //空号检测
        $url        =    'https://u.phpyun.com/feature';
        $url        .=    '?appKey='.$this->config['sy_kh_appkey'].'&appSecret='.$this->config['sy_kh_appsecret'];
        if (extension_loaded('curl')){
            $return     =     CurlGet($url);
        }else if(function_exists('file_get_contents')){
            $return     =     file_get_contents($url);
        }
        if($return){
            $msgInfo = json_decode($return,true);
            if($msgInfo['code'] == '200'){
                $returnArr['khnum'] = $msgInfo['num'];
            }
            unset($return);
        }
        //天眼查检测
        $url        =    'https://u.phpyun.com/feature';
        $url        .=    '?appKey='.$this->config['sy_tyc_appkey'].'&appSecret='.$this->config['sy_tyc_appsecret'];
        if (extension_loaded('curl')){
            $return     =     CurlGet($url);
        }else if(function_exists('file_get_contents')){
            $return     =     file_get_contents($url);
        }
        if($return){
            $msgInfo = json_decode($return,true);
            if($msgInfo['code'] == '200'){
                $returnArr['businessnum'] = $msgInfo['num'];
            }
        }
        echo json_encode($returnArr);die;
    }
    function get_restnums_action(){
class msgconfig_controller extends adminCommon {
    function index_action() {
        $cacheM = $this->MODEL('cache');
        $options = array('city');
        $cache = $cacheM->GetCache($options);
        $this->yunset($cache);
        $this->yuntpl(array('admin/admin_msg_config'));
    }
    //保存
    function save_action() {
        $configM = $this->MODEL('config');
        if ($_POST['config']) {
            unset($_POST['config']);
            $configM->setConfig($_POST);
            $this->web_config();
            $this->ACT_layer_msg("短信配置设置成功!", 9, 1, 2, 1);
        }
    }
    //短信模板列表
    function tpl_action() {
        $this->yuntpl(array('admin/admin_msg_tpl'));
    }
    //短信模板设置
    function settpl_action() {
        include(CONFIG_PATH . "db.tpl.php");
        $this->yunset("arr_tpl", $arr_tpl);
        $templatesM = $this->MODEL("templates");
        if ($_POST['config']) {
            $configNum = $templatesM->getNum(array('name' => trim($_POST['name'])));
            $content = str_replace("amp;nbsp;", "nbsp;", $_POST['content']);
            if ($configNum > 0) {
                $templatesM->upInfo(array('name' => trim($_POST['name'])), array('content' => $content, 'template_id' => $_POST['template_id'], 'title' => trim($_POST['title'])));
            } else {
                $templatesM->addInfo(array('name' => trim($_POST['name']), 'content' => $content, 'template_id' => $_POST['template_id'], 'title' => trim($_POST['title'])));
            }
            $this->ACT_layer_msg("短信模版配置设置成功!", 9, $_SERVER['HTTP_REFERER'], 2, 1);
        }
        $row = $templatesM->getInfo(array('name' => $_GET['name']));
        $this->yunset("row", $row);
        $this->yuntpl(array('admin/admin_settpl'));
    }
    function get_restnum_action() {
        $returnArr['msgnum'] = $returnArr['businessnum'] = 0;
        //短信检测
        $url = 'https://u.phpyun.com/feature';
        $url .= '?appKey=' . $this->config['sy_msg_appkey'] . '&appSecret=' . $this->config['sy_msg_appsecret'];
        if (extension_loaded('curl')) {
            $return = CurlGet($url);
        } else if (function_exists('file_get_contents')) {
            $return = file_get_contents($url);
        }
        if ($return) {
            $msgInfo = json_decode($return, true);
            if ($msgInfo['code'] == '200') {
                $returnArr['msgnum'] = $msgInfo['num'];
            }
            unset($return);
        }
        //空号检测
        $url = 'https://u.phpyun.com/feature';
        $url .= '?appKey=' . $this->config['sy_kh_appkey'] . '&appSecret=' . $this->config['sy_kh_appsecret'];
        if (extension_loaded('curl')) {
            $return = CurlGet($url);
        } else if (function_exists('file_get_contents')) {
            $return = file_get_contents($url);
        }
        if ($return) {
            $msgInfo = json_decode($return, true);
            if ($msgInfo['code'] == '200') {
                $returnArr['khnum'] = $msgInfo['num'];
            }
            unset($return);
        }
        //天眼查检测
        $url = 'https://u.phpyun.com/feature';
        $url .= '?appKey=' . $this->config['sy_tyc_appkey'] . '&appSecret=' . $this->config['sy_tyc_appsecret'];
        if (extension_loaded('curl')) {
            $return = CurlGet($url);
        } else if (function_exists('file_get_contents')) {
            $return = file_get_contents($url);
        }
        if ($return) {
            $msgInfo = json_decode($return, true);
            if ($msgInfo['code'] == '200') {
                $returnArr['businessnum'] = $msgInfo['num'];
            }
        }
        echo json_encode($returnArr);
        die;
    }
    function get_restnums_action() {
        $user = trim($this->config['sy_msg_appkey']);
        $pass = trim($this->config['sy_msg_appsecret']);
        $url = 'http://api.smsbao.com/query';
        $url.= '?u='.$user.'&p='.md5($pass);
        if(function_exists('file_get_contents')){
        $url .= '?u=' . $user . '&p=' . md5($pass);
        if (function_exists('file_get_contents')) {
            $file_contents = file_get_contents($url);
        }else{
        } else {
            $ch = curl_init();
            $timeout = 5;
            curl_setopt ($ch, CURLOPT_URL, $url);
            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            $file_contents = curl_exec($ch);
            curl_close($ch);
        }
        $result = explode(",", $file_contents);
        echo $result['1'];
    }
}
?>
app/include/public.function.php
@@ -1518,13 +1518,15 @@
    return $str;
}
/**
 * @desc    判断短信功能是否开启
 * @param   $config
 * @return  bool
 */
function checkMsgOpen($config) {
    if ($config["sy_msg_appkey"] == "" || $config["sy_msg_appsecret"] == "" || $config['sy_msg_isopen'] != '1') {
    if ($config["sy_sms_secret_id"] == "" || $config["sy_sms_secret_key"] == "" || $config['sy_sms_sdk_app_id'] == '') {
        return FALSE;
    } else {
        return TRUE;
    }
}
app/model/notice.model.php
@@ -68,18 +68,17 @@
     * 获取邮件、短信模板
     * @param array $data 传入参数
     * @param string $type 模板类型:email邮箱; msg短信
     * @return mixed
     * @return array
     */
    public function getTpl($data, $type) {
        $name = $type . $data['type'];
        
        $row = $this->select_once('templates', array('name' => $name));
        
        if ($row) {
            $tpl['title'] = $this->_tpl($row['title'], $data);
            $tpl['content'] = $this->_tpl($row['content'], $data);
            $tpl['template_id'] = $row['template_id'];
            return $tpl;
        } else {
            return array('status' => -1, 'msg' => '信息模板有误,请联系管理员');
@@ -235,12 +234,12 @@
    }
    
    /**
     * @desc 发送短信
     * @desc 发送短信接口
     * @param $type
     * @param $data
     * @return bool|string
     * @return array
     */
    private function postSMS($type = "msgsend", $data = '') {
    private function postSMS($type = "msgsend", $data = []) {
        $sing = $this->config['sy_msg_appsing'];
        $data['content'] = str_replace(array(" ", " ", "\t", "\n", "\r"), array("", "", "", "", ""), $data['content']);
        $url = 'http://api.smsbao.com/sms';
@@ -285,6 +284,7 @@
    }
    
    /**
     * @desc 发送短信
     * $data['moblie'] / $data['mobile'] 手机号(必填)
     * $data['content'] 短信内容(必填)
     *
@@ -297,30 +297,29 @@
            return array('status' => -1, 'msg' => '还没有配置短信,请联系管理员!');
        }
        
        $data['mobile'] = $data['moblie'] ? $data['moblie'] : $data['mobile'];
        if (!$this->_isKey('mobile', $data) || !CheckMobile($data['mobile'])) {
            return array('status' => -1, 'msg' => '手机号错误');
        }
        if ($this->config['sy_web_mobile'] != '') {
            $regnamer = @explode(';', $this->config['sy_web_mobile']);
            if (in_array($data['mobile'], $regnamer)) {
                return array('status' => -1, 'msg' => '该手机号已被禁止使用');
            }
        }
        if (!$this->_isKey('content', $data) || $data['content'] == '') {
            return array('status' => -1, 'msg' => '短信内容为空');
        }
        
        //发送短信
        $row = array(
            'appsecret' => $this->config['sy_msg_appsecret'],
            'appkey'    => $this->config['sy_msg_appkey'],
            'appsing'   => $this->config['sy_msg_appsing'],
            'phone'     => $data['mobile'],
            'content'   => $data['content'],
            'mid'       => isset($data['mid']) ? $data['mid'] : ''
            'sy_sms_secret_id'  => $this->config['sy_sms_secret_id'],
            'sy_sms_secret_key' => $this->config['sy_sms_secret_key'],
            'sy_sms_sdk_app_id' => $this->config['sy_sms_sdk_app_id'],
            'sy_sms_sign_name'  => $this->config['sy_sms_sign_name'],
            'template_id'       => $data['template_id'],
            'phone'             => $data['mobile'],
            'code'              => $data['code'],
        );
        
        $location = '';
@@ -363,7 +362,9 @@
            }
        }
        if (!isset($re['code'])) {
            $re = $this->postSMS('msgsend', $row);
            ///// 发送短信 /////
//            $re = $this->postSMS('msgsend', $row);
            $re = $this->sendSmsHttpRequest($row);
        }
        //短信记录保存数据库
        $sql_data = array(
@@ -376,7 +377,7 @@
            'location' => $location
        );
        
        if (trim($re) == '0') {
        if ($re['code'] == 1) {
            //检查是否需要发送系统预警
            include_once('warning.model.php');
            
@@ -425,10 +426,11 @@
                return $tpl;
            }
            $content = $tpl['content'];
            $template_id = $tpl['template_id'];
        }
        
        $data['content'] = $content;
        $data['template_id'] = $template_id;
        return $this->sendSMS($data);
    }
    
@@ -535,6 +537,7 @@
        $today = strtotime('today');
        $code = gt_Generate_code($length); //验证码
        $lastSend = [];
        $result = [];
        if ($kind == 'msg') {
            ///// 短信 /////
            if (!checkMsgOpen($this->config)) {
@@ -574,6 +577,7 @@
                ///// 获取企业认证信息  /////
                $lastSend = $this->select_once('company_cert', array('check' => $sended, 'type' => 7, 'orderby' => 'id,desc'), '`ctime`,`type`');
            } else {
                ///// 获取企业认证信息  /////
                $lastSend = $this->select_once('company_cert', array('check' => $sended, 'type' => 2, 'orderby' => 'id,desc'), '`ctime`,`type`');
            }
            if ($lastSend['ctime'] > $overtime) {
@@ -685,13 +689,13 @@
    
    /**
     * 按类别发送验证码
     * @param $sended // 发送对象
     * @param $sended // 发送对象-手机号
     * @param $type // 验证码类别
     * @param $code // 验证码
     * @param $kind //  发送类别
     * @param $user // 用户信息
     * @param $port // 端口
     * @return array|mixed|number[]|string[]
     * @return array|number[]|string[]
     */
    private function sendType($sended, $type, $code, $kind = 'msg', $user = array(), $port = null) {
        $finfo = $this->forsend($user);       //用户信息
@@ -705,7 +709,7 @@
        );
        $result = [];
        if ($kind == 'msg') {
            $data['moblie'] = $sended;
            $data['mobile'] = $sended;
            $data['port'] = $port;
            $result = $this->sendSMSType($data);
        } elseif ($kind == 'email') {
@@ -798,96 +802,103 @@
     * @param $msg
     * @return string
     */
    function sign($key, $msg) {
    protected function sign($key, $msg) {
        return hash_hmac("sha256", $msg, $key, true);
    }
    
    /**
     * 发送短信接口-腾讯云
     * @param $params
     * @param $data
     * @return array
     */
    public function sendSmsHttpRequest($params = []) {
    public function sendSmsHttpRequest($data = []) {
        // 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
        // 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
        // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
        
        $secret_id = $data['sy_sms_secret_id'];
        $secret_key = $data['sy_sms_secret_key'];
        $token = "";
        $service = "sms";
        $host = "sms.tencentcloudapi.com";
        $req_region = "ap-guangzhou";
        $version = "2021-01-11";
        $action = "SendSms";
        //////数字转字符串 //////
        $params = [
            'PhoneNumberSet'   => ['+86' . $data['phone']],
            'SmsSdkAppId'      => $data['sy_sms_sdk_app_id'],
            'TemplateId'       => $data['template_id'],
            'SignName'         => $data['sy_sms_sign_name'],
            'TemplateParamSet' => [strval($data['code'])]
        ];
        $payload = json_encode($params, JSON_UNESCAPED_UNICODE);
        var_dump($payload);
        $endpoint = "https://sms.tencentcloudapi.com";
        $algorithm = "TC3-HMAC-SHA256";
        $timestamp = time();
        $date = gmdate("Y-m-d", $timestamp);
        // ************* 步骤 1:拼接规范请求串 *************
        $http_request_method = "POST";
        $canonical_uri = "/";
        $canonical_querystring = "";
        $ct = "application/json; charset=utf-8";
        $canonical_headers = "content-type:" . $ct . "\nhost:" . $host . "\nx-tc-action:" . strtolower($action) . "\n";
        $signed_headers = "content-type;host;x-tc-action";
        $hashed_request_payload = hash("sha256", $payload);
        $canonical_request = "$http_request_method\n$canonical_uri\n$canonical_querystring\n$canonical_headers\n$signed_headers\n$hashed_request_payload";
        // ************* 步骤 2:拼接待签名字符串 *************
        $credential_scope = "$date/$service/tc3_request";
        $hashed_canonical_request = hash("sha256", $canonical_request);
        $string_to_sign = "$algorithm\n$timestamp\n$credential_scope\n$hashed_canonical_request";
        // ************* 步骤 3:计算签名 *************
        $secret_date = $this->sign("TC3" . $secret_key, $date);
        $secret_service = $this->sign($secret_date, $service);
        $secret_signing = $this->sign($secret_service, "tc3_request");
        $signature = hash_hmac("sha256", $string_to_sign, $secret_signing);
        // ************* 步骤 4:拼接 Authorization *************
        $authorization = "$algorithm Credential=$secret_id/$credential_scope, SignedHeaders=$signed_headers, Signature=$signature";
        // ************* 步骤 5:构造并发起请求 *************
        $headers = [
            "Authorization"  => $authorization,
            "Content-Type"   => "application/json; charset=utf-8",
            "Host"           => $host,
            "X-TC-Action"    => $action,
            "X-TC-Timestamp" => $timestamp,
            "X-TC-Version"   => $version
        ];
        if ($req_region) {
            $headers["X-TC-Region"] = $req_region;
        }
        if ($token) {
            $headers["X-TC-Token"] = $token;
        }
        try {
            $secret_id = "SecretId";
            $secret_key = "SecretKey";
            $token = "";
            $service = "sms";
            $host = "sms.tencentcloudapi.com";
            $req_region = "ap-guangzhou";
            $version = "2021-01-11";
            $action = "SendSms";
//            $params = [
//                'PhoneNumberSet' => '18019261992',
//                'SmsSdkAppId'    => '2343224242',
//                'TemplateId'     => '54645454'
//            ];
            $payload = json_encode($params);
            $endpoint = "https://sms.tencentcloudapi.com";
            $algorithm = "TC3-HMAC-SHA256";
            $timestamp = time();
            $date = gmdate("Y-m-d", $timestamp);
            // ************* 步骤 1:拼接规范请求串 *************
            $http_request_method = "POST";
            $canonical_uri = "/";
            $canonical_querystring = "";
            $ct = "application/json; charset=utf-8";
            $canonical_headers = "content-type:" . $ct . "\nhost:" . $host . "\nx-tc-action:" . strtolower($action) . "\n";
            $signed_headers = "content-type;host;x-tc-action";
            $hashed_request_payload = hash("sha256", $payload);
            $canonical_request = "$http_request_method\n$canonical_uri\n$canonical_querystring\n$canonical_headers\n$signed_headers\n$hashed_request_payload";
            // ************* 步骤 2:拼接待签名字符串 *************
            $credential_scope = "$date/$service/tc3_request";
            $hashed_canonical_request = hash("sha256", $canonical_request);
            $string_to_sign = "$algorithm\n$timestamp\n$credential_scope\n$hashed_canonical_request";
            // ************* 步骤 3:计算签名 *************
            $secret_date = sign("TC3" . $secret_key, $date);
            $secret_service = sign($secret_date, $service);
            $secret_signing = sign($secret_service, "tc3_request");
            $signature = hash_hmac("sha256", $string_to_sign, $secret_signing);
            // ************* 步骤 4:拼接 Authorization *************
            $authorization = "$algorithm Credential=$secret_id/$credential_scope, SignedHeaders=$signed_headers, Signature=$signature";
            // ************* 步骤 5:构造并发起请求 *************
            $headers = [
                "Authorization"  => $authorization,
                "Content-Type"   => "application/json; charset=utf-8",
                "Host"           => $host,
                "X-TC-Action"    => $action,
                "X-TC-Timestamp" => $timestamp,
                "X-TC-Version"   => $version
            ];
            if ($req_region) {
                $headers["X-TC-Region"] = $req_region;
            }
            if ($token) {
                $headers["X-TC-Token"] = $token;
            }
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($ch, CURLOPT_URL, $endpoint);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POST, TRUE);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($k, $v) {
                return "$k: $v";
            }, array_keys($headers), $headers));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            $response = curl_exec($ch);
            curl_close($ch);
            $result = json_decode($response, TRUE);
            if (!$result['Response']['RequestId']) {
                throw new Exception("请求失败", 10000);
            }
            $result_result = [
                'code' => 1,
                'msg'  => 'ok',
app/template/admin/admin_msg_config.htm
@@ -15,11 +15,6 @@
    <script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
    <script src="{yun:}$config.sy_weburl{/yun}/js/layui/custom_layer.js?v={yun:}$config.cachecode{/yun}"></script>
    <title>后台管理</title>
    <style>
        .table_form .layui-input-block{
            margin-left: 0;
        }
    </style>
</head>
<body class="body_ifm">
@@ -50,18 +45,33 @@
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th width="220">短信宝账号:</th>
                                <td><input class="tty_input t_w250" type="text" name="sy_msg_appkey" id="sy_msg_appkey" value="{yun:}$config.sy_msg_appkey{/yun}" size="30" />
                                <th width="220">SecretId:</th>
                                <td>
                                    <input class="tty_input t_w250" type="text" name="sy_sms_secret_id" id="sy_sms_secret_id" value="{yun:}$config.sy_sms_secret_id{/yun}" size="30" />
                                    <span class="admin_web_tip">腾讯云SecretId</span>
                                </td>
                            </tr>
                            <tr class="admin_table_trbg">
                                <th width="220">短信宝密码:</th>
                                <td><input class="tty_input t_w250" type="password" name="sy_msg_appsecret" id="sy_msg_appsecret" value="{yun:}$config.sy_msg_appsecret{/yun}" size="50" />
                                <th width="220">SecretKey:</th>
                                <td>
                                    <input class="tty_input t_w250" type="password" name="sy_sms_secret_key" id="sy_sms_secret_key" value="{yun:}$config.sy_sms_secret_key{/yun}" size="50" />
                                    <span class="admin_web_tip">腾讯云SecretKey</span>
                                </td>
                            </tr>
                            <tr>
                                <th width="220">短信宝签名:</th>
                                <td><input class="tty_input t_w250" type="text" name="sy_msg_appsing" id="sy_msg_appsing" value="{yun:}$config.sy_msg_appsing{/yun}" size="50" />
                                <th width="220">SmsSdkAppId:</th>
                                <td>
                                    <input class="tty_input t_w250" type="text" name="sy_sms_sdk_app_id" id="sy_sms_sdk_app_id" value="{yun:}$config.sy_sms_sdk_app_id{/yun}" size="50" />
                                    <span class="admin_web_tip">腾讯云短信SmsSdkAppId</span>
                                </td>
                            </tr>
                            <tr>
                                <th width="220">短信签名:</th>
                                <td>
                                    <input class="tty_input t_w250" type="text" name="sy_sms_sign_name" id="sy_sms_sign_name" value="{yun:}$config.sy_sms_sign_name{/yun}" size="50" />
                                    <span class="admin_web_tip">腾讯云短信签名</span>
                                </td>
                            </tr>
                            <tr class="admin_table_trbg">
                                <th width="220">单IP每日最大发信:</th>
@@ -76,6 +86,7 @@
                                <th width="220">单手机号认证类短信发送频率:</th>
                                <td><input class="tty_input t_w250" type="text" name="cert_msgtime" id="cert_msgtime" value="{yun:}$config.cert_msgtime{/yun}" size="30" />分钟</td>
                            </tr>
                            <tr class="admin_table_trbg">
                                <th width="220" class="t_fr">短信验证码时效:</th>
                                <td>
@@ -84,17 +95,17 @@
                                    </div>
                                </td>
                            </tr>
                            <tr>
                            <!-- <tr>
                                <th width="220">剩余短信数量:</th>
                                <td><input class="tty_input t_w250" type="text" name="rest_msgnum" id="rest_msgnum" value="0" disabled="disabled" />条</td>
                            </tr>
                            </tr> -->
                            <tr class="admin_table_trbg">
                            <!-- <tr class="admin_table_trbg">
                                <th width="220">购买短信:</th>
                                <td>
                                    <div class="yun_admin_divh"><a href="http://www.smsbao.com/reg?r=11641" target="_blank" style=" color:#CC3300; text-decoration:underline; "> 短信购买地址</a></div>
                                </td>
                            </tr>
                            </tr> -->
                            <!-- 
        <tr>
             <th colspan="2" class="admin_bold_box">
@@ -161,14 +172,10 @@
                                    <input class="layui-btn tty_cz" type="reset" value="重置" />
                                </td>
                            </tr>
                        </table>
                        <input type="hidden" id="pytoken" name="pytoken" value="{yun:}$pytoken{/yun}">
                    </form>
                </div>
            </div>
        </div>
        <script>
@@ -180,24 +187,18 @@
            $(function () {
                $("#config").click(function () {
                    var msgtime = $("#moblie_codetime").val();
                    if (parseInt(msgtime) < 2) {
                        parent.layer.msg('短信验证时效因大于两分钟!', 2, 8); return false;
                    } else {
                        loadlayer();
                        $.post("index.php?m=msgconfig&c=save", {
                            config: $("#config").val(),
                            sy_msg_isopen: $("input[name=sy_msg_isopen]:checked").val(),
                            sy_msg_appkey: $("#sy_msg_appkey").val(),
                            sy_msg_appsecret: $("#sy_msg_appsecret").val(),
                            sy_msg_appsing: $("#sy_msg_appsing").val(),
                            sy_sms_secret_id: $("#sy_sms_secret_id").val(),
                            sy_sms_secret_key: $("#sy_sms_secret_key").val(),
                            sy_sms_sdk_app_id: $("#sy_sms_sdk_app_id").val(),
                            sy_sms_sign_name: $("#sy_sms_sign_name").val(),
                            sy_kh_isopen: $("input[name=sy_kh_isopen]:checked").val(),
                            sy_kh_appkey: $("#sy_kh_appkey").val(),
@@ -219,7 +220,6 @@
                            parent.layer.closeAll('loading');
                            config_msg(data);
                        });
                    }
                });
@@ -235,8 +235,6 @@
                        $("#rest_businessnum").val(data.businessnum);
                    }
                });
            })
        </script>
    </div>
app/template/admin/admin_settpl.htm
@@ -68,6 +68,12 @@
                                    </td>
                                </tr>
                                {yun:}else{/yun}
                                <tr>
                                    <th width="150">短信模板ID:</th>
                                    <td>
                                        <input class="input-text" type="text" name="template_id" id="template_id" value="{yun:}$row.template_id{/yun}" size="60" />
                                    </td>
                                </tr>
                                <tr class="email">
                                    <th width="150" class="t_fr">内容:</th>
                                    <td>