diff --git a/app/controller/PayController.php b/app/controller/PayController.php index 58750e5..81d4f43 100644 --- a/app/controller/PayController.php +++ b/app/controller/PayController.php @@ -109,9 +109,11 @@ class PayController if ($order_id) { $act_order = Order::where('order_id', $order_id)->find(); if ($act_order) { + $passtime = strtotime($act_order->close_time) - time(); $data = []; if ($act_order->state === 0) { $data['order_id'] = $act_order->order_id; + $data['passtime'] = $passtime > 0 ? $passtime : 0; $data['state'] = $act_order->state; return json($data); } elseif ($act_order->state === 1) { @@ -125,6 +127,7 @@ class PayController $res_return_url = $act_order->return_url . '?' . http_build_query($notify); // 响应消息 $data['order_id'] = $act_order->order_id; + $data['passtime'] = $passtime > 0 ? $passtime : 0; $data['state'] = $act_order->state; $data['return_url'] = $res_return_url; return json($data); @@ -245,21 +248,19 @@ class PayController // 检测本账号订单 $orders = []; foreach ($order_list as $key => $val) { - if ($pid == $val['pid'] && $aid == $val['aid']) { + if ($pid == $val['pid'] && $aid == $val['aid'] && $val['patt'] == 1) { $orders[] = $order_list[$key]; } } if (!$orders) { return \json(['code' => 0, 'msg' => '非本账号订单']); } - // 收款平台 - $platform = ['sqbpay' => 'ShouQianBa', 'storepay' => 'ZhiHuiJingYing', 'mqpay' => 'MaQian', 'ysepay' => 'Ysepay']; // 登陆账号 $config = ['username' => $pay_config['account'], 'password' => $pay_config['password']]; // 收款查询 $query = $pay_config['query']; // 实例监听客户端 - $payclient_name = $platform[$pay_config['platform']]; + $payclient_name = $pay_config['payclass']; $payclient_path = "\\payclient\\{$payclient_name}"; $Payclient = new $payclient_path($config); // 获取支付明细 @@ -281,7 +282,7 @@ class PayController $is_user = User::checkUser($pid, $sign); $path = '../runtime/order.json'; if ($is_user) { - $orders = Order::scope('activeOrder')->field('id,pid,aid,cid')->select(); + $orders = Order::scope('activeOrder')->field('id,pid,aid,cid,patt')->select(); if (!file_exists($path)) { file_put_contents($path, '[]'); } diff --git a/app/controller/api/PayManageController.php b/app/controller/api/PayManageController.php index 9c1e5e3..7f22810 100644 --- a/app/controller/api/PayManageController.php +++ b/app/controller/api/PayManageController.php @@ -119,6 +119,7 @@ class PayManageController extends BaseController 'platform' => $acc->getData('platform'), 'account' => $acc->account, 'password' => $acc->password, + 'payclass' => $platform->class_name, 'query' => \var_export($query, \true) ]; $config = View::fetch('tpl/account_config', $data); diff --git a/app/model/Order.php b/app/model/Order.php index 08f46fe..fede272 100644 --- a/app/model/Order.php +++ b/app/model/Order.php @@ -44,6 +44,8 @@ class Order extends BaseModel 'param' => serialize(self::getParams($data)), // 等待/过期:0, 支付成功:1 'state' => 0, + // 开启监听:1, 关闭监听:0 + 'patt' => $channel['patt'], // 订单创建时间 'create_time' => self::getFormatTime($my_time), // 订单关闭时间 @@ -109,9 +111,6 @@ class Order extends BaseModel $order->qrcode = $a_list->payChannel[0]->qrcode ?? '···'; return $order->toArray(); } - - - // 选择收款通道 private static function setChannel($pid): array { @@ -120,7 +119,8 @@ class Order extends BaseModel if (!$channel_info || !$aids) { return []; } - $channel = ['aid' => $channel_info->account_id, 'cid' => $channel_info->id]; + $patt = PayAccount::find($channel_info->account_id); + $channel = ['aid' => $channel_info->account_id, 'cid' => $channel_info->id, 'patt' => $patt->pattern]; PayChannel::update(['last_time' => self::getFormatTime(), 'id' => $channel['cid']]); return $channel; } diff --git a/config/payconfig/1001_40.php b/config/payconfig/1001_40.php index 07a8dbb..a5bc813 100644 --- a/config/payconfig/1001_40.php +++ b/config/payconfig/1001_40.php @@ -6,7 +6,7 @@ return [ // 用户账号配置 'user' => [ 'pid' => 1001, - 'key' => '7ImzF6Rf8OciQcmRJv8oTNBwIp6uqF0p' + 'key' => '953c4d682d9ab148277b76a06e215ce7' ], // 收款平台账号配置 'pay' => [ @@ -14,10 +14,12 @@ return [ 'aid' => 40, // 收款平台 'platform' => 'mqpay', + // 收款平台 + 'payclass' => 'MaQian', // 账号 - 'account' => '258000000', + 'account' => '18657945333', // 密码 - 'password' => '123456', + 'password' => 'Aa12345678', // 订单查询参数配置 'query' => array ( 'terminalType' => '', diff --git a/runtime/order.json b/runtime/order.json index 51b4235..d50c472 100644 --- a/runtime/order.json +++ b/runtime/order.json @@ -1 +1 @@ -{"code":0,"msg":"没有新订单"} \ No newline at end of file +{"code":1,"msg":"\u67091\u4e2a\u65b0\u8ba2\u5355","orders":[{"id":27409,"pid":1001,"aid":30,"cid":31,"patt":0}]} \ No newline at end of file diff --git a/view/pay/console.html b/view/pay/console.html index ffbc87a..497632e 100644 --- a/view/pay/console.html +++ b/view/pay/console.html @@ -76,7 +76,7 @@ .msg>p { color: red; font-weight: 700; - line-height: 1.5em; + line-height: 2em; } .msg>p:nth-child(1) { @@ -98,7 +98,7 @@ .note { color: red; - font-size: 24px; + font-size: 22px; } @@ -135,10 +135,10 @@
请付款
+ 请付款
- 元,注意不能多付或少付 付款后,请等待5秒查看
付款后,请等待 5 秒查看