<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<div class="layui-fluid oe_fluid">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">系统配置</a><span lay-separator="">/</span>
      <a href="javascript:;">网站设置</a><span lay-separator="">/</span>
      <a><cite>RP诚信设置</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="editform2">
        编辑保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
    </div>
  </div>
  <!--//top end -->
  
  <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
  <input type="hidden" name="a" id="a" value="saverpzy" />
  <div class="layui-card oe_table_edit">
    <div class="layui-card-body">
    
      <div class="layui-card-header">
        配置RP开放平台接口
        <span class="text_tip_inline">(设置正确的接口参数才能正常使用)</span>
      </div>
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">APP ID：</th>
          <td width="85%">
            <input type="text" name="appid" id="appid" class="layui-input input-250" value="<!--{$config.rpzy.appid}-->" />
            <br />
            <span class="text_tip_inline">(RP开放平台网站应用 APP ID，请妥善保存，请勿泄漏)</span>
          </td>
        </tr>
        <tr>
          <th>APP KEY：</th>
          <td>
            <input type="text" name="appkey" id="appkey" class="layui-input input-250" value="<!--{$config.rpzy.appkey}-->" />
            <br />
            <span class="text_tip_inline">(RP开放平台网站应用 APP KEY，请妥善保存，请勿泄漏)</span>
          </td>
        </tr>

        <tr>
          <th>通信状态：</th>
          <td>
            <span id="status_tips">--</span>
          </td>
        </tr>
        <tr>
          <th>可用余额：</th>
          <td>
            <input type="button" name="btn_sermap" id="but_check_balance" f="but_check_balance" class="layui-btn oe_btn_32" value="点击查询" />&#12288;
            <span id="balance_tips">--</span>
            &#12288;&#12288;
            <!--{if !empty($config.rpzy.appid)}-->
            <a style="color:blue;" href="http://open.oephp.com/index.php?c=recharge&appid=<!--{$config.rpzy.appid}-->" target="_blank">点击去充值&gt;&gt;</a>
            <!--{/if}-->
          </td>
        </tr>
        
        <tr>
          <th>可用短信：</th>
          <td>
            <input type="button" name="but_check_sms" id="but_check_sms" f="but_check_sms" class="layui-btn oe_btn_32" value="点击查询" />&#12288;
            <span id="sms_tips">--</span>
            &#12288;&#12288;
            <!--{if !empty($config.rpzy.appid)}-->
            <a style="color:blue;" href="http://open.oephp.com/index.php?c=smstc&appid=<!--{$config.rpzy.appid}-->" target="_blank">点击去充值&gt;&gt;</a>
            <!--{/if}-->
          </td>
        </tr>
      </table>
      
      <div class="layui-card-header">
        手机短信设置
        <span class="text_tip_inline">(开启之后网站可发手机短信，请确保RP开放平台APP ID有足够的短信)</span>
      </div>
      <table class="oe_tbl_form layui-form">
        <!--//21.04.27 -->
        <tr>
          <th width="15%">短信开关：</th>
          <td width="85%">
            <input type="radio" name="sms_flag" title="开启" value="1"<!--{if $config.sms.flag == '1'}--> checked<!--{/if}--> />
            <input type="radio" name="sms_flag" title="关闭" value="0"<!--{if $config.sms.flag == '0'}--> checked<!--{/if}--> />
          </td>
        </tr>
        <tr>
          <th>短信签名：</th>
          <td><input type="text" name="sms_sender" id="sms_sender" class="layui-input input-200" value="<!--{$config.sms.sender}-->" /></td>
        </tr>
        <tr>
          <th>测试手机号码：</th>
          <td><input type="text" name="sms_mobile" id="sms_mobile" class="layui-input input-200" value="<!--{$config.sms.mobile}-->" /></td>
        </tr>

        <tr>
          <th>测试发送：</th>
          <td>
            <span class="text_tip_inline">配置保存成功，可以测试短信是否正常发送。</span>
            <input type="button" name="btn_test" id="btn_test" f="btn_test" class="layui-btn oe_btn_32" value="点击这里测试短信配置是否正常" />
            &#12288;
            <span id="test_tips"></span>
          </td>
        </tr>
      </table>
      
      <div class="layui-card-header">
        PR诚信查询设置
        <span class="text_tip_inline">(开启之后可查询会员资料是否被举报过，需配置好接口)</span>
      </div>
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">RP诚信查询开关：</th>
          <td width="85%">
            <input type="radio" name="rpzy_flag" title="开启" value="1"<!--{if $config.rpzy_flag == '1'}-->  checked<!--{/if}--> />
            <input type="radio" name="rpzy_flag" title="关闭" value="0"<!--{if $config.rpzy_flag == '0'}-->  checked<!--{/if}--> />
          </td>
        </tr>
      </table>
      
      <!--//0.02.05 -->
      <div class="layui-card-header">
        自助实名认证
        <span class="text_tip_inline">(用户输入姓名、身份证+手机号码三要素完成自助实名认证，需配置好接口)</span>
      </div>
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">会员实名认证：</th>
          <td width="85%">
            <input type="radio" name="selfrz_flag" title="开启" value="1"<!--{if $config.selfrz_flag == '1'}-->  checked<!--{/if}--> />
            <input type="radio" name="selfrz_flag" title="关闭" value="0"<!--{if $config.selfrz_flag == '0'}-->  checked<!--{/if}--> />
            <span class="text_tip_inline" style="color:red;">
            (开启该功能，请确保RP开放平台帐户有足够的余额，接口每查询一次收费2元)
            </span>
          </td>
        </tr>
        <!--//0.04.13 -->
        <tr>
          <th>会员实名费用：</th>
          <td>

            <input type="text" name="selfrz_fee" id="selfrz_fee" class="layui-input input-100" value="<!--{$config.selfrz_fee}-->" />&nbsp;元 
            &#12288;
            认证成功后返还 <input type="text" name="selfrz_backmoney" id="selfrz_backmoney" class="layui-input input-100" value="<!--{$config.selfrz_backmoney}-->" />&nbsp;<!--{$config.moneyname}-->
            <br />
            <span class="text_tip_inline">(设置会员自助实名认证费用，0表示免费)</span>
          </td>
        </tr>
        <!--//0.02.05 -->
        <tr>
          <th>运营商紧急设置：</th>
          <td>
             <br />
             <font color="red">(当移动、联动、电信运营商无法正常使用时，可设置为走人工认证机制(会员上传身份证，后台审核认证)，不影响正常使用)</font><br />
             <input type="checkbox" name="oldrz_yidong" lay-skin="primary" title="开启移动手机段号人工认证" value="1"<!--{if $config.oldrz_yidong == '1'}--> checked<!--{/if}--> />
             <input type="checkbox" name="oldrz_liantong" lay-skin="primary" title="开启联通手机段号人工认证" value="1"<!--{if $config.oldrz_liantong == '1'}--> checked<!--{/if}--> />
             <input type="checkbox" name="oldrz_dianxin" lay-skin="primary" title="开启电信手机段号人工认证" value="1"<!--{if $config.oldrz_dianxin == '1'}--> checked<!--{/if}--> />
          </td>
        </tr>
      </table>
      
      <!--/21.04.19 -->
      <div class="layui-card-header">
        单身(婚况)声明
        <span class="text_tip_inline">(用户声明婚姻状况，并签名。)</span>
      </div>
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">婚况声明开关：</th>
          <td width="85%">
            <input type="radio" name="statement_flag" title="开启" value="1"<!--{if $config.statement_flag == '1'}-->  checked<!--{/if}--> />
            <input type="radio" name="statement_flag" title="关闭" value="0"<!--{if $config.statement_flag == '0'}-->  checked<!--{/if}--> />
            <span class="text_tip_inline" style="color:red;">
            (请先配置好RP开放平台接口，否则无法正常使用)
            </span>
          </td>
        </tr>
        <tr>
          <th>见证方(婚介公司名称)：</th>
          <td>

            <input type="text" name="statement_company" id="statement_company" class="layui-input input-300" value="<!--{$config.statement_company}-->" />
            <span class="text_tip_inline">
            (设置见证方/本平台公司名称)
            </span>
          </td>
        </tr>
        <tr>
          <th>声明有效期：</th>
          <td>

            <input type="text" name="statement_valid" id="statement_valid" class="layui-input input-100" value="<!--{$config.statement_valid}-->" /> 个月
            <span class="text_tip_inline">(设置声明默认有效期，默认为6个月)</span>
          </td>
        </tr>
        
      </table>
      
      
      
    </div>
    
  </div> 
  </form>
  <div class="oe_kong"></div>
  <div class="oe_tbl_form_btn current">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="editform2">
      编辑保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
</div>

<script type="text/javascript">
$(function(){
    //查询余额
    $(document).on("click", "[f='but_check_balance']", function(){
        _rpzyBalance();
    });
    
    //查询短信
    $(document).on("click", "[f='but_check_sms']", function(){
      _rpzySmsBalance();
    });
    
    //发送短信
    $(document).on("click", "[f='btn_test']", function(){
      _rpzyTestSms();
    });
    
    _rpzyStatus();
});
//通信状态
function _rpzyStatus() {
    $.ajax({
        type: "GET",
        url: _ROOT_PATH+"index.php",
        cache: false,
        data: {
          c:"rpzy", a:"status", r:get_rndnum(8)
        },
        dataType: "json",
        success: function($data) {
            $json = eval($data);
            $response = $json.response;
            $result = $json.result;
            if ($response == "1") {
                $("#status_tips").html("<font color='green'>通信成功</font>");
            }
            else {
                if ($result.length == 0) {
                    $result = "通信失败";
                }
                $("#status_tips").html("<font color='red'>"+$result+"</font>");
            }
        },
        error: function() {
        
        }
    });
}
//余额查询
function _rpzyBalance() {
    $.ajax({
        type: "GET",
        url: _ROOT_PATH+"index.php",
        cache: false,
        data: {
              c:"rpzy", a:"balance", r:get_rndnum(8)
        },
        dataType: "json",
        success: function($data) {
            $json = eval($data);
            $response = $json.response;
            $result = $json.result;
            if ($response == "1") {
                $("#balance_tips").html("<font color='green'>¥"+$result+"</font>");
            }
            else {
                if ($result.length == 0) {
                    $result = "查询失败";
                }
                $("#balance_tips").html("<font color='red'>"+$result+"</font>");
            }
        },
        error: function() {
        
        }
    });
}

//短信查询
function _rpzySmsBalance() {
    $("#sms_tips").html("loading...");
    $.ajax({
        type: "GET",
        url: _ROOT_PATH+'index.php?m=admin',
        cache: false,
        data: {
            c:"setting", a:"checkSmsBalance", type:4
        },
        dataType: "json",
        success: function($data) {
          $json = eval($data);
          $response = $json.response;
          $result = $json.result;
          if ($response == "1") {
              $yzm_nums = $result.yzm_nums;
              if (typeof($yzm_nums) == "undefined") {
                  $yzm_nums = "0";
              }
              $yx_nums = $result.yx_nums;
              if (typeof($yx_nums) == "undefined") {
                  $yx_nums = "0";
              }
              $("#sms_tips").html("<font color='green'>"+$yzm_nums+"条</font>");
          }
          else {
              if ($result.length == 0) {
                  $result = "查询失败";
              }
              $("#sms_tips").html("<font color='red'>"+$result+"</font>");
          }
        },
        error: function() {

        }
    });
}

//发送短信
function _rpzyTestSms() {
    $("#test_tips").html("loading...");
    $.ajax({
        type: "GET",
        url: _ROOT_PATH+'index.php?m=admin',
        cache: false,
        data: {c:"setting", a:"testsms"},
        dataType: "json",
        success: function($data) {
          $json = eval($data);
          $response = $json.response;
          $result = $json.result;
          if ($response == "1") {
              $("#test_tips").html("<font color='green'>发送成功</font>");
          }
          else {
              if ($result.length == 0) {
                  $result = "发送失败";
              }
              $("#test_tips").html("<font color='red'>"+$result+"</font>");
          }
        },
        error: function() {

        }
    });
}
</script>
</body>
</html>