chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: ywxapp<admin@ywxapp_dev>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace addon\mqpay\controller\backend;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
|
||||
/**
|
||||
* 免签支付订单后台列表
|
||||
*/
|
||||
class Order extends MqpayBackend
|
||||
{
|
||||
/**
|
||||
* 列表页(后台菜单入口)
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->fetch('order');
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表数据(layui table 格式)
|
||||
*/
|
||||
public function list()
|
||||
{
|
||||
$page = (int) Request::param('page', 1);
|
||||
$limit = (int) Request::param('limit', 10);
|
||||
$kw = trim((string) Request::param('kw', ''));
|
||||
$db = Db::name('Mqpay_order');
|
||||
if ($kw !== '') {
|
||||
$db->where('order_sn', 'like', '%' . $kw . '%');
|
||||
}
|
||||
$total = $db->count();
|
||||
$rows = $db->order('id', 'desc')
|
||||
->page($page, $limit)
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($rows as &$r) {
|
||||
$r['status_text'] = $r['status'] == 1 ? '已支付' : '待支付';
|
||||
$r['create_time'] = $r['create_at'] ? date('Y-m-d H:i:s', $r['create_at']) : '';
|
||||
$r['pay_time'] = (!empty($r['pay_at'])) ? date('Y-m-d H:i:s', $r['pay_at']) : '';
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '', 'count' => $total, 'data' => $rows]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动确认到账
|
||||
*/
|
||||
public function confirm()
|
||||
{
|
||||
$orderSn = trim((string) Request::param('order_sn', ''));
|
||||
if ($orderSn === '') {
|
||||
return json(['code' => 1, 'msg' => '缺少订单号']);
|
||||
}
|
||||
$subscriber = new \addon\Mqpay\subscribe\Payment();
|
||||
$res = $subscriber->confirmOrder($orderSn);
|
||||
return json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟安卓监听回调(后台按钮,按真实签名调 notify-app)
|
||||
*/
|
||||
public function listen()
|
||||
{
|
||||
$orderSn = trim((string) Request::param('order_sn', ''));
|
||||
$amount = trim((string) Request::param('amount', ''));
|
||||
if ($orderSn === '' || $amount === '') {
|
||||
return json(['code' => 1, 'msg' => '缺少订单号或金额']);
|
||||
}
|
||||
$key = (string) config('mqpay.listen_key', '');
|
||||
$sign = $key === '' ? '' : md5($key . $amount . $orderSn . $key);
|
||||
if ($sign === '') {
|
||||
return json(['code' => 1, 'msg' => '未配置 listen_key,无法签名']);
|
||||
}
|
||||
$subscriber = new \addon\Mqpay\subscribe\Payment();
|
||||
$res = $subscriber->notifyApp([
|
||||
'order_sn' => $orderSn,
|
||||
'amount' => $amount,
|
||||
'sign' => $sign,
|
||||
]);
|
||||
return json($res);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user