数据库结构更新

This commit is contained in:
技术老胡
2024-10-23 17:22:21 +08:00
parent 94de61fbda
commit f4b322a5e8
8 changed files with 44 additions and 142 deletions

View File

@@ -28,7 +28,8 @@ class PayManageController extends BaseController
'account' => $account->account, 'account' => $account->account,
'password' => $account->password, 'password' => $account->password,
'state' => $account->state, 'state' => $account->state,
'pattern' => $account->getData('pattern') 'pattern' => $account->getData('pattern'),
'params' => $account->params,
]); ]);
return View::fetch(); return View::fetch();
} }

View File

@@ -29,7 +29,10 @@ class PayManageController extends BaseController
$up_res = PayAccount::update($info); $up_res = PayAccount::update($info);
if ($up_res) { if ($up_res) {
$acc = PayAccount::find($info['id']); $acc = PayAccount::find($info['id']);
$this->createAccountConfig($acc); $state = $this->createAccountConfig($acc);
if (!$state) {
return json(\backMsg(1, '自字义参数错误'));
}
return json(\backMsg(0, '修改成功')); return json(\backMsg(0, '修改成功'));
} else { } else {
return json(\backMsg(1, '修改失败')); return json(\backMsg(1, '修改失败'));
@@ -64,13 +67,17 @@ class PayManageController extends BaseController
$info = $this->request->post(); $info = $this->request->post();
$pid = $this->request->session('pid'); $pid = $this->request->session('pid');
$info['pid'] = $pid; $info['pid'] = $pid;
$info['params'] = '{}';
$check_acc = PayAccount::where(['account' => $info['account'], 'pid' => $pid])->find(); $check_acc = PayAccount::where(['account' => $info['account'], 'pid' => $pid])->find();
if ($check_acc) { if ($check_acc) {
return \json(\backMsg(1, '账号已存在')); return \json(\backMsg(1, '账号已存在'));
} }
$acc = PayAccount::create($info); $acc = PayAccount::create($info);
if ($acc) { if ($acc) {
$this->createAccountConfig($acc); $state = $this->createAccountConfig($acc);
if (!$state) {
return json(\backMsg(1, '自字义参数错误'));
}
return \json(\backMsg(0, '添加成功')); return \json(\backMsg(0, '添加成功'));
} else { } else {
return \json(\backMsg(1, '添加失败')); return \json(\backMsg(1, '添加失败'));
@@ -112,9 +119,14 @@ class PayManageController extends BaseController
// 生成账号配置 // 生成账号配置
private function createAccountConfig($acc) private function createAccountConfig($acc)
{ {
$params = \json_decode($acc->params, \true);
if ($params === null) {
return false; // 自定义参数错误
}
$platform = \app\controller\api\PluginController::getPluginInfo($acc->getData('platform')); $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($platform['query'], \true); $query_tpl = $platform['query'];
$query = var_export(\array_merge($query_tpl, $params), \true);
$config = <<<EOF $config = <<<EOF
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@@ -148,5 +160,6 @@ EOF;
$name = "{$user->pid}_{$acc->id}"; $name = "{$user->pid}_{$acc->id}";
$path = config_path() . "/payconfig/{$name}.php"; $path = config_path() . "/payconfig/{$name}.php";
\file_put_contents($path, $config); \file_put_contents($path, $config);
return true;
} }
} }

View File

@@ -10,7 +10,7 @@ use app\model\User;
class UserController extends BaseController class UserController extends BaseController
{ {
protected $middleware = ['Auth' => ['except' => ['login']]]; protected $middleware = ['Auth' => ['except' => ['login', 'resetKey']]];
public function login() public function login()
{ {

View File

@@ -23,7 +23,7 @@ return array(
'status' => '2000', 'status' => '2000',
'store_sn' => '', 'store_sn' => '',
'type' => '30', 'type' => '30',
), )
), ),
1 => 1 =>
array( array(
@@ -43,7 +43,7 @@ return array(
'_t' => NULL, '_t' => NULL,
'createTime_begin' => NULL, 'createTime_begin' => NULL,
'createTime_end' => NULL, 'createTime_end' => NULL,
), )
), ),
2 => 2 =>
array( array(
@@ -66,7 +66,7 @@ return array(
'pageSize' => 10, 'pageSize' => 10,
'pageNo' => 1, 'pageNo' => 1,
'orderNo' => '', 'orderNo' => '',
), )
), ),
3 => 3 =>
array( array(
@@ -91,7 +91,7 @@ return array(
'endTime' => NULL, 'endTime' => NULL,
'startDate' => NULL, 'startDate' => NULL,
'startTime' => NULL, 'startTime' => NULL,
), )
), ),
4 => 4 =>
array( array(
@@ -124,12 +124,7 @@ return array(
'size' => 10, 'size' => 10,
'merchantNos' => NULL, 'merchantNos' => NULL,
'merInnerNos' => NULL, 'merInnerNos' => NULL,
), )
'param' => [
'openEntity' => '822581058121GYW',
'merchantNos' => '822581058121GYW',
'merInnerNos' => '4002022071722760372',
],
), ),
5 => 5 =>
array( array(
@@ -140,6 +135,6 @@ return array(
'describe' => '轻松生活 放心支付', 'describe' => '轻松生活 放心支付',
'website' => 'https://b.shengpay.com/', 'website' => 'https://b.shengpay.com/',
'state' => 0, 'state' => 0,
'query' => '', 'query' => ''
), ),
); );

View File

@@ -1,36 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | 支付监听配置,一个文件,一个账号
// +----------------------------------------------------------------------
return [
// 用户账号配置
'user' => [
'pid' => 1001,
'key' => '953c4d682d9ab148277b76a06e215ce7'
],
// 收款平台账号配置
'pay' => [
// 账号id
'aid' => 1,
// 收款平台
'platform' => 'sqbpay',
// 插件类名
'payclass' => 'ShouQianBa',
// 账号
'account' => '14725836911',
// 密码
'password' => '123456',
// 订单查询参数配置
'query' => array (
'date_end' => NULL,
'date_start' => NULL,
'page' => 1,
'page_size' => 10,
'upayQueryType' => 0,
'status' => '2000',
'store_sn' => '',
'type' => '30',
),
]
];

View File

@@ -1,48 +0,0 @@
<?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

@@ -73,9 +73,10 @@ CREATE TABLE `mpay_pay_account` (
`password` varchar(255) NOT NULL DEFAULT '' COMMENT '密码', `password` varchar(255) NOT NULL DEFAULT '' COMMENT '密码',
`state` tinyint(4) NOT NULL DEFAULT '1' COMMENT '启用', `state` tinyint(4) NOT NULL DEFAULT '1' COMMENT '启用',
`pattern` tinyint(4) NOT NULL DEFAULT '0' COMMENT '账号监听模式', `pattern` tinyint(4) NOT NULL DEFAULT '0' COMMENT '账号监听模式',
`params` varchar(255) NOT NULL DEFAULT '' COMMENT '自定义查询',
`delete_time` timestamp NULL DEFAULT NULL COMMENT '软删除', `delete_time` timestamp NULL DEFAULT NULL COMMENT '软删除',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --
@@ -84,6 +85,7 @@ CREATE TABLE `mpay_pay_account` (
LOCK TABLES `mpay_pay_account` WRITE; LOCK TABLES `mpay_pay_account` WRITE;
/*!40000 ALTER TABLE `mpay_pay_account` DISABLE KEYS */; /*!40000 ALTER TABLE `mpay_pay_account` DISABLE KEYS */;
INSERT INTO `mpay_pay_account` VALUES (1,1001,'sqbpay','18872410423','7698177hcnSQB',1,0,'{}',NULL);
/*!40000 ALTER TABLE `mpay_pay_account` ENABLE KEYS */; /*!40000 ALTER TABLE `mpay_pay_account` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -103,7 +105,7 @@ CREATE TABLE `mpay_pay_channel` (
`state` tinyint(4) NOT NULL DEFAULT '1' COMMENT '启用', `state` tinyint(4) NOT NULL DEFAULT '1' COMMENT '启用',
`delete_time` timestamp NULL DEFAULT NULL COMMENT '软删除', `delete_time` timestamp NULL DEFAULT NULL COMMENT '软删除',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --
@@ -112,42 +114,10 @@ CREATE TABLE `mpay_pay_channel` (
LOCK TABLES `mpay_pay_channel` WRITE; LOCK TABLES `mpay_pay_channel` WRITE;
/*!40000 ALTER TABLE `mpay_pay_channel` DISABLE KEYS */; /*!40000 ALTER TABLE `mpay_pay_channel` DISABLE KEYS */;
INSERT INTO `mpay_pay_channel` VALUES (1,1,'24101820013292761382','https://qr.shouqianba.com/24101820013292761382','2024-10-19 02:23:37',1,NULL);
/*!40000 ALTER TABLE `mpay_pay_channel` ENABLE KEYS */; /*!40000 ALTER TABLE `mpay_pay_channel` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `mpay_platform`
--
DROP TABLE IF EXISTS `mpay_platform`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mpay_platform` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`platform` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '标记',
`name` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '名称',
`class_name` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '类名',
`price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '价格',
`describe` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '说明',
`website` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '官网',
`state` tinyint(4) NOT NULL DEFAULT '1' COMMENT '启用状态',
`query` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT 'API查询',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`delete_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `mpay_platform`
--
LOCK TABLES `mpay_platform` WRITE;
/*!40000 ALTER TABLE `mpay_platform` DISABLE KEYS */;
INSERT INTO `mpay_platform` VALUES (1,'sqbpay','收钱吧','ShouQianBa',99.00,'主流移动支付全能收 信用卡,花呗都能用,生意帮手收钱吧,移动收款就用它!','https://www.shouqianba.com/',1,'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\";}','2024-08-16 02:25:05',NULL),(2,'storepay','数字门店','ZhiHuiJingYing',99.00,'数字门店','https://store.zhihuijingyingba.com/',1,'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;}','2024-08-17 06:31:16',NULL),(3,'ysepay','小Y经营','Ysepay',99.00,'为商户和消费者提供安全、便捷、高效的支付产品与服务助力商户提升运营效率,实现数字化运营','https://xym.ysepay.com/',1,'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:\"\";}','2024-08-17 06:31:19',NULL),(4,'mqpay','码钱','MaQian',99.00,'码钱商管平台','https://m.hkrt.cn/',1,'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;}','2024-08-17 06:32:29',NULL),(5,'lklpay','拉卡拉','LaKaLa',99.00,'数字支付,更安全,更高效','https://customer.lakala.com/',1,'','2024-10-17 08:17:47',NULL),(6,'sftpay','盛付通','ShengPay',99.00,'轻松生活 放心支付','https://b.shengpay.com/',1,'','2024-10-17 08:18:35',NULL);
/*!40000 ALTER TABLE `mpay_platform` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `mpay_user` -- Table structure for table `mpay_user`
-- --
@@ -189,4 +159,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-10-19 9:31:50 -- Dump completed on 2024-10-23 17:17:20

View File

@@ -59,6 +59,12 @@
</select> </select>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">查询参数</label>
<div class="layui-input-block">
<textarea name="params" placeholder="填写账号自定义订单查询参数,JSON格式" class="layui-textarea"></textarea>
</div>
</div>
</div> </div>
</div> </div>
<div class="bottom"> <div class="bottom">
@@ -93,12 +99,13 @@
form.render('select'); form.render('select');
// 初始化表单 // 初始化表单
form.val('edit-account', { form.val('edit-account', {
"platform": "<?php echo $platform ?>", "platform": "<?php echo $platform ?>",
"account": "<?php echo $account ?>", "account": "<?php echo $account ?>",
"password": "<?php echo $password ?>", "password": "<?php echo $password ?>",
"state": '<?php echo $state ?>' == 1 ? true : false, "state": '<?php echo $state ?>' == 1 ? true : false,
"pattern": "<?php echo $pattern ?>", "pattern": "<?php echo $pattern ?>",
}); "params": `<?php echo $params ?>`,
});
})() })()
form.on('submit(save-account)', function (obj) { form.on('submit(save-account)', function (obj) {
let field = obj.field; let field = obj.field;