mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-09-20 18:56:39 +08:00
优化插件更新逻辑
This commit is contained in:
parent
ce65756874
commit
461f574b9d
@ -16,6 +16,6 @@ class IndexController
|
||||
}
|
||||
public function test()
|
||||
{
|
||||
return runtime_path();
|
||||
return request()->domain();
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,7 @@ class OrderController extends BaseController
|
||||
public function index()
|
||||
{
|
||||
$servertime = date('Y-m-d H:i:s', time());
|
||||
// 加载配置文件
|
||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
||||
View::assign('servertime', $servertime);
|
||||
View::assign('options', $option);
|
||||
return View::fetch();
|
||||
}
|
||||
public function showOrder()
|
||||
|
@ -234,6 +234,8 @@ class PayController
|
||||
} else {
|
||||
return '监听收款配置文件名错误';
|
||||
}
|
||||
// 当前站点
|
||||
$user_config['host'] = \request()->domain();
|
||||
// 实例化支付类
|
||||
$Mpay = new \MpayClass($user_config);
|
||||
// 获取订单
|
||||
|
@ -15,9 +15,6 @@ class PayManageController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// 加载配置文件
|
||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
||||
View::assign('options', $option);
|
||||
return View::fetch();
|
||||
}
|
||||
// 编辑账号
|
||||
@ -25,11 +22,8 @@ class PayManageController extends BaseController
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$account = PayAccount::find($id);
|
||||
// 加载配置文件
|
||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
||||
View::assign([
|
||||
'id' => $id,
|
||||
'options' => $option,
|
||||
'platform' => $account->getData('platform'),
|
||||
'account' => $account->account,
|
||||
'password' => $account->password,
|
||||
@ -41,9 +35,6 @@ class PayManageController extends BaseController
|
||||
// 添加账号
|
||||
public function addAccount()
|
||||
{
|
||||
// 加载配置文件
|
||||
$option = \think\facade\Config::load("extendconfig/platform", 'extendconfig');
|
||||
View::assign(['options' => $option]);
|
||||
return View::fetch();
|
||||
}
|
||||
// 添加收款终端
|
||||
|
@ -31,4 +31,10 @@ class PluginController extends BaseController
|
||||
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' => [
|
||||
'pid' => 1001,
|
||||
'key' => '7ImzF6Rf8OciQcmRJv8oTNBwIp6uqF0p'
|
||||
'key' => '953c4d682d9ab148277b76a06e215ce7'
|
||||
],
|
||||
// 收款平台账号配置
|
||||
'pay' => [
|
||||
@ -14,10 +14,12 @@ return [
|
||||
'aid' => 1,
|
||||
// 收款平台
|
||||
'platform' => 'sqbpay',
|
||||
// 收款平台
|
||||
'payclass' => 'ShouQianBa',
|
||||
// 账号
|
||||
'account' => '188*****423',
|
||||
'account' => '18872410423',
|
||||
// 密码
|
||||
'password' => '76********QB',
|
||||
'password' => '7698177hcnSQB',
|
||||
// 订单查询参数配置
|
||||
'query' => array (
|
||||
'date_end' => NULL,
|
||||
|
@ -4,15 +4,16 @@ class MpayClass
|
||||
{
|
||||
private $pid;
|
||||
private $key;
|
||||
private $host = 'https://mpay.zhaidashi.cn/';
|
||||
private $host;
|
||||
private $check_neworder_url;
|
||||
private $submit_records_url;
|
||||
function __construct($config)
|
||||
{
|
||||
$this->pid = $config['pid'];
|
||||
$this->key = $config['key'];
|
||||
$this->check_neworder_url = $this->host . 'order.php';
|
||||
$this->submit_records_url = $this->host . 'payHeart';
|
||||
$this->host = $config['host'];
|
||||
$this->check_neworder_url = $this->host . '/order.php';
|
||||
$this->submit_records_url = $this->host . '/payHeart';
|
||||
}
|
||||
// 查询新订单
|
||||
public function orderHeart()
|
||||
|
@ -17,13 +17,13 @@ class ShouQianBa
|
||||
$this->username = $config['username'];
|
||||
$this->password = $config['password'];
|
||||
// 检查token目录
|
||||
$dir_path = runtime_path() . 'token/shouqianba';
|
||||
$dir_path = runtime_path() . 'token/sqbpay';
|
||||
if (!is_dir($dir_path)) {
|
||||
if (!mkdir($dir_path, 755, true)) {
|
||||
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)) {
|
||||
// 失效Token刷新
|
||||
$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">
|
||||
<select name="platform">
|
||||
<option value="">收款平台</option>
|
||||
<?php foreach ($options as $key => $value) { ?>
|
||||
<option value="<?php echo $key ?>">
|
||||
<?php echo $value ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -128,7 +123,7 @@
|
||||
let dropdown = layui.dropdown;
|
||||
let laydate = layui.laydate;
|
||||
let util = layui.util;
|
||||
|
||||
// 渲染时间选择器
|
||||
laydate.render({
|
||||
elem: '#create_time',
|
||||
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 = [[
|
||||
{ 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>' },
|
||||
@ -206,7 +211,7 @@
|
||||
{ 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>' }
|
||||
]]
|
||||
|
||||
// 表格渲染
|
||||
table.render({
|
||||
id: 'orders-table',
|
||||
elem: '#orders-table',
|
||||
|
@ -20,12 +20,7 @@
|
||||
<label class="layui-form-label">收款平台</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="platform">
|
||||
<option value=""></option>
|
||||
<?php foreach ($options as $key => $value) { ?>
|
||||
<option value="<?php echo $key ?>">
|
||||
<?php echo $value ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<option value="">收款平台</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -72,6 +67,18 @@
|
||||
layui.use(['form'], function () {
|
||||
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) {
|
||||
const field = obj.field;
|
||||
(async () => {
|
||||
|
@ -28,12 +28,7 @@
|
||||
<label class="layui-form-label">收款平台</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="platform">
|
||||
<option value=""></option>
|
||||
<?php foreach ($options as $key => $value) { ?>
|
||||
<option value="<?php echo $key ?>">
|
||||
<?php echo $value ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<option value="">收款平台</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -86,6 +81,17 @@
|
||||
layui.use(['form'], function () {
|
||||
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.val('edit-account', {
|
||||
"platform": "<?php echo $platform ?>",
|
||||
"account": "<?php echo $account ?>",
|
||||
@ -93,7 +99,7 @@
|
||||
"state": '<?php echo $state ?>' == 1 ? true : false,
|
||||
"pattern": "<?php echo $pattern ?>",
|
||||
});
|
||||
|
||||
})()
|
||||
form.on('submit(save-account)', function (obj) {
|
||||
let field = obj.field;
|
||||
field.state = 'state' in field ? 1 : 0;
|
||||
|
@ -82,8 +82,6 @@
|
||||
let form = layui.form;
|
||||
|
||||
form.val('edit-channel', {
|
||||
"platform": "<?php echo $platform ?>",
|
||||
"account": "<?php echo $account ?>",
|
||||
"channel": "<?php echo $channel ?>",
|
||||
"qrcode": "<?php echo $qrcode ?>",
|
||||
"state": '<?php echo $state ?>' == 1 ? true : false
|
||||
|
@ -17,11 +17,6 @@
|
||||
<div class="layui-input-inline">
|
||||
<select name="platform">
|
||||
<option value="">收款平台</option>
|
||||
<?php foreach ($options as $key => $value) { ?>
|
||||
<option value="<?php echo $key ?>">
|
||||
<?php echo $value ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -92,6 +87,18 @@
|
||||
let common = layui.common;
|
||||
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 = [[
|
||||
{ type: 'checkbox' },
|
||||
{ title: '平 台', field: 'platform', align: 'center', templet: '' },
|
||||
|
Loading…
Reference in New Issue
Block a user