mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-11-07 03:03:43 +08:00
1. 优化数据库结构,增强兼容性
2. 添加手机浏览器跳转支付宝收银 3. 添加手机浏览器跳转微信支付提示信息
This commit is contained in:
@@ -28,6 +28,12 @@ class ConsoleController extends BaseController
|
|||||||
{
|
{
|
||||||
// 加载菜单配置
|
// 加载菜单配置
|
||||||
$message = \Plugin::getNotifyMessage();
|
$message = \Plugin::getNotifyMessage();
|
||||||
|
if (empty($message)) {
|
||||||
|
$message = [
|
||||||
|
["id" => 1, "title" => "应用更新", "children" => []],
|
||||||
|
["id" => 2, "title" => "官方消息", "children" => []],
|
||||||
|
];
|
||||||
|
}
|
||||||
return json($message);
|
return json($message);
|
||||||
}
|
}
|
||||||
// 首页仪表盘
|
// 首页仪表盘
|
||||||
|
|||||||
@@ -221,75 +221,68 @@ EOT;
|
|||||||
private function getTableCreationSqls(): array
|
private function getTableCreationSqls(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'mpay_order' => "
|
'mpay_order' => "CREATE TABLE `mpay_order` (
|
||||||
CREATE TABLE `mpay_order` (
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`pid` int(11) NOT NULL DEFAULT 0,
|
||||||
`pid` int(11) NOT NULL DEFAULT 0 COMMENT '商户 ID',
|
`order_id` varchar(255) NOT NULL DEFAULT '',
|
||||||
`order_id` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '订单号',
|
`type` varchar(255) NOT NULL DEFAULT '',
|
||||||
`type` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '支付类型',
|
`out_trade_no` varchar(255) NOT NULL DEFAULT '',
|
||||||
`out_trade_no` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '商户订单号',
|
`notify_url` varchar(255) NOT NULL DEFAULT '',
|
||||||
`notify_url` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '异步通知地址',
|
`return_url` varchar(255) NOT NULL DEFAULT '',
|
||||||
`return_url` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '跳转通知地址',
|
`name` varchar(255) NOT NULL DEFAULT '',
|
||||||
`name` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '商品名称',
|
`really_price` decimal(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
`really_price` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '实际支付金额',
|
`money` decimal(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
`money` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '订单价格',
|
`clientip` varchar(255) NOT NULL DEFAULT '',
|
||||||
`clientip` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '用户 IP 地址',
|
`device` varchar(255) NOT NULL DEFAULT '',
|
||||||
`device` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '设备类型',
|
`param` varchar(720) NOT NULL DEFAULT '',
|
||||||
`param` varchar(720) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '扩展参数',
|
`state` tinyint(4) NOT NULL DEFAULT 0,
|
||||||
`state` tinyint(4) NOT NULL DEFAULT 0 COMMENT '订单状态',
|
`patt` tinyint(4) NOT NULL DEFAULT 0,
|
||||||
`patt` tinyint(4) NOT NULL DEFAULT 0 COMMENT '开启回调监听',
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
`create_time` datetime COMMENT '订单创建时间',
|
`close_time` datetime DEFAULT NULL,
|
||||||
`close_time` datetime NULL DEFAULT NULL COMMENT '订单关闭时间',
|
`pay_time` datetime DEFAULT NULL,
|
||||||
`pay_time` datetime NULL DEFAULT NULL COMMENT '支付时间',
|
`platform_order` varchar(255) NOT NULL DEFAULT '',
|
||||||
`platform_order` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '收款平台订单号',
|
`aid` int(11) NOT NULL DEFAULT 0,
|
||||||
`aid` int(11) NOT NULL DEFAULT 0 COMMENT '收款账号 ID',
|
`cid` int(11) NOT NULL DEFAULT 0,
|
||||||
`cid` int(11) NOT NULL DEFAULT 0 COMMENT '收款码 ID',
|
`delete_time` datetime DEFAULT NULL,
|
||||||
`delete_time` datetime NULL DEFAULT NULL COMMENT '软删除',
|
PRIMARY KEY (`id`),
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
INDEX `idx_order_id` (`order_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;",
|
||||||
",
|
'mpay_pay_account' => "CREATE TABLE `mpay_pay_account` (
|
||||||
'mpay_pay_account' => "
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
CREATE TABLE `mpay_pay_account` (
|
`pid` int(11) NOT NULL DEFAULT 0,
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '收款平台 ID',
|
`platform` varchar(255) NOT NULL DEFAULT '',
|
||||||
`pid` int(11) NOT NULL DEFAULT 0 COMMENT '用户 ID',
|
`account` varchar(255) NOT NULL DEFAULT '',
|
||||||
`platform` varchar(255) NOT NULL DEFAULT '' COMMENT '收款平台',
|
`password` varchar(255) NOT NULL DEFAULT '',
|
||||||
`account` varchar(255) NOT NULL DEFAULT '' COMMENT '账号',
|
`state` tinyint(4) NOT NULL DEFAULT 1,
|
||||||
`password` varchar(255) NOT NULL DEFAULT '' COMMENT '密码',
|
`pattern` tinyint(4) NOT NULL DEFAULT 1,
|
||||||
`state` tinyint(4) NOT NULL DEFAULT 1 COMMENT '启用',
|
`params` text NOT NULL,
|
||||||
`pattern` tinyint(4) NOT NULL DEFAULT 1 COMMENT '账号监听模式',
|
`delete_time` datetime DEFAULT NULL,
|
||||||
`params` text NOT NULL COMMENT '自定义查询',
|
PRIMARY KEY (`id`)
|
||||||
`delete_time` datetime NULL DEFAULT NULL COMMENT '软删除',
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;",
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
'mpay_pay_channel' => "CREATE TABLE `mpay_pay_channel` (
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
",
|
`account_id` int(11) NOT NULL DEFAULT 0,
|
||||||
'mpay_pay_channel' => "
|
`channel` varchar(255) NOT NULL DEFAULT '',
|
||||||
CREATE TABLE `mpay_pay_channel` (
|
`type` tinyint(4) NOT NULL DEFAULT 0,
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '渠道 ID',
|
`qrcode` varchar(255) NOT NULL DEFAULT '',
|
||||||
`account_id` int(11) NOT NULL DEFAULT 0 COMMENT '收款平台 ID',
|
`last_time` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
`channel` varchar(255) NOT NULL DEFAULT '' COMMENT '收款通道',
|
`state` tinyint(4) NOT NULL DEFAULT 1,
|
||||||
`type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '保存类型',
|
`delete_time` datetime DEFAULT NULL,
|
||||||
`qrcode` varchar(255) NOT NULL DEFAULT '' COMMENT '二维码',
|
PRIMARY KEY (`id`)
|
||||||
`last_time` datetime COMMENT '最近使用',
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;",
|
||||||
`state` tinyint(4) NOT NULL DEFAULT 1 COMMENT '启用',
|
'mpay_user' => "CREATE TABLE `mpay_user` (
|
||||||
`delete_time` datetime NULL DEFAULT NULL COMMENT '软删除',
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
`pid` int(11) NOT NULL DEFAULT 0,
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
|
`secret_key` varchar(255) NOT NULL DEFAULT '',
|
||||||
",
|
`nickname` varchar(255) NOT NULL DEFAULT '',
|
||||||
'mpay_user' => "
|
`username` varchar(255) NOT NULL DEFAULT '',
|
||||||
CREATE TABLE `mpay_user` (
|
`password` varchar(255) NOT NULL DEFAULT '',
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`state` tinyint(4) NOT NULL DEFAULT 1,
|
||||||
`pid` int(11) NOT NULL DEFAULT 0 COMMENT '商户 ID',
|
`role` tinyint(4) NOT NULL DEFAULT 0,
|
||||||
`secret_key` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '商户秘钥',
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
|
||||||
`nickname` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '用户昵称',
|
`delete_time` datetime DEFAULT NULL,
|
||||||
`username` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '账号',
|
PRIMARY KEY (`id`)
|
||||||
`password` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '密码',
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;"
|
||||||
`state` tinyint(4) NOT NULL DEFAULT 1 COMMENT '启用状态 0:禁用 1:启用',
|
|
||||||
`role` tinyint(4) NOT NULL DEFAULT 0 COMMENT '用户角色 0:普通用户 1:管理员',
|
|
||||||
`create_time` datetime COMMENT '创建时间',
|
|
||||||
`delete_time` datetime NULL DEFAULT NULL COMMENT '软删除',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
|
|
||||||
"
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class Plugin
|
|||||||
if ($message) return $message;
|
if ($message) return $message;
|
||||||
$message = self::getHttpResponse(self::$siteUrl . '/MpayApi', ['action' => 'message']);
|
$message = self::getHttpResponse(self::$siteUrl . '/MpayApi', ['action' => 'message']);
|
||||||
$info = json_decode($message, true);
|
$info = json_decode($message, true);
|
||||||
|
if($info === null) return [];
|
||||||
if ($info['code'] === 0) cache('message', $info['data'], 36000);
|
if ($info['code'] === 0) cache('message', $info['data'], 36000);
|
||||||
return $info['data'];
|
return $info['data'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,12 @@
|
|||||||
</span><span>元</span></div>
|
</span><span>元</span></div>
|
||||||
<div class="qrcode"><img id="qrcode" src="/static/img/loading.gif">
|
<div class="qrcode"><img id="qrcode" src="/static/img/loading.gif">
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 添加跳转按钮 -->
|
||||||
|
<div style="margin: 16px auto;display: none;">
|
||||||
|
<button id="openApp" class="layui-btn layui-btn-normal">
|
||||||
|
打开支付应用
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class="msg">
|
<div class="msg">
|
||||||
<p>请付款 <span class="note">
|
<p>请付款 <span class="note">
|
||||||
<?php echo htmlentities($really_price); ?>
|
<?php echo htmlentities($really_price); ?>
|
||||||
@@ -284,6 +290,29 @@
|
|||||||
} else if (payType === 'alipay' && environment === 'wxphone') {
|
} else if (payType === 'alipay' && environment === 'wxphone') {
|
||||||
layer.alert('请使用支付宝打开此页面');
|
layer.alert('请使用支付宝打开此页面');
|
||||||
}
|
}
|
||||||
|
// 添加按钮控制逻辑
|
||||||
|
const openAppBtn = document.getElementById('openApp');
|
||||||
|
if (environment === 'phone') {
|
||||||
|
openAppBtn.parentNode.style.display = 'block';
|
||||||
|
if (payType === 'wxpay') {
|
||||||
|
openAppBtn.innerText = '截图并打开微信';
|
||||||
|
openAppBtn.className = 'layui-btn layui-btn-green';
|
||||||
|
openAppBtn.onclick = function () {
|
||||||
|
window.location.href = 'weixin://';
|
||||||
|
};
|
||||||
|
} else if (payType === 'alipay') {
|
||||||
|
openAppBtn.innerText = '打开支付宝付款';
|
||||||
|
openAppBtn.className = 'layui-btn layui-btn-normal';
|
||||||
|
openAppBtn.onclick = function () {
|
||||||
|
if (codeType == 0) {
|
||||||
|
window.location.href = 'alipays://platformapi/startapp?appId=20000067&&url=' + payCode;
|
||||||
|
} else {
|
||||||
|
const currentUrl = window.location.href;
|
||||||
|
window.location.href = 'alipays://platformapi/startapp?appId=20000067&&url=' + currentUrl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
// 生成二维码
|
// 生成二维码
|
||||||
async function getQrcode(text, QR) {
|
async function getQrcode(text, QR) {
|
||||||
const qrcodeUrl = await new Promise((resolve) => {
|
const qrcodeUrl = await new Promise((resolve) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user