mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-09-17 09:16:40 +08:00
更新插件管理
This commit is contained in:
parent
d5c43e28af
commit
6e42b0359e
@ -68,10 +68,8 @@ class PluginController extends BaseController
|
|||||||
{
|
{
|
||||||
$platform = $this->request->post('platform');
|
$platform = $this->request->post('platform');
|
||||||
if (!$platform) return json(backMsg(1, '请选择插件'));
|
if (!$platform) return json(backMsg(1, '请选择插件'));
|
||||||
$res2 = $this->delPluginFile($platform);
|
$this->delPluginFile($platform);
|
||||||
if (!$res2) return json(backMsg(1, '插件文件不存在'));
|
$this->delPlugin($platform);
|
||||||
$res1 = $this->delPlugin($platform);
|
|
||||||
if (!$res1) return json(backMsg(1, '插件配置不存在'));
|
|
||||||
return json(backMsg(0, '卸载成功'));
|
return json(backMsg(0, '卸载成功'));
|
||||||
}
|
}
|
||||||
// 添加或更新插件
|
// 添加或更新插件
|
||||||
|
@ -18,12 +18,24 @@ return array (
|
|||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
array (
|
array (
|
||||||
'platform' => 'ysepay',
|
'platform' => 'sqbpay',
|
||||||
'name' => '小Y经营',
|
'name' => '收钱吧',
|
||||||
'class_name' => 'YsePay',
|
'class_name' => 'ShouQianBa',
|
||||||
'price' => NULL,
|
'price' => NULL,
|
||||||
'describe' => '为商户和消费者提供安全、便捷、高效的支付产品与服务助力商户提升运营效率,实现数字化运营',
|
'describe' => '主流移动支付全能收 信用卡,花呗都能用,生意帮手收钱吧,移动收款就用它!',
|
||||||
'website' => 'https://xym.ysepay.com',
|
'website' => 'https://www.shouqianba.com',
|
||||||
|
'helplink' => '',
|
||||||
|
'version' => '1.0',
|
||||||
|
'state' => 1,
|
||||||
|
),
|
||||||
|
2 =>
|
||||||
|
array (
|
||||||
|
'platform' => 'alipay',
|
||||||
|
'name' => '支付宝',
|
||||||
|
'class_name' => 'AliPay',
|
||||||
|
'price' => NULL,
|
||||||
|
'describe' => '支持支付宝个人收款码、经营码收款,监听回调',
|
||||||
|
'website' => 'https://www.alipay.com',
|
||||||
'helplink' => '',
|
'helplink' => '',
|
||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
'state' => 1,
|
'state' => 1,
|
||||||
|
@ -173,53 +173,71 @@
|
|||||||
}
|
}
|
||||||
// 卸载插件
|
// 卸载插件
|
||||||
plugin.uninstall = async (config) => {
|
plugin.uninstall = async (config) => {
|
||||||
|
const load = layer.load(2);
|
||||||
const res = await fetch('/api/Plugin/uninstallPlugin', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) });
|
const res = await fetch('/api/Plugin/uninstallPlugin', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) });
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
||||||
|
layer.close(load);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const rec_info = await res.json();
|
const rec_info = await res.json();
|
||||||
if (rec_info.code === 0) {
|
if (rec_info.code === 0) {
|
||||||
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('plugin-table'); });
|
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('plugin-table'); });
|
||||||
|
layer.close(load);
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
||||||
|
layer.close(load);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 安装插件
|
// 安装插件
|
||||||
plugin.install = async (config, step = 0) => {
|
plugin.install = async (config, step = 0) => {
|
||||||
|
// 加载中
|
||||||
|
const load = layer.load(2);
|
||||||
const res = await fetch('/api/Plugin/installPlugin', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) });
|
const res = await fetch('/api/Plugin/installPlugin', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) });
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
|
layer.close(load);
|
||||||
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const rec_info = await res.json();
|
const rec_info = await res.json();
|
||||||
// 错误信息
|
// 错误信息
|
||||||
if (rec_info.code !== 0) {
|
if (rec_info.code !== 0) {
|
||||||
|
layer.close(load);
|
||||||
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const info = rec_info.data;
|
const info = rec_info.data;
|
||||||
if (rec_info.state === 0) {
|
if (rec_info.state === 0) {
|
||||||
plugin.pay(info, config.platform, step);
|
plugin.pay(info, config.platform, step);
|
||||||
|
layer.close(load);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// 安装成功
|
// 安装成功
|
||||||
|
layer.close(load);
|
||||||
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('plugin-table'); });
|
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('plugin-table'); });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新插件
|
// 更新插件
|
||||||
plugin.update = async (config) => {
|
plugin.update = async (config) => {
|
||||||
|
const load = layer.load(2);
|
||||||
const res = await fetch('/api/Plugin/updatePlugin', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) });
|
const res = await fetch('/api/Plugin/updatePlugin', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) });
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
||||||
|
layer.close(load);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const rec_info = await res.json();
|
const rec_info = await res.json();
|
||||||
if (rec_info.code === 0) {
|
if (rec_info.code === 0) {
|
||||||
|
layer.close(load);
|
||||||
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('plugin-table'); });
|
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('plugin-table'); });
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
layer.close(load);
|
||||||
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 支付费用
|
// 支付费用
|
||||||
@ -247,6 +265,7 @@
|
|||||||
},
|
},
|
||||||
yes: (index) => {
|
yes: (index) => {
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
|
layer.load(2);
|
||||||
plugin.install({ platform: platform }, 1);
|
plugin.install({ platform: platform }, 1);
|
||||||
},
|
},
|
||||||
btn2: (index) => {
|
btn2: (index) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user