插件管理更新

This commit is contained in:
技术老胡 2024-10-23 15:56:10 +08:00
parent b4c2229cc1
commit 94de61fbda
13 changed files with 229 additions and 105 deletions

View File

@ -2,9 +2,9 @@ APP_DEBUG = true
DB_TYPE = mysql DB_TYPE = mysql
DB_HOST = 127.0.0.1 DB_HOST = 127.0.0.1
DB_NAME = mpay DB_NAME = test
DB_USER = admin DB_USER = test
DB_PASS = Aa123456 DB_PASS = 123456
DB_PORT = 3306 DB_PORT = 3306
DB_CHARSET = utf8 DB_CHARSET = utf8
DB_PREFIX = mpay_ DB_PREFIX = mpay_

6
.env
View File

@ -2,9 +2,9 @@ APP_DEBUG = true
DB_TYPE = mysql DB_TYPE = mysql
DB_HOST = 127.0.0.1 DB_HOST = 127.0.0.1
DB_NAME = test DB_NAME = mpay
DB_USER = test DB_USER = admin
DB_PASS = 123456 DB_PASS = Aa123456
DB_PORT = 3306 DB_PORT = 3306
DB_CHARSET = utf8 DB_CHARSET = utf8
DB_PREFIX = mpay_ DB_PREFIX = mpay_

View File

@ -3,6 +3,7 @@
namespace app\controller; namespace app\controller;
use think\facade\View; use think\facade\View;
use payclient\LaKaLa;
class IndexController class IndexController
{ {
@ -16,6 +17,8 @@ class IndexController
} }
public function test() public function test()
{ {
return request()->domain(); $key = "0383d7088b6947b68e4a626af119e2bd";
return $key;
} }
} }

View File

@ -17,6 +17,8 @@ class UserController extends BaseController
$userinfo = User::find(\session('userid'))->toArray(); $userinfo = User::find(\session('userid'))->toArray();
View::assign($userinfo); View::assign($userinfo);
View::assign('url', $this->request->domain()); View::assign('url', $this->request->domain());
$sign = md5($userinfo['pid'] . $userinfo['secret_key']);
View::assign('orderurl', $this->request->domain() . "/checkOrder/{$userinfo['pid']}/{$sign}");
return View::fetch(); return View::fetch();
} }
// 登陆视图 // 登陆视图

View File

@ -112,9 +112,9 @@ class PayManageController extends BaseController
// 生成账号配置 // 生成账号配置
private function createAccountConfig($acc) private function createAccountConfig($acc)
{ {
$platform = Platform::where('platform', $acc->getData('platform'))->find(); $platform = \app\controller\api\PluginController::getPluginInfo($acc->getData('platform'));
$user = User::where('pid', $acc->pid)->find(); $user = User::where('pid', $acc->pid)->find();
$query = var_export(\unserialize($platform->query), \true); $query = var_export($platform['query'], \true);
$config = <<<EOF $config = <<<EOF
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -125,7 +125,7 @@ return [
// 用户账号配置 // 用户账号配置
'user' => [ 'user' => [
'pid' => {$user->pid}, 'pid' => {$user->pid},
'key' => '$user->secret_key' 'key' => '{$user->secret_key}'
], ],
// 收款平台账号配置 // 收款平台账号配置
'pay' => [ 'pay' => [
@ -134,7 +134,7 @@ return [
// 收款平台 // 收款平台
'platform' => '{$acc->getData('platform')}', 'platform' => '{$acc->getData('platform')}',
// 插件类名 // 插件类名
'payclass' => '{$platform->class_name}', 'payclass' => '{$platform['class_name']}',
// 账号 // 账号
'account' => '{$acc->account}', 'account' => '{$acc->account}',
// 密码 // 密码

View File

@ -13,7 +13,7 @@ class PluginController extends BaseController
// 获取插件列表 // 获取插件列表
public function getPluginList() public function getPluginList()
{ {
$plugin_config = $this->getPluginConfig(); $plugin_config = self::getPluginConfig();
if ($plugin_config) { if ($plugin_config) {
return json(['code' => 0, 'msg' => 'OK', 'count' => \count($plugin_config), 'data' => $plugin_config]); return json(['code' => 0, 'msg' => 'OK', 'count' => \count($plugin_config), 'data' => $plugin_config]);
} else { } else {
@ -38,7 +38,7 @@ class PluginController extends BaseController
$config[$key] = $value; $config[$key] = $value;
} }
} }
$plugin_config = $this->getPluginConfig(); $plugin_config = self::getPluginConfig();
$plugin_platform = $config['platform'] ?: ''; $plugin_platform = $config['platform'] ?: '';
foreach ($plugin_config as $value) { foreach ($plugin_config as $value) {
if ($plugin_platform == $value['platform']) { if ($plugin_platform == $value['platform']) {
@ -52,7 +52,7 @@ class PluginController extends BaseController
// 删除插件 // 删除插件
public function delPlugin($plugin_name = '') public function delPlugin($plugin_name = '')
{ {
$plugin_config = $this->getPluginConfig(); $plugin_config = self::getPluginConfig();
$keys = []; $keys = [];
foreach ($plugin_config as $index => $value) { foreach ($plugin_config as $index => $value) {
if ($value['platform'] == $plugin_name) { if ($value['platform'] == $plugin_name) {
@ -69,9 +69,9 @@ class PluginController extends BaseController
// 修改插件 // 修改插件
public function setPlugin($platform = '', $option = []) public function setPlugin($platform = '', $option = [])
{ {
$config = $this->getPluginConfig(); $config = self::getPluginConfig();
if (!$platform) { if (!$platform) {
return 1; //'请选择插件' return 1; // 请选择插件
} }
if (!$option) { if (!$option) {
return 2; // 请添加插件配置 return 2; // 请添加插件配置
@ -103,39 +103,35 @@ class PluginController extends BaseController
public function pluginOption() public function pluginOption()
{ {
// 加载平台配置 // 加载平台配置
$config = $this->getPluginConfig(); $config = self::getPluginConfig();
$option = []; $option = [];
foreach ($config as $value) { foreach ($config as $value) {
$option[] = ['platform' => $value['platform'], 'name' => $value['name']]; $option[] = ['platform' => $value['platform'], 'name' => $value['name']];
} }
return json($option); return json($option);
} }
// 生成插件配置 // 获取指定插件配置
public function crtPlfConfig() public static function getPluginInfo($platform = '')
{ {
$info = Platform::where('state', 1)->field('platform, name')->select()->toArray(); $config = self::getPluginConfig();
$data = []; $info = [];
foreach ($info as $value) { foreach ($config as $item) {
$data[$value['platform']] = $value['name']; if ($item['platform'] == $platform) {
$info = $item;
break;
} }
$config = View::fetch('tpl/platform_config', $data);
$path = "../config/extendconfig/platform.php";
$res = \file_put_contents($path, $config);
if ($res) {
return \json(\backMsg(msg: '创建成功'));
} else {
return \json(\backMsg(1, '创建成功'));
} }
return $info;
} }
// 获取插件配置 // 获取插件配置
private function getPluginConfig(): array private static function getPluginConfig(): array
{ {
$payplugin_path = config_path() . '/extendconfig/payplugin.php'; $payplugin_path = config_path() . '/extendconfig/payplugin.php';
if (!file_exists($payplugin_path)) { if (!file_exists($payplugin_path)) {
return []; return [];
} }
// 加载插件配置 // 加载插件配置
$payplugin_config = require_once $payplugin_path; $payplugin_config = require $payplugin_path;
return $payplugin_config; return $payplugin_config;
} }
// 保存插件配置 // 保存插件配置

View File

@ -32,7 +32,7 @@ class PayAccount extends BaseModel
return []; return [];
} }
// 加载插件配置 // 加载插件配置
$payplugin_config = require_once $payplugin_path; $payplugin_config = require $payplugin_path;
$option = []; $option = [];
foreach ($payplugin_config as $config) { foreach ($payplugin_config as $config) {
$option[$config['platform']] = $config['name']; $option[$config['platform']] = $config['name'];

View File

@ -13,7 +13,17 @@ return array (
'describe' => '主流移动支付全能收 信用卡,花呗都能用,生意帮手收钱吧,移动收款就用它!', 'describe' => '主流移动支付全能收 信用卡,花呗都能用,生意帮手收钱吧,移动收款就用它!',
'website' => 'https://www.shouqianba.com/', 'website' => 'https://www.shouqianba.com/',
'state' => 1, 'state' => 1,
'query' => 'a:8:{s:8:"date_end";N;s:10:"date_start";N;s:4:"page";i:1;s:9:"page_size";i:10;s:13:"upayQueryType";i:0;s:6:"status";s:4:"2000";s:8:"store_sn";s:0:"";s:4:"type";s:2:"30";}', 'query' =>
array(
'date_end' => NULL,
'date_start' => NULL,
'page' => 1,
'page_size' => 10,
'upayQueryType' => 0,
'status' => '2000',
'store_sn' => '',
'type' => '30',
),
), ),
1 => 1 =>
array( array(
@ -24,7 +34,16 @@ return array (
'describe' => '数字门店', 'describe' => '数字门店',
'website' => 'https://store.zhihuijingyingba.com/', 'website' => 'https://store.zhihuijingyingba.com/',
'state' => 1, 'state' => 1,
'query' => 'a:7:{s:6:"pageNo";i:1;s:8:"pageSize";i:10;s:9:"payClient";i:4;s:6:"status";i:2;s:2:"_t";N;s:16:"createTime_begin";N;s:14:"createTime_end";N;}', 'query' =>
array(
'pageNo' => 1,
'pageSize' => 10,
'payClient' => 4,
'status' => 2,
'_t' => NULL,
'createTime_begin' => NULL,
'createTime_end' => NULL,
),
), ),
2 => 2 =>
array( array(
@ -35,7 +54,19 @@ return array (
'describe' => '为商户和消费者提供安全、便捷、高效的支付产品与服务助力商户提升运营效率,实现数字化运营', 'describe' => '为商户和消费者提供安全、便捷、高效的支付产品与服务助力商户提升运营效率,实现数字化运营',
'website' => 'https://xym.ysepay.com/', 'website' => 'https://xym.ysepay.com/',
'state' => 1, 'state' => 1,
'query' => 'a:10:{s:7:"storeNo";s:0:"";s:7:"bizType";i:3;s:7:"payType";s:0:"";s:11:"orderStatus";i:3;s:5:"trmNo";s:0:"";s:12:"operatorUser";s:0:"";s:13:"codeBoardCode";s:0:"";s:8:"pageSize";i:10;s:6:"pageNo";i:1;s:7:"orderNo";s:0:"";}', 'query' =>
array(
'storeNo' => '',
'bizType' => 3,
'payType' => '',
'orderStatus' => 3,
'trmNo' => '',
'operatorUser' => '',
'codeBoardCode' => '',
'pageSize' => 10,
'pageNo' => 1,
'orderNo' => '',
),
), ),
3 => 3 =>
array( array(
@ -46,7 +77,21 @@ return array (
'describe' => '码钱商管平台', 'describe' => '码钱商管平台',
'website' => 'https://m.hkrt.cn/', 'website' => 'https://m.hkrt.cn/',
'state' => 1, 'state' => 1,
'query' => 'a:12:{s:12:"terminalType";s:0:"";s:7:"payType";s:0:"";s:7:"payMode";s:0:"";s:11:"tradeStatus";s:1:"1";s:7:"tradeNo";s:0:"";s:7:"storeId";s:0:"";s:4:"page";i:1;s:4:"rows";i:10;s:7:"endDate";N;s:7:"endTime";N;s:9:"startDate";N;s:9:"startTime";N;}', 'query' =>
array(
'terminalType' => '',
'payType' => '',
'payMode' => '',
'tradeStatus' => '1',
'tradeNo' => '',
'storeId' => '',
'page' => 1,
'rows' => 10,
'endDate' => NULL,
'endTime' => NULL,
'startDate' => NULL,
'startTime' => NULL,
),
), ),
4 => 4 =>
array( array(
@ -57,7 +102,34 @@ return array (
'describe' => '数字支付,更安全,更高效', 'describe' => '数字支付,更安全,更高效',
'website' => 'https://customer.lakala.com/', 'website' => 'https://customer.lakala.com/',
'state' => 1, 'state' => 1,
'query' => '', 'query' =>
array(
'requestTime' => NULL,
'systemCode' => 'MERDASH',
'version' => '1.0',
'openEntity' => NULL,
'requestId' => NULL,
'pageSize' => 10,
'pageNum' => 1,
'startTime' => NULL,
'timeOption' => NULL,
'tranSts' => 'SUCCESS',
'orderNo' => NULL,
'srefno' => NULL,
'ornNo' => NULL,
'endTime' => NULL,
'startDate' => NULL,
'endDate' => NULL,
'page' => 1,
'size' => 10,
'merchantNos' => NULL,
'merInnerNos' => NULL,
),
'param' => [
'openEntity' => '822581058121GYW',
'merchantNos' => '822581058121GYW',
'merInnerNos' => '4002022071722760372',
],
), ),
5 => 5 =>
array( array(
@ -70,17 +142,4 @@ return array (
'state' => 0, 'state' => 0,
'query' => '', 'query' => '',
), ),
6 =>
array (
'platform' => 'haopay',
'name' => '好支付',
'class_name' => 'Haopay',
'price' => 99,
'describe' => '好支付',
'website' => 'https://store.zhihuijingyingba.com/',
'state' => 0,
'query' =>
array (
),
),
); );

View File

@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | 支付监听配置,一个文件,一个账号
// +----------------------------------------------------------------------
return [
// 用户账号配置
'user' => [
'pid' => 1001,
'key' => '953c4d682d9ab148277b76a06e215ce7'
],
// 收款平台账号配置
'pay' => [
// 账号id
'aid' => 7,
// 收款平台
'platform' => 'lklpay',
// 插件类名
'payclass' => 'LaKaLa',
// 账号
'account' => '13822254817',
// 密码
'password' => 'n8omf1FNqK+Irq9IlOPZJA==',
// 订单查询参数配置
'query' => array (
'requestTime' => NULL,
'systemCode' => 'MERDASH',
'version' => '1.0',
'openEntity' => '822581058121GYW',
'requestId' => NULL,
'pageSize' => 10,
'pageNum' => 1,
'startTime' => NULL,
'timeOption' => NULL,
'tranSts' => 'SUCCESS',
'orderNo' => NULL,
'srefno' => NULL,
'ornNo' => NULL,
'endTime' => NULL,
'startDate' => NULL,
'endDate' => NULL,
'page' => 1,
'size' => 10,
'merchantNos' => '822581058121GYW',
'merInnerNos' => '4002022071722760372',
),
]
];

View File

@ -97,6 +97,7 @@ class ShouQianBa
public function payQuery(array $query): array public function payQuery(array $query): array
{ {
$token = $this->getToken(); $token = $this->getToken();
if ($token) {
$url = $this->host . $this->find_transactions . '?client_version=7.0.0&token=' . $token; $url = $this->host . $this->find_transactions . '?client_version=7.0.0&token=' . $token;
$header = ['Content-Type: application/json;charset=UTF-8']; $header = ['Content-Type: application/json;charset=UTF-8'];
// 构建订单查询 // 构建订单查询
@ -136,6 +137,9 @@ class ShouQianBa
$moneyList['channel'] = $channel; $moneyList['channel'] = $channel;
} }
return $moneyList; return $moneyList;
} else {
return [];
}
} }
// 请求外部资源 // 请求外部资源
private function getHttpResponse($url, $header = [], $post = null, $timeout = 10) private function getHttpResponse($url, $header = [], $post = null, $timeout = 10)

Binary file not shown.

View File

@ -106,6 +106,7 @@
{ title: '密 码', field: 'password', align: 'center' }, { title: '密 码', field: 'password', align: 'center' },
{ title: '启用状态', field: 'state', align: 'center', templet: '#account-state' }, { title: '启用状态', field: 'state', align: 'center', templet: '#account-state' },
{ title: '监听模式', field: 'pattern', align: 'center' }, { title: '监听模式', field: 'pattern', align: 'center' },
{ title: '监听地址', field: 'payurl', align: 'center', templet: `<div>{{# return window.location.origin + '/checkPayResult?pid='+d.pid+'&aid='+d.id }}</div>` },
{ title: '终端数量', field: 'channel', align: 'center', templet: '<div><a href="javascript:;" lay-event="channelList"><span class="layui-badge layui-bg-green">{{= d.channel }}</span></a></div>' }, { title: '终端数量', field: 'channel', align: 'center', templet: '<div><a href="javascript:;" lay-event="channelList"><span class="layui-badge layui-bg-green">{{= d.channel }}</span></a></div>' },
{ title: '操作', align: 'center', fixed: 'right', templet: '<div><a href="javascript:;" class="layui-font-green" lay-event="edit"><strong>编辑</strong></a></div>' } { title: '操作', align: 'center', fixed: 'right', templet: '<div><a href="javascript:;" class="layui-font-green" lay-event="edit"><strong>编辑</strong></a></div>' }
]] ]]

View File

@ -19,7 +19,7 @@
<body class="pear-container"> <body class="pear-container">
<div style="padding: 8px;"> <div style="padding: 8px;">
<div class="layui-row layui-col-space16"> <div class="layui-row layui-col-space16">
<div class="layui-col-md4"> <div class="layui-col-md6">
<div class="layui-card"> <div class="layui-card">
<div class="userset"><a href="javascript:;" lay-on="setUser" title="设置"> <div class="userset"><a href="javascript:;" lay-on="setUser" title="设置">
<span class="icon pear-icon pear-icon-setting" style="font-size: 20px;"></span></a></div> <span class="icon pear-icon pear-icon-setting" style="font-size: 20px;"></span></a></div>
@ -81,11 +81,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-form-item" pane>
<label class="layui-form-label">订单监控</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-elip" style="margin-left: 10px;color: #5f5f5f;float: none;">
<?php echo $orderurl ?>
<a href="javascript:;" lay-on="copyinfo" data-info="<?php echo $orderurl ?>"
style="float: right;" title="复制"><span
class="icon pear-icon pear-icon-survey"></span></a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md8"> </div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-header"> <div class="layui-card-header">
我的文章 我的文章