mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]完善公众号配置功能
This commit is contained in:
parent
8063709e03
commit
2b2b852361
@ -14,6 +14,7 @@
|
||||
namespace app\wechat\controller;
|
||||
|
||||
use controller\BasicAdmin;
|
||||
use service\DataService;
|
||||
|
||||
/**
|
||||
* 微信配置管理
|
||||
@ -24,13 +25,42 @@ use controller\BasicAdmin;
|
||||
*/
|
||||
class Config extends BasicAdmin {
|
||||
|
||||
/**
|
||||
* 定义当前操作表名
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'SystemConfig';
|
||||
|
||||
/**
|
||||
* 微信基础参数配置
|
||||
* @return \think\response\View
|
||||
*/
|
||||
public function index() {
|
||||
$this->assign('title', '微信接口配置');
|
||||
return view();
|
||||
if ($this->request->isGet()) {
|
||||
$this->assign('title', '微信接口配置');
|
||||
return view();
|
||||
|
||||
}
|
||||
$data = $this->request->post();
|
||||
foreach ($data as $key => $vo) {
|
||||
DataService::save($this->table, ['name' => $key, 'value' => $vo], 'name');
|
||||
}
|
||||
$this->success('数据修改成功!', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信商户参数配置
|
||||
* @return \think\response\View
|
||||
*/
|
||||
public function pay() {
|
||||
$this->assign('title', '微信支付配置');
|
||||
return view();
|
||||
if ($this->request->isGet()) {
|
||||
$this->assign('title', '微信支付配置');
|
||||
return view();
|
||||
}
|
||||
$data = $this->request->post();
|
||||
foreach ($data as $key => $vo) {
|
||||
DataService::save($this->table, ['name' => $key, 'value' => $vo], 'name');
|
||||
}
|
||||
$this->success('数据修改成功!', '');
|
||||
}
|
||||
}
|
||||
|
@ -1,75 +1,71 @@
|
||||
{extend name="extra@admin/content"}
|
||||
|
||||
{block name="content"}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form class="layui-form layui-box" data-auto="" method="post">
|
||||
<fieldset class="layui-elem-field">
|
||||
<legend>微信对接参数</legend>
|
||||
<div class="layui-field-box" style="padding-right:35px">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-inline well" style="width:70%">
|
||||
<div class="input-group">
|
||||
<input type="text" readonly
|
||||
onmouseenter="this.focus(),this.select()"
|
||||
onmouseover="console.log([this])"
|
||||
value="{:url('@wechat/api','',true,true)}"
|
||||
class="layui-input">
|
||||
<a class="input-group-addon" data-tips-text="复制" data-copy="">
|
||||
<i class="fa fa-copy"></i>
|
||||
</a>
|
||||
</div>
|
||||
<p class="help-block" style='margin-bottom:10px'>
|
||||
注意:接口链接的域名必需要备案,分别支持80端口和443端口,建议使用80端口。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<form onsubmit="return false;" action="{:request()->url(true)}" data-auto="true" method="post" class='form-horizontal'
|
||||
style='padding-top:20px'>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">APPID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="wechat_appid" required="required" title="请输入公众号APPID"
|
||||
placeholder="公众号APPID(必填)" value="{:sysconf('wechat_appid')}" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">AppSecret</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="wechat_appsecret" required="required" title="请输入公众号AppSecret"
|
||||
placeholder="公众号AppSecret(必填)" value="{:sysconf('wechat_appsecret')}"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">Token</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="wechat_token" required="required" title="请输入TOKEN"
|
||||
placeholder="接口认证TOKEN(必填)" value="{:sysconf('wechat_token')}" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">AesKey</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="wechat_encodingaeskey"
|
||||
title='请输入43位消息加密密钥' pattern="^.{43}$" maxlength='43'
|
||||
placeholder="消息加密密钥,若开启了消息加密时必需填写(可选)"
|
||||
value="{:sysconf('wechat_encodingaeskey')}" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" type="submit">立即提交</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label">URL(服务器地址)</label>
|
||||
<div class="col-sm-8">
|
||||
<input readonly onmouseenter="this.select()" value="{:url('@wechat/api','',true,true)}" class="layui-input">
|
||||
<p class="help-block">
|
||||
注意:接口链接的域名必需要备案,目前微信官方只支持80端口和443端口。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">AppID(应用ID)</label>
|
||||
<div class='col-sm-8'>
|
||||
<input type="text" name="wechat_appid" required="required" title="请输入公众号APPID"
|
||||
placeholder="公众号APPID(必填)" value="{:sysconf('wechat_appid')}" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label">AppSecret(应用密钥)</label>
|
||||
<div class='col-sm-8'>
|
||||
<input type="text" name="wechat_appsecret" required="required" title="请输入公众号AppSecret"
|
||||
placeholder="公众号AppSecret(必填)" value="{:sysconf('wechat_appsecret')}"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label">Token(令牌)</label>
|
||||
<div class='col-sm-8'>
|
||||
<input type="text" name="wechat_token" required="required" title="请输入接口Token(令牌)"
|
||||
placeholder="公众号AppSecret(必填)" value="{:sysconf('wechat_token')}"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 col-xs-3 control-label">EncodingAESKey</label>
|
||||
<div class='col-sm-8'>
|
||||
<input type="text" name="wechat_encodingaeskey" required="required" title="请输入43位消息加密密钥"
|
||||
placeholder="消息加密密钥,若开启了消息加密时必需填写(可选)" value="{:sysconf('wechat_encodingaeskey')}"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="col-sm-9">
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" type="submit">立即提交</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{/block}
|
@ -1,67 +1,63 @@
|
||||
{extend name="extra@admin/content"}
|
||||
|
||||
{block name="content"}
|
||||
<form onsubmit="return false;"
|
||||
action="{:url()}"
|
||||
data-auto="true"
|
||||
method="POST"
|
||||
class='form-horizontal'
|
||||
<form onsubmit="return false;" action="{:request()->url(true)}" data-auto="true" method="post" class='form-horizontal'
|
||||
style='padding-top:20px'>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">商户 ID</label>
|
||||
<div class='col-sm-9'>
|
||||
<input type='tel'
|
||||
placeholder="请输入10位商户MCH_ID(必填)"
|
||||
title='请输入10位数字商户MCH_ID'
|
||||
required="required"
|
||||
pattern="^\d{10}$"
|
||||
maxlength='10'
|
||||
name='wechat_mch_id'
|
||||
class='form-control input-sm'
|
||||
value='{:sysconf("wechat_mch_id")}'/>
|
||||
<div class="col-xs-8 col-xs-offset-1 text-center">
|
||||
<h1 style="font-size:24px">商户支付配置</h1>
|
||||
<div class="hr-line-dashed"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">商户ID</label>
|
||||
<div class='col-sm-7'>
|
||||
<input type='tel' placeholder="请输入10位商户MCH_ID(必填)" title='请输入10位数字商户MCH_ID'
|
||||
required="required" pattern="^\d{10}$" maxlength='10' name='wechat_mch_id'
|
||||
value='{:sysconf("wechat_mch_id")}' class='layui-input'/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">商户密钥</label>
|
||||
<div class='col-sm-9'>
|
||||
<input type='password'
|
||||
placeholder="请输入32位商户密钥(必填)"
|
||||
pattern="^.{32}$"
|
||||
maxlength="32"
|
||||
required title='请输入32位商户密钥'
|
||||
name='wechat_partnerkey'
|
||||
class='form-control input-sm'
|
||||
value='{:sysconf("wechat_partnerkey")}'/>
|
||||
<div class='col-sm-7'>
|
||||
<input type='password' placeholder="请输入32位商户支付密钥(必填)" required title='请输入32位商户支付密钥'
|
||||
pattern="^.{32}$" maxlength="32" name='wechat_partnerkey'
|
||||
value='{:sysconf("wechat_partnerkey")}' class='layui-input'/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">支付证书</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-7">
|
||||
<input onchange="$(this).next().html('已选择支付证书 (cert.zip)'), $('[data-pay-test]').remove()"
|
||||
type="hidden" name="cert_zip" value=""/>
|
||||
<div class="well" style="width:54%;text-align:center;cursor:pointer" data-file
|
||||
<div class="well" style="text-align:center;cursor:pointer" data-file
|
||||
data-type="zip" data-field="cert_zip" data-uptype="local" data-one="true">
|
||||
<span class="fa fa-check-circle-o" style="color:#00B83F;font-size:16px"></span>
|
||||
已设置支付证书 (cert.zip)
|
||||
</div>
|
||||
<p class="help-block">退款操作时需要上传此证书,在<a href="https://pay.weixin.qq.com" target="_blank">微信支付商户平台</a>下载cert.zip,直接上传即可!
|
||||
<p class="help-block">
|
||||
企业打款、企业红包、订单退款等操作需要使用双向证书,可在<a href="https://pay.weixin.qq.com" target="_blank">微信商户平台</a>下载证书!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<input type='hidden' name='id' value='10000'/>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-6 col-sm-offset-2 text-center">
|
||||
<button type="submit" class="btn btn-success navbar-btn">保存配置</button>
|
||||
<button type="button" onerror="alert(this.src)" data-pay-test
|
||||
class="btn btn-warning navbar-btn">支付测试
|
||||
<button type="submit" class="layui-btn">保存配置</button>
|
||||
<button type="button" onerror="alert(this.src)" data-pay-test class="layui-btn layui-btn-primary">支付测试
|
||||
</button>
|
||||
<style>
|
||||
.pay-qrc-test {
|
||||
|
@ -48,11 +48,11 @@ require.config({
|
||||
'template': ['../plugs/template/template'],
|
||||
},
|
||||
shim: {
|
||||
'laydate': {deps: ['jquery']},
|
||||
'layui': {deps: ['jquery']},
|
||||
'socket': {deps: ['//cdn.bootcss.com/swfobject/2.2/swfobject.min.js']},
|
||||
'laydate': {deps: ['jquery']},
|
||||
'bootstrap': {deps: ['jquery']},
|
||||
'pcasunzips': {deps: ['jquery']},
|
||||
'socket': {deps: ['//cdn.bootcss.com/swfobject/2.2/swfobject.min.js']},
|
||||
'bootstrap.multiselect': {deps: ['jquery', 'bootstrap', 'css!//cdn.bootcss.com/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css']},
|
||||
'jquery.ztree': {deps: ['jquery', 'css!//cdn.bootcss.com/zTree.v3/3.5.28/css/zTreeStyle/zTreeStyle.min.css']},
|
||||
'jquery.icheck': {deps: ['jquery', 'bootstrap', 'css!//cdn.bootcss.com/iCheck/1.0.2/skins/square/blue.css']},
|
||||
@ -61,7 +61,7 @@ require.config({
|
||||
'admin.listen': {deps: ['jquery', 'jquery.cookies', 'admin.plugs']},
|
||||
},
|
||||
deps: ['css!//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css'],
|
||||
// 开启debug模式,不缓存资源
|
||||
// 开启debug模式,不缓存资源
|
||||
urlArgs: "t=" + (new Date()).getTime()
|
||||
});
|
||||
|
||||
@ -72,7 +72,7 @@ window.LAYDATE_PATH = baseUrl + '../plugs/layui/laydate/';
|
||||
// UI框架初始化
|
||||
require(['pace', 'jquery', 'layui', 'bootstrap', 'jquery.cookies'], function () {
|
||||
layui.config({dir: baseUrl + '../plugs/layui/'});
|
||||
layui.use(['layer', 'form', 'element'], function () {
|
||||
layui.use(['layer', 'form'], function () {
|
||||
window.layer = layui.layer;
|
||||
window.form = layui.form();
|
||||
require(['admin.listen']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user