9 Commits

Author SHA1 Message Date
技术老胡
f03d3de109 添加收款码设置说明 2025-02-08 11:37:14 +08:00
技术老胡
b546977011 更新PC端监控逻辑 2025-02-08 10:53:26 +08:00
技术老胡
9080543df4 更新文档 2025-02-06 18:34:12 +08:00
技术老胡
a4b8381395 更新文档 2025-01-24 15:51:58 +08:00
技术老胡
020398b34f 更新 2025-01-24 15:44:53 +08:00
技术老胡
a7ca3d2db5 更新文档 2025-01-24 15:42:30 +08:00
技术老胡
5d42d2ef70 更新 2025-01-22 17:08:30 +08:00
技术老胡
9fbedc8cfc 更新文件 2025-01-20 10:30:53 +08:00
技术老胡
b56156d33a 更新手动补单问题 2025-01-20 10:00:07 +08:00
13 changed files with 75 additions and 51 deletions

8
.env
View File

@@ -1,12 +1,12 @@
APP_DEBUG = true
APP_DEBUG = false
DB_TYPE = mysql
DB_HOST = 127.0.0.1
DB_NAME = mpay
DB_USER = admin
DB_PASS = Aa123456
DB_USER = mpay
DB_PASS = 123456
DB_PORT = 3306
DB_CHARSET = utf8
DB_CHARSET = utf8mb4
DB_PREFIX = mpay_
DEFAULT_LANG = zh-cn

14
.gitignore vendored
View File

@@ -1,6 +1,12 @@
/.idea
/.vscode
/.history
/.gitee
.vscode
*.env
extend/*
!extend/ImgCaptcha.php
!extend/payclient.zip
!extend/Plugin.php
vendor/*
!vendor/vendor.zip
runtime/*

View File

@@ -436,3 +436,20 @@ V免签是一款开源免费适用于个人收款使用的收款程序原理
![订单详情](assets/20241203_155123_image.png)
# 学习交流社群
社群答疑、插件定制、技术交流,添加微信拉群,请备注:**码支付**
微信:**K103516**
<img src="assets/wxqrcode.png" width=50% />
## 感谢赞助
|姓名 | 金额 |
|---|---|
| 知汇学社 | 100 |
| exrock | 100 |
| A筱磊 | 6.66 |

View File

@@ -97,12 +97,8 @@ class PayController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 跳转通知URL
$res_return_url = '';
if (strpos($act_order->return_url, '?')) {
$res_return_url = $act_order->return_url . '&' . http_build_query($notify);
} else {
$res_return_url = $act_order->return_url . '?' . http_build_query($notify);
}
$res_return_url = $act_order->return_url . '?' . http_build_query($notify);
if (strpos($act_order->return_url, '?')) $res_return_url = $act_order->return_url . '&' . http_build_query($notify);
// 响应消息
$data['order_id'] = $act_order->order_id;
$data['passtime'] = $passtime > 0 ? $passtime : 0;
@@ -192,12 +188,8 @@ class PayController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 异步通知
$notify_url = '';
if (strpos($order->notify_url, '?')) {
$notify_url = $order->notify_url . '&' . http_build_query($notify);
} else {
$notify_url = $order->notify_url . '?' . http_build_query($notify);
}
$notify_url = $order->notify_url . '?' . http_build_query($notify);
if (strpos($order->notify_url, '?')) $notify_url = $order->notify_url . '&' . http_build_query($notify);
$res_notify = self::getHttpResponse($notify_url);
if ($res_notify === 'success') {
return ['order' => $order->order_id, 'code' => 1, 'msg' => 'notify success'];
@@ -280,20 +272,18 @@ class PayController
{
$info = $request->post();
$action = isset($info['action']) ? $info['action'] : '';
if ($action === 'mpay') {
$data = json_decode($info['data'], true);
if (!is_array($data)) return 200;
if (!isset($data['aid']) || !isset($data['pid'])) return 202;
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
$payclient_path = "\\payclient\\{$config['payclass']}";
$Payclient = new $payclient_path($info, $config);
$res = $Payclient->notify();
if (is_int($res)) return $res;
$this->payHeart($res, $config);
return 200;
} else {
return 202;
}
if ($action !== 'mpay' && $action !== 'mpaypc') return '非mpay的访问请求';
$data = json_decode($info['data'], true);
if (!is_array($data)) return '通知数据为空';
if (!isset($data['aid']) || !isset($data['pid'])) return 'aid和pid参数错误';
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
$payclient_path = "\\payclient\\{$config['payclass']}";
$Payclient = new $payclient_path($info, $config);
if ($action == 'mpay') $res = $Payclient->notify();
if ($action == 'mpaypc') $res = $Payclient->pcNotify();
if ($res['code'] !== 0) return $res['msg'];
$this->payHeart($res['data'], $config);
return 200;
}
// 签名
private static function getSign(array $param = [], string $key = ''): string

View File

@@ -48,7 +48,9 @@ class OrderController extends BaseController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 异步通知
$res_notify = self::getHttpResponse($order->notify_url . '?' . http_build_query($notify));
$notify_url = $order->notify_url . '?' . http_build_query($notify);
if (strpos($order->notify_url, '?')) $notify_url = $order->notify_url . '&' . http_build_query($notify);
$res_notify = self::getHttpResponse($notify_url);
if ($res_notify === 'success') {
return json(\backMsg(0, '订单通知成功'));
} else {
@@ -72,7 +74,9 @@ class OrderController extends BaseController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 异步通知
$res_notify = self::getHttpResponse($order->notify_url . '?' . http_build_query($notify));
$notify_url = $order->notify_url . '?' . http_build_query($notify);
if (strpos($order->notify_url, '?')) $notify_url = $order->notify_url . '&' . http_build_query($notify);
$res_notify = self::getHttpResponse($notify_url);
if ($res_notify === 'success') {
return json(\backMsg(0, '订单通知成功'));
} else {
@@ -156,7 +160,8 @@ class OrderController extends BaseController
'sign_type' => 'MD5',
];
// 添加扩展参数
$notify = array_merge($notify, unserialize($param->param));
// $notify = array_merge($notify, unserialize($param->param));
$notify['param'] = unserialize($param->param);
return $notify;
}
// 请求外部资源

BIN
assets/wxqrcode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

1
extend/.gitignore vendored
View File

@@ -1 +0,0 @@
payclient

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

2
runtime/.gitignore vendored
View File

@@ -1,2 +0,0 @@
*
!.gitignore

3
vendor/.gitignore vendored
View File

@@ -1,3 +0,0 @@
*
!.gitignore
!vendor.zip

View File

@@ -39,10 +39,10 @@
lay-filter="scanning" class="layui-input" data-type="">
</div>
</div>
</div>
<div class="main-container">
<div class="layui-text">
<p>终端编号如何填写,<strong><a href="https://f0bmwzqjtq2.feishu.cn/docx/HBVrdrsACo36bzxUCSPcjOBNnyb?from=from_copylink" target="_blank"><strong>请查看文档</strong></a></p>
<div class="layui-form-item">
<blockquote class="layui-elem-quote">
<p>首次添加,不知道终端编号可以先空着,后面再查询填写。查询终端编号,<strong><a class="layui-font-blue" href="https://f0bmwzqjtq2.feishu.cn/docx/HBVrdrsACo36bzxUCSPcjOBNnyb?from=from_copylink" target="_blank"><strong>请查看文档</strong></a></p>
</blockquote>
</div>
</div>
</div>

View File

@@ -28,14 +28,14 @@
<select class="type" lay-filter="select-type">
<option value="">请选择</option>
<!-- <?php if ($platform == 'wxpay') { ?> -->
<option value="wxpay1">个人码/经营码</option>
<option value="wxpay1">个人码</option>
<option value="wxpay2">赞赏码</option>
<option value="wxpay3" disabled >经营码</option>
<option value="wxpay3">经营码</option>
<option value="wxpay4">商家码</option>
<!-- <?php } ?> -->
<!-- <?php if ($platform == 'alipay') { ?> -->
<option value="alipay1">收钱码/经营码</option>
<option value="alipay2" disabled>经营码</option>
<option value="alipay1">收钱码</option>
<option value="alipay2">经营码</option>
<!-- <?php } ?> -->
</select>
</div>
@@ -57,6 +57,18 @@
lay-filter="scanning" class="layui-input" data-type="">
</div>
</div>
<div class="layui-form-item">
<blockquote class="layui-elem-quote">
<!-- <?php if ($platform == 'wxpay') { ?> -->
<p><strong>手机监控:</strong>微信个人码与经营码只能二选一,不能同时添加,商家码监听需要关注“微信收款商业版”公众号,赞赏码正常添加。</p>
<p><strong>电脑监控:</strong>所有收款码均可监控,将需要将收款通知聊天窗口单独拖出来</p>
<!-- <?php } ?> -->
<!-- <?php if ($platform == 'alipay') { ?> -->
<p><strong>手机监控:</strong>支付宝收钱码与经营码只能二选一</p>
<p><strong>电脑监控:</strong>暂不支持PC端监控可以选择支付宝账单方式监听收款</p>
<!-- <?php } ?> -->
</blockquote>
</div>
</div>
</div>
<div class="bottom">