2018-05-11 16:37:59 +08:00

169 lines
10 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{extend name="admin@public/content"}
{block name="content"}
<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='form-horizontal layui-form padding-top-20'>
<div class="form-group">
<label class="col-sm-2 control-label label-required">Mode<br><span class="nowrap color-desc">接口模式</span></label>
<div class="col-sm-8">
{php}
$wechat_type=sysconf('wechat_type')?sysconf('wechat_type'):'api';
$wechat_type=request()->get('appkey')?'thr':$wechat_type;
{/php}
{foreach ['api'=>'普通接口参数','thr'=>'第三方授权对接'] as $k=>$v}
<label class="think-radio">
<!--{if $wechat_type eq $k}-->
<input checked type="radio" value="{$k}" name="wechat_type">
<!--{else}-->
<input type="radio" value="{$k}" name="wechat_type">
<!--{/if}-->
{$v}
</label>
{/foreach}
<p class="help-block">如果使用第三方授权对接,需要 <a target="_blank" href="https://github.com/zoujingli/ThinkService">ThinkService</a> 项目的支持。</p>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="row">
<div class="col-sm-2 control-label">WxTest<br><span class="nowrap color-desc">功能测试</span></div>
<div class="col-sm-10">
<div class="pull-left padding-right-15 notselect">
<img class="notselect" data-tips-image src="{:url('@wechat/api.tools/oauth_qrc')}" style="width:80px;margin-left:-4px">
<p class="text-center" style="margin-left:-10px">网页授权</p>
</div>
<div class="pull-left padding-left-0 padding-right-15">
<img class="notselect" data-tips-image src="{:url('@wechat/api.tools/jssdk_qrc')}" style="width:80px;">
<p class="text-center">JSSDK签名</p>
</div>
<div class="pull-left padding-left-0 padding-right-15">
<img class="notselect" data-tips-image src="{:url('@wx-demo-jsapiqrc')}" style="width:80px;">
<p class="text-center">JSAPI支付</p>
</div>
<div class="pull-left padding-left-0 padding-right-15">
<img class="notselect" data-tips-image src="{:url('@wx-demo-scanoneqrc')}" style="width:80px;">
<p class="text-center">扫码支付①</p>
</div>
<div class="pull-left padding-left-0">
<img class="notselect" data-tips-image src="{:url('@wx-demo-scanqrc')}" style="width:80px;">
<p class="text-center">扫码支付②</p>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div data-api-type="api" class="hide">
<div class="row form-group">
<label class="col-sm-2 control-label">Token<br><span class="nowrap color-desc">验证令牌</span></label>
<div class="col-sm-8">
<input type="text" name="wechat_token" required="required" title="请输入接口Token(令牌)" placeholder="Token令牌" value="{:sysconf('wechat_token')}" class="layui-input">
<p class="help-block">公众号平台与系统对接认证Token请优先填写此参数并保存然后再在微信公众号平台操作对接。</p>
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label">AppId<br><span class="nowrap color-desc">公众号标识</span></label>
<div class="col-sm-8">
<input type="text" name="wechat_appid" title="请输入以wx开头的18位公众号APPID" placeholder="公众号APPID必填" pattern="^wx[0-9a-z]{16}$" maxlength="18" required="required" value="{:sysconf('wechat_appid')}" class="layui-input">
<p class="help-block">公众号应用ID是所有接口必要参数可以在公众号平台 [ 开发 > 基本配置 ] 页面获取。</p>
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label">AppSecret<br><span class="nowrap color-desc">公众号密钥</span></label>
<div class="col-sm-8">
<input type="text" name="wechat_appsecret" required="required" title="请输入32位公众号AppSecret" placeholder="公众号AppSecret必填" value="{:sysconf('wechat_appsecret')}" maxlength="32" pattern="^[0-9a-z]{32}$" class="layui-input">
<p class="help-block">公众号应用密钥是所有接口必要参数,可以在公众号平台 [ 开发 > 基本配置 ] 页面授权后获取。</p>
</div>
</div>
<div class="row form-group">
<label class="col-sm-2 control-label">EncodingAESKey<br><span class="nowrap color-desc">消息加密密钥</span></label>
<div class="col-sm-8">
<input type="text" name="wechat_encodingaeskey" title="请输入43位消息加密密钥" placeholder="消息加密密钥,若开启了消息加密时必需填写(可选)" value="{:sysconf('wechat_encodingaeskey')}" maxlength="43" class="layui-input">
<p class="help-block">公众号平台接口设置为加密模式,消息加密密钥必需填写并保持与公众号平台一致。</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">AppUri<br><span class="nowrap color-desc">消息推送接口</span></label>
<div class='col-sm-8'>
<input type="text" name="wechat_appurl" required value="{:url('@wechat/api.push/notify','',true,true)}" title="请输入公众号接口通知URL" placeholder="公众号接口通知URL必填" class="layui-input layui-bg-gray">
<p class="help-block">公众号服务平台接口通知URL, 公众号消息接收与回复等。</p>
</div>
</div>
<div class="hr-line-dashed"></div>
</div>
<div data-api-type="thr" class="hide">
<!--{if !empty($wechat)}-->
<div class="row">
<div class="col-sm-2 control-label">QRCode<br><span class="nowrap color-desc">公众号二维码</span></div>
<div class="col-sm-10">
<div class="pull-left notselect">
<img data-tips-image src="{$wechat.qrcode_url|local_image}" style="width:95px;margin-left:-10px">
</div>
<div class="pull-left padding-left-10">
<p class="margin-bottom-2 nowrap">微信昵称:{$wechat.nick_name}</p>
<p class="margin-bottom-2 nowrap">微信类型:{if $wechat.service_type_info eq 2}服务号{elseif $wechat.service_type_info eq 3}小程序{else}订阅号{/if} /
{$wechat.verify_type_info == -1 ? '未认证' : '<span class="color-green">已认证</span>'}</p>
<p class="margin-bottom-2 nowrap">注册公司:{$wechat.principal_name}</p>
<p class=" nowrap">授权绑定:{$wechat.create_at|format_datetime}</p>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<!--{/if}-->
<div class="row form-group">
<label class="col-sm-2 control-label">Authorize<br><span class="nowrap color-desc">公众号授权绑定</span></label>
<div class="col-sm-8">
<button type="button" data-href='{$authurl}' class='layui-btn layui-btn-primary'>{$wechat?'重新绑定公众号':'立即绑定公众号'}</button>
<p class="help-block">点击连接将跳转到微信第三方平台进行公众号授权。</p>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">AppId<br><span class="nowrap color-desc">公众号服务标识</span></label>
<div class='col-sm-8'>
<input type="text" name="wechat_thr_appid" required value="{$appid}" title="请输入以wx开头的18位公众号APPID" placeholder="公众号APPID必填" pattern="^wx[0-9a-z]{16}$" maxlength="18" class="layui-input">
<p class="help-block">公众号 appid 通过微信第三方授权自动获取. 若没有值请进行微信第三方授权。</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">AppKey<br><span class="nowrap color-desc">第三方服务密钥</span></label>
<div class='col-sm-8'>
<input type="text" name="wechat_thr_appkey" required value="{$appkey}" title="请输入32位公众号AppSecret" placeholder="公众号AppSecret必填" maxlength="32" pattern="^[0-9a-z]{32}$" class="layui-input">
<p class="help-block">公众号服务平台接口密钥, 通过微信第三方授权自动获取, 若没有值请进行微信第三方授权。</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">AppUri<br><span class="nowrap color-desc">第三方推送接口</span></label>
<div class='col-sm-8'>
<input type="text" name="wechat_thr_appurl" required value="{:url('@wechat/api.push', '', true, true)}" title="请输入公众号接口通知URL" placeholder="公众号接口通知URL必填" class="layui-input layui-bg-gray">
<p class="help-block">公众号服务平台接口通知URL, 公众号消息接收与回复等。</p>
</div>
</div>
<div class="hr-line-dashed"></div>
</div>
<div class="col-sm-6 col-sm-offset-2">
<div class="layui-form-item text-center">
<button class="layui-btn" type="submit">保存配置</button>
</div>
</div>
</form>
<script>
$(function () {
updateViwe();
$('[name="wechat_type"]').on('click', updateViwe);
function updateViwe() {
var type = $('[name="wechat_type"]:checked').val();
$('[data-api-type]').not($('[data-api-type="' + type + '"]').removeClass('hide')).addClass('hide');
}
});
</script>
{/block}