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