优化插件管理逻辑

This commit is contained in:
技术老胡 2025-02-24 13:07:07 +08:00
parent c469680ae4
commit 1d55442388
5 changed files with 18 additions and 38 deletions

View File

@ -223,14 +223,14 @@ class PayController
if ($config === false) return json(['code' => 4, 'msg' => '监听收款配置错误']);
// 登陆账号
$pay_config = ['username' => $config['account'], 'password' => $config['password']];
// 收款查询
$query = $config['query'];
// 配置参数
$params = $config['params'];
// 实例监听客户端
$payclient_name = $config['payclass'];
$payclient_path = "\\payclient\\{$payclient_name}";
$Payclient = new $payclient_path($pay_config);
// 获取支付明细
$records = $Payclient->getOrderInfo($query);
$records = $Payclient->getOrderInfo($params);
if ($records['code'] === 0) {
// 提交收款记录
$upres = $this->payHeart($records['data'], $config);

View File

@ -163,13 +163,13 @@ class PayManageController extends BaseController
// 登陆账号
$pay_config = ['username' => $config['account'], 'password' => $config['password']];
// 收款查询
$query = $config['query'];
$params = $config['params'];
// 实例监听客户端
$payclient_name = $config['payclass'];
$payclient_path = "\\payclient\\{$payclient_name}";
$Payclient = new $payclient_path($pay_config);
// 获取支付明细
$records = $Payclient->getOrderInfo($query);
$records = $Payclient->getOrderInfo($params);
if ($records['code'] === 0) {
// 收款流水
return json(backMsg(0, '查询成功', $records['data']));

View File

@ -34,7 +34,6 @@ class PayAccount extends BaseModel
$platform = PluginController::getPluginInfo($aid_info->getData('platform'));
// 查询参数
$params = json_decode($aid_info->params, true);
$query = array_merge($platform['query'], $params);
if ($aid_info && $platform) {
$config = [
'pid' => $aid_info->pid,
@ -48,8 +47,8 @@ class PayAccount extends BaseModel
'account' => $aid_info->account,
// 密码
'password' => $aid_info->password,
// 订单查询参数配置
'query' => $query,
// 配置参数
'params' => $params,
];
if ($pid !== null) {
$pid_info = User::where('pid', $pid)->find();

View File

@ -3,9 +3,9 @@
// | 支付插件列表
// +----------------------------------------------------------------------
return array (
0 =>
array (
return array(
0 =>
array(
'platform' => 'wxpay',
'name' => '微信支付',
'class_name' => 'WxPay',
@ -13,12 +13,9 @@ return array (
'describe' => '支持微信个人收款码、赞赏码、经营码、商家码收款,监听回调',
'website' => 'https://weixin.qq.com/',
'state' => 1,
'query' =>
array (
),
),
1 =>
array (
1 =>
array(
'platform' => 'alipay',
'name' => '支付宝',
'class_name' => 'AliPay',
@ -26,12 +23,9 @@ return array (
'describe' => '支持支付宝个人收款码、经营码收款,监听回调',
'website' => 'https://www.alipay.com/',
'state' => 1,
'query' =>
array (
),
),
2 =>
array (
2 =>
array(
'platform' => 'sqbpay',
'name' => '收钱吧',
'class_name' => 'ShouQianBa',
@ -39,20 +33,9 @@ return array (
'describe' => '主流移动支付全能收 信用卡,花呗都能用,生意帮手收钱吧,移动收款就用它!',
'website' => 'https://www.shouqianba.com/',
'state' => 1,
'query' =>
array (
'date_end' => NULL,
'date_start' => NULL,
'page' => 1,
'page_size' => 10,
'upayQueryType' => 0,
'status' => '2000',
'store_sn' => '',
'type' => '30',
),
),
3 =>
array (
3 =>
array(
'platform' => 'alipayb',
'name' => '支付宝账单',
'class_name' => 'AliPayb',
@ -60,8 +43,5 @@ return array (
'describe' => '支付宝账单查询回调,免挂机,稳定不掉线',
'website' => 'https://open.alipay.com/',
'state' => 1,
'query' =>
array (
),
),
);

View File

@ -126,10 +126,11 @@
const field = data.field;
(async () => {
const saveRes = await fetch('/install/install', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(field) });
if (saveRes.status != 200) { layer.msg('保存数据库配置失败'); return; }
const saveJson = await saveRes.json();
if (saveJson.code == 0) {
const initRes = await fetch('/install/init', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(field) });
if (initRes.status != 200) { layer.msg('初始化失败,请检查配置'); return; }
if (initRes.status != 200) { layer.msg('初始化数据失败,请检查配置'); return; }
const initJson = await initRes.json();
if (initJson.code == 0) {
layer.msg(initJson.msg, {