mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-11-10 04:33:42 +08:00
新增支付宝免输插件,修复一些小问题
This commit is contained in:
@@ -66,7 +66,13 @@ class PayController
|
|||||||
View::assign($act_order->toArray());
|
View::assign($act_order->toArray());
|
||||||
$passtime = strtotime($act_order->close_time) - time();
|
$passtime = strtotime($act_order->close_time) - time();
|
||||||
View::assign('passtime', $passtime > 0 ? $passtime : 0);
|
View::assign('passtime', $passtime > 0 ? $passtime : 0);
|
||||||
|
// Alipay免输
|
||||||
|
if (preg_match('/^alipay4#\d+$/', $channel->channel)) {
|
||||||
|
$payurl = \payclient\AliPayf::getPayUrl($act_order->order_id, $act_order->money, $channel->qrcode);
|
||||||
|
View::assign('payUrl', $payurl['data'] ?? $payurl['msg']);
|
||||||
|
} else {
|
||||||
View::assign('payUrl', $channel->qrcode);
|
View::assign('payUrl', $channel->qrcode);
|
||||||
|
}
|
||||||
View::assign('code_type', $channel->type);
|
View::assign('code_type', $channel->type);
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
} else {
|
} else {
|
||||||
@@ -165,9 +171,17 @@ class PayController
|
|||||||
$is_money = $order->really_price == $new_order['price'];
|
$is_money = $order->really_price == $new_order['price'];
|
||||||
// 订单核对
|
// 订单核对
|
||||||
if ($is_payway && $is_channel && $is_money) {
|
if ($is_payway && $is_channel && $is_money) {
|
||||||
|
// 是否免输
|
||||||
|
if (isset($new_order['remark'])) {
|
||||||
|
if ($new_order['remark'] == $order->order_id) {
|
||||||
$res = $this->updateOrderState($order, $new_order['order_no']);
|
$res = $this->updateOrderState($order, $new_order['order_no']);
|
||||||
$notify[] = $res;
|
$notify[] = $res;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$res = $this->updateOrderState($order, $new_order['order_no']);
|
||||||
|
$notify[] = $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$notify) $notify = ['code' => 0, 'msg' => '收款通知无匹配订单'];
|
if (!$notify) $notify = ['code' => 0, 'msg' => '收款通知无匹配订单'];
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Order extends BaseModel
|
|||||||
// 商品金额
|
// 商品金额
|
||||||
'money' => $data['money'],
|
'money' => $data['money'],
|
||||||
// 实际成交金额
|
// 实际成交金额
|
||||||
'really_price' => self::checkMoney($data['money'], $data['type'], $channel['aid'], $channel['cid']),
|
'really_price' => self::checkMoney($data['money'], $data['type'], $channel['aid'], $channel['cid'], $channel['chan']),
|
||||||
// 用户IP
|
// 用户IP
|
||||||
'clientip' => isset($data['clientip']) ? $data['clientip'] : '',
|
'clientip' => isset($data['clientip']) ? $data['clientip'] : '',
|
||||||
// 设备类型
|
// 设备类型
|
||||||
@@ -145,7 +145,7 @@ class Order extends BaseModel
|
|||||||
if (!$channel_info) return backMsg(3, '用户账户无可用收款通道');
|
if (!$channel_info) return backMsg(3, '用户账户无可用收款通道');
|
||||||
// 选取收款通道
|
// 选取收款通道
|
||||||
$patt = PayAccount::find($channel_info->account_id);
|
$patt = PayAccount::find($channel_info->account_id);
|
||||||
$channel = ['aid' => $channel_info->account_id, 'cid' => $channel_info->id, 'patt' => $patt->getData('pattern')];
|
$channel = ['aid' => $channel_info->account_id, 'cid' => $channel_info->id, 'patt' => $patt->getData('pattern'), 'chan' => $channel_info->channel];
|
||||||
PayChannel::update(['last_time' => self::getFormatTime(), 'id' => $channel['cid']]);
|
PayChannel::update(['last_time' => self::getFormatTime(), 'id' => $channel['cid']]);
|
||||||
return backMsg(0, 'ok', $channel);
|
return backMsg(0, 'ok', $channel);
|
||||||
}
|
}
|
||||||
@@ -162,9 +162,13 @@ class Order extends BaseModel
|
|||||||
// return $params;
|
// return $params;
|
||||||
// }
|
// }
|
||||||
// 检查金额
|
// 检查金额
|
||||||
private static function checkMoney($money, $type, $aid, $cid): float
|
private static function checkMoney($money, $type, $aid, $cid, $chan): float
|
||||||
{
|
{
|
||||||
$money = (float) $money;
|
$money = (float) $money;
|
||||||
|
// Alipay免输
|
||||||
|
if (preg_match('/^alipay4#\d+$/', $chan)) {
|
||||||
|
return $money;
|
||||||
|
}
|
||||||
// 查询有效订单
|
// 查询有效订单
|
||||||
$query = self::scope('activeOrder')->where(['type' => $type, 'aid' => $aid, 'cid' => $cid]);
|
$query = self::scope('activeOrder')->where(['type' => $type, 'aid' => $aid, 'cid' => $cid]);
|
||||||
$activeOrders = $query->column('really_price');
|
$activeOrders = $query->column('really_price');
|
||||||
|
|||||||
@@ -40,16 +40,4 @@ return array (
|
|||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
'state' => 1,
|
'state' => 1,
|
||||||
),
|
),
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'platform' => 'alipayb',
|
|
||||||
'name' => '支付宝账单',
|
|
||||||
'class_name' => 'AliPayb',
|
|
||||||
'price' => NULL,
|
|
||||||
'describe' => '支付宝账单查询回调,免挂机,稳定不掉线',
|
|
||||||
'website' => 'https://open.alipay.com',
|
|
||||||
'helplink' => 'https://f0bmwzqjtq2.feishu.cn/docx/HBVrdrsACo36bzxUCSPcjOBNnyb',
|
|
||||||
'version' => '1.0',
|
|
||||||
'state' => 1,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|||||||
Binary file not shown.
@@ -180,7 +180,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
const payCode = '<?php echo htmlentities($payUrl); ?>';
|
const payCode = '<?php echo $payUrl; ?>';
|
||||||
const codeType = '<?php echo htmlentities($code_type); ?>';
|
const codeType = '<?php echo htmlentities($code_type); ?>';
|
||||||
const payType = '<?php echo htmlentities($type); ?>';
|
const payType = '<?php echo htmlentities($type); ?>';
|
||||||
const order = '<?php echo htmlentities($order_id); ?>';
|
const order = '<?php echo htmlentities($order_id); ?>';
|
||||||
|
|||||||
Reference in New Issue
Block a user