mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-09-21 03:06:39 +08:00
优化插件更新逻辑
This commit is contained in:
parent
ce65756874
commit
461f574b9d
@ -16,6 +16,6 @@ class IndexController
|
|||||||
}
|
}
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
return runtime_path();
|
return request()->domain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,7 @@ class OrderController extends BaseController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$servertime = date('Y-m-d H:i:s', time());
|
$servertime = date('Y-m-d H:i:s', time());
|
||||||
// 加载配置文件
|
|
||||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
|
||||||
View::assign('servertime', $servertime);
|
View::assign('servertime', $servertime);
|
||||||
View::assign('options', $option);
|
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
public function showOrder()
|
public function showOrder()
|
||||||
|
@ -234,6 +234,8 @@ class PayController
|
|||||||
} else {
|
} else {
|
||||||
return '监听收款配置文件名错误';
|
return '监听收款配置文件名错误';
|
||||||
}
|
}
|
||||||
|
// 当前站点
|
||||||
|
$user_config['host'] = \request()->domain();
|
||||||
// 实例化支付类
|
// 实例化支付类
|
||||||
$Mpay = new \MpayClass($user_config);
|
$Mpay = new \MpayClass($user_config);
|
||||||
// 获取订单
|
// 获取订单
|
||||||
|
@ -15,9 +15,6 @@ class PayManageController extends BaseController
|
|||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
// 加载配置文件
|
|
||||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
|
||||||
View::assign('options', $option);
|
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
// 编辑账号
|
// 编辑账号
|
||||||
@ -25,11 +22,8 @@ class PayManageController extends BaseController
|
|||||||
{
|
{
|
||||||
$id = $this->request->get('id');
|
$id = $this->request->get('id');
|
||||||
$account = PayAccount::find($id);
|
$account = PayAccount::find($id);
|
||||||
// 加载配置文件
|
|
||||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
|
||||||
View::assign([
|
View::assign([
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'options' => $option,
|
|
||||||
'platform' => $account->getData('platform'),
|
'platform' => $account->getData('platform'),
|
||||||
'account' => $account->account,
|
'account' => $account->account,
|
||||||
'password' => $account->password,
|
'password' => $account->password,
|
||||||
@ -41,9 +35,6 @@ class PayManageController extends BaseController
|
|||||||
// 添加账号
|
// 添加账号
|
||||||
public function addAccount()
|
public function addAccount()
|
||||||
{
|
{
|
||||||
// 加载配置文件
|
|
||||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
|
||||||
View::assign(['options' => $option]);
|
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
// 添加收款终端
|
// 添加收款终端
|
||||||
|
@ -31,4 +31,10 @@ class PluginController extends BaseController
|
|||||||
return json(\backMsg(1, '失败'));
|
return json(\backMsg(1, '失败'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 插件选项
|
||||||
|
public function pluginOption()
|
||||||
|
{
|
||||||
|
$option = Platform::field('platform,name')->where('state', 1)->select();
|
||||||
|
return json($option);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 支持平台
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
return array (
|
|
||||||
'sqbpay' => '收钱吧',
|
|
||||||
'storepay' => '数字门店',
|
|
||||||
'ysepay' => '小Y经营',
|
|
||||||
'mqpay' => '码钱',
|
|
||||||
);
|
|
@ -6,7 +6,7 @@ return [
|
|||||||
// 用户账号配置
|
// 用户账号配置
|
||||||
'user' => [
|
'user' => [
|
||||||
'pid' => 1001,
|
'pid' => 1001,
|
||||||
'key' => '7ImzF6Rf8OciQcmRJv8oTNBwIp6uqF0p'
|
'key' => '953c4d682d9ab148277b76a06e215ce7'
|
||||||
],
|
],
|
||||||
// 收款平台账号配置
|
// 收款平台账号配置
|
||||||
'pay' => [
|
'pay' => [
|
||||||
@ -14,20 +14,22 @@ return [
|
|||||||
'aid' => 1,
|
'aid' => 1,
|
||||||
// 收款平台
|
// 收款平台
|
||||||
'platform' => 'sqbpay',
|
'platform' => 'sqbpay',
|
||||||
|
// 收款平台
|
||||||
|
'payclass' => 'ShouQianBa',
|
||||||
// 账号
|
// 账号
|
||||||
'account' => '188*****423',
|
'account' => '18872410423',
|
||||||
// 密码
|
// 密码
|
||||||
'password' => '76********QB',
|
'password' => '7698177hcnSQB',
|
||||||
// 订单查询参数配置
|
// 订单查询参数配置
|
||||||
'query' => array(
|
'query' => array (
|
||||||
'date_end' => NULL,
|
'date_end' => NULL,
|
||||||
'date_start' => NULL,
|
'date_start' => NULL,
|
||||||
'page' => 1,
|
'page' => 1,
|
||||||
'page_size' => 10,
|
'page_size' => 10,
|
||||||
'upayQueryType' => 0,
|
'upayQueryType' => 0,
|
||||||
'status' => '2000',
|
'status' => '2000',
|
||||||
'store_sn' => '',
|
'store_sn' => '',
|
||||||
'type' => '30',
|
'type' => '30',
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
@ -4,15 +4,16 @@ class MpayClass
|
|||||||
{
|
{
|
||||||
private $pid;
|
private $pid;
|
||||||
private $key;
|
private $key;
|
||||||
private $host = 'https://mpay.zhaidashi.cn/';
|
private $host;
|
||||||
private $check_neworder_url;
|
private $check_neworder_url;
|
||||||
private $submit_records_url;
|
private $submit_records_url;
|
||||||
function __construct($config)
|
function __construct($config)
|
||||||
{
|
{
|
||||||
$this->pid = $config['pid'];
|
$this->pid = $config['pid'];
|
||||||
$this->key = $config['key'];
|
$this->key = $config['key'];
|
||||||
$this->check_neworder_url = $this->host . 'order.php';
|
$this->host = $config['host'];
|
||||||
$this->submit_records_url = $this->host . 'payHeart';
|
$this->check_neworder_url = $this->host . '/order.php';
|
||||||
|
$this->submit_records_url = $this->host . '/payHeart';
|
||||||
}
|
}
|
||||||
// 查询新订单
|
// 查询新订单
|
||||||
public function orderHeart()
|
public function orderHeart()
|
||||||
|
@ -17,13 +17,13 @@ class ShouQianBa
|
|||||||
$this->username = $config['username'];
|
$this->username = $config['username'];
|
||||||
$this->password = $config['password'];
|
$this->password = $config['password'];
|
||||||
// 检查token目录
|
// 检查token目录
|
||||||
$dir_path = runtime_path() . 'token/shouqianba';
|
$dir_path = runtime_path() . 'token/sqbpay';
|
||||||
if (!is_dir($dir_path)) {
|
if (!is_dir($dir_path)) {
|
||||||
if (!mkdir($dir_path, 755, true)) {
|
if (!mkdir($dir_path, 755, true)) {
|
||||||
echo '目录创建失败';
|
echo '目录创建失败';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->token_path = $dir_path . '/' . md5($this->username . $this->password . 'ShouQianBa') . '.json';
|
$this->token_path = $dir_path . '/' . md5($this->username . $this->password . 'sqbpay') . '.json';
|
||||||
if (!file_exists($this->token_path)) {
|
if (!file_exists($this->token_path)) {
|
||||||
// 失效Token刷新
|
// 失效Token刷新
|
||||||
$token_info = ['token' => 'Y2FjZmRiMi04MjRjLTQ2NDgtYTU0Ny1lNzg2MDllMTQ1ZTI6MTcxOTQ1Mzg0MzU3OTozNjAwMDAw.txcnX60Za8', 'expire_time' => 1719453843579];
|
$token_info = ['token' => 'Y2FjZmRiMi04MjRjLTQ2NDgtYTU0Ny1lNzg2MDllMTQ1ZTI6MTcxOTQ1Mzg0MzU3OTozNjAwMDAw.txcnX60Za8', 'expire_time' => 1719453843579];
|
||||||
|
@ -1 +1 @@
|
|||||||
{"code":0,"msg":"没有新订单"}
|
{"code":1,"msg":"\u67091\u4e2a\u65b0\u8ba2\u5355","orders":[{"id":27428,"pid":1001,"aid":1,"cid":1,"patt":1}]}
|
@ -64,11 +64,6 @@
|
|||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select name="platform">
|
<select name="platform">
|
||||||
<option value="">收款平台</option>
|
<option value="">收款平台</option>
|
||||||
<?php foreach ($options as $key => $value) { ?>
|
|
||||||
<option value="<?php echo $key ?>">
|
|
||||||
<?php echo $value ?>
|
|
||||||
</option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -128,7 +123,7 @@
|
|||||||
let dropdown = layui.dropdown;
|
let dropdown = layui.dropdown;
|
||||||
let laydate = layui.laydate;
|
let laydate = layui.laydate;
|
||||||
let util = layui.util;
|
let util = layui.util;
|
||||||
|
// 渲染时间选择器
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#create_time',
|
elem: '#create_time',
|
||||||
range: ['input[name="create_time_start"]', 'input[name="create_time_end"]'],
|
range: ['input[name="create_time_start"]', 'input[name="create_time_end"]'],
|
||||||
@ -190,8 +185,18 @@
|
|||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
// 渲染插件选项
|
||||||
|
(async () => {
|
||||||
|
const data = await fetch('/api/Plugin/pluginOption').then(res => res.json());
|
||||||
|
let option_str = `<option value="">收款平台</option>`;
|
||||||
|
data.forEach(val => {
|
||||||
|
option_str += `<option value="${val.platform}">${val.name}</option>`;
|
||||||
|
});
|
||||||
|
const select = document.querySelector('select[name="platform"]');
|
||||||
|
select.innerHTML = option_str;
|
||||||
|
form.render('select');
|
||||||
|
})()
|
||||||
|
// 表格列参数
|
||||||
let cols = [[
|
let cols = [[
|
||||||
{ type: 'checkbox' },
|
{ type: 'checkbox' },
|
||||||
{ title: '订单号', field: 'order_id', align: 'center', minWidth: 165, templet: '<div><a href="javascript:;" class="layui-font-blue" lay-event="showOrder">{{= d.order_id }}</a></div>' },
|
{ title: '订单号', field: 'order_id', align: 'center', minWidth: 165, templet: '<div><a href="javascript:;" class="layui-font-blue" lay-event="showOrder">{{= d.order_id }}</a></div>' },
|
||||||
@ -206,7 +211,7 @@
|
|||||||
{ title: '收款平台[账号:终端]', field: 'platform', align: 'center', minWidth: 160, templet: '<div>{{# return`${d.payAccount.platform} [${d.aid}:${d.cid}]` }}</div>' },
|
{ title: '收款平台[账号:终端]', field: 'platform', align: 'center', minWidth: 160, templet: '<div>{{# return`${d.payAccount.platform} [${d.aid}:${d.cid}]` }}</div>' },
|
||||||
{ title: '操作', align: 'center', width: 120, fixed: 'right', templet: '<div><strong><a href="javascript:;" data-id="{{= d.id }}" class="layui-font-green {{= d.state==1 ? "orderSet-paid" : "orderSet-paying" }}">设置</a></strong></div>' }
|
{ title: '操作', align: 'center', width: 120, fixed: 'right', templet: '<div><strong><a href="javascript:;" data-id="{{= d.id }}" class="layui-font-green {{= d.state==1 ? "orderSet-paid" : "orderSet-paying" }}">设置</a></strong></div>' }
|
||||||
]]
|
]]
|
||||||
|
// 表格渲染
|
||||||
table.render({
|
table.render({
|
||||||
id: 'orders-table',
|
id: 'orders-table',
|
||||||
elem: '#orders-table',
|
elem: '#orders-table',
|
||||||
|
@ -20,12 +20,7 @@
|
|||||||
<label class="layui-form-label">收款平台</label>
|
<label class="layui-form-label">收款平台</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<select name="platform">
|
<select name="platform">
|
||||||
<option value=""></option>
|
<option value="">收款平台</option>
|
||||||
<?php foreach ($options as $key => $value) { ?>
|
|
||||||
<option value="<?php echo $key ?>">
|
|
||||||
<?php echo $value ?>
|
|
||||||
</option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -72,6 +67,18 @@
|
|||||||
layui.use(['form'], function () {
|
layui.use(['form'], function () {
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
||||||
|
// 渲染插件选项
|
||||||
|
(async () => {
|
||||||
|
const data = await fetch('/api/Plugin/pluginOption').then(res => res.json());
|
||||||
|
let option_str = `<option value="">收款平台</option>`;
|
||||||
|
data.forEach(val => {
|
||||||
|
option_str += `<option value="${val.platform}">${val.name}</option>`;
|
||||||
|
});
|
||||||
|
const select = document.querySelector('select[name="platform"]');
|
||||||
|
select.innerHTML = option_str;
|
||||||
|
form.render('select');
|
||||||
|
})()
|
||||||
|
|
||||||
form.on('submit(add-account)', function (obj) {
|
form.on('submit(add-account)', function (obj) {
|
||||||
const field = obj.field;
|
const field = obj.field;
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@ -28,12 +28,7 @@
|
|||||||
<label class="layui-form-label">收款平台</label>
|
<label class="layui-form-label">收款平台</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<select name="platform">
|
<select name="platform">
|
||||||
<option value=""></option>
|
<option value="">收款平台</option>
|
||||||
<?php foreach ($options as $key => $value) { ?>
|
|
||||||
<option value="<?php echo $key ?>">
|
|
||||||
<?php echo $value ?>
|
|
||||||
</option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -86,14 +81,25 @@
|
|||||||
layui.use(['form'], function () {
|
layui.use(['form'], function () {
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
||||||
form.val('edit-account', {
|
// 渲染插件选项
|
||||||
|
(async () => {
|
||||||
|
const data = await fetch('/api/Plugin/pluginOption').then(res => res.json());
|
||||||
|
let option_str = `<option value="">收款平台</option>`;
|
||||||
|
data.forEach(val => {
|
||||||
|
option_str += `<option value="${val.platform}">${val.name}</option>`;
|
||||||
|
});
|
||||||
|
const select = document.querySelector('select[name="platform"]');
|
||||||
|
select.innerHTML = option_str;
|
||||||
|
form.render('select');
|
||||||
|
// 初始化表单
|
||||||
|
form.val('edit-account', {
|
||||||
"platform": "<?php echo $platform ?>",
|
"platform": "<?php echo $platform ?>",
|
||||||
"account": "<?php echo $account ?>",
|
"account": "<?php echo $account ?>",
|
||||||
"password": "<?php echo $password ?>",
|
"password": "<?php echo $password ?>",
|
||||||
"state": '<?php echo $state ?>' == 1 ? true : false,
|
"state": '<?php echo $state ?>' == 1 ? true : false,
|
||||||
"pattern": "<?php echo $pattern ?>",
|
"pattern": "<?php echo $pattern ?>",
|
||||||
});
|
});
|
||||||
|
})()
|
||||||
form.on('submit(save-account)', function (obj) {
|
form.on('submit(save-account)', function (obj) {
|
||||||
let field = obj.field;
|
let field = obj.field;
|
||||||
field.state = 'state' in field ? 1 : 0;
|
field.state = 'state' in field ? 1 : 0;
|
||||||
|
@ -82,8 +82,6 @@
|
|||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
||||||
form.val('edit-channel', {
|
form.val('edit-channel', {
|
||||||
"platform": "<?php echo $platform ?>",
|
|
||||||
"account": "<?php echo $account ?>",
|
|
||||||
"channel": "<?php echo $channel ?>",
|
"channel": "<?php echo $channel ?>",
|
||||||
"qrcode": "<?php echo $qrcode ?>",
|
"qrcode": "<?php echo $qrcode ?>",
|
||||||
"state": '<?php echo $state ?>' == 1 ? true : false
|
"state": '<?php echo $state ?>' == 1 ? true : false
|
||||||
|
@ -17,11 +17,6 @@
|
|||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select name="platform">
|
<select name="platform">
|
||||||
<option value="">收款平台</option>
|
<option value="">收款平台</option>
|
||||||
<?php foreach ($options as $key => $value) { ?>
|
|
||||||
<option value="<?php echo $key ?>">
|
|
||||||
<?php echo $value ?>
|
|
||||||
</option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -92,6 +87,18 @@
|
|||||||
let common = layui.common;
|
let common = layui.common;
|
||||||
let util = layui.util;
|
let util = layui.util;
|
||||||
|
|
||||||
|
// 渲染插件选项
|
||||||
|
(async () => {
|
||||||
|
const data = await fetch('/api/Plugin/pluginOption').then(res => res.json());
|
||||||
|
let option_str = `<option value="">收款平台</option>`;
|
||||||
|
data.forEach(val => {
|
||||||
|
option_str += `<option value="${val.platform}">${val.name}</option>`;
|
||||||
|
});
|
||||||
|
const select = document.querySelector('select[name="platform"]');
|
||||||
|
select.innerHTML = option_str;
|
||||||
|
form.render('select');
|
||||||
|
})()
|
||||||
|
|
||||||
let cols = [[
|
let cols = [[
|
||||||
{ type: 'checkbox' },
|
{ type: 'checkbox' },
|
||||||
{ title: '平 台', field: 'platform', align: 'center', templet: '' },
|
{ title: '平 台', field: 'platform', align: 'center', templet: '' },
|
||||||
|
Loading…
Reference in New Issue
Block a user