feat: 新增后台人工充值功能及支付结果页
- 新增后台人工充值模块,支持上传支付凭证 - 新增支付结果查询接口及页面 - 新增订单支付成功跳转结果页逻辑 - 更新钱包流水类型标签区分充值方式 - 新增插件路由 PHP 8 兼容错误报告设置
这个提交包含在:
@@ -6,6 +6,7 @@ use app\common\library\CommissionService;
|
||||
use app\common\library\FinanceConfigService;
|
||||
use app\common\library\OrderStatus;
|
||||
use app\common\library\OrderServiceSnapshot;
|
||||
use app\common\library\OrderPaymentResultService;
|
||||
use app\common\library\PaymentService;
|
||||
use app\common\library\TiandituService;
|
||||
use think\Db;
|
||||
@@ -658,6 +659,19 @@ class Order extends Base
|
||||
$this->success($msg, $res);
|
||||
}
|
||||
|
||||
/** 查询已确认的单笔订单支付结果。 */
|
||||
public function paymentResult()
|
||||
{
|
||||
$order = $this->ownOrder((int)$this->request->get('order_id'), 'user');
|
||||
try {
|
||||
$result = OrderPaymentResultService::getResult($order, $this->request->get('out_trade_no', ''));
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端完成 wx.requestPayment 后主动查单幂等核销(与异步回调双保险闭环)
|
||||
* @ApiMethod (POST)
|
||||
|
||||
@@ -318,16 +318,19 @@ class User extends Api
|
||||
$page = max(1, (int)$this->request->get('page', 1));
|
||||
$limit = min(50, max(1, (int)$this->request->get('limit', 20)));
|
||||
|
||||
$query = Db::name('wallet_log')
|
||||
->where('user_type', 'user')
|
||||
->where('user_id', $uid);
|
||||
// count() 会清空查询条件,因此统计和列表必须分别创建查询。
|
||||
$makeQuery = function () use ($uid, $type) {
|
||||
$query = Db::name('wallet_log')
|
||||
->where('user_type', 'user')
|
||||
->where('user_id', $uid);
|
||||
if (in_array($type, ['recharge', 'consume', 'refund'], true)) {
|
||||
$query->where('type', $type);
|
||||
}
|
||||
return $query;
|
||||
};
|
||||
|
||||
if (in_array($type, ['recharge', 'consume', 'refund'], true)) {
|
||||
$query->where('type', $type);
|
||||
}
|
||||
|
||||
$total = $query->count();
|
||||
$rows = $query->order('id desc')->page($page, $limit)->select();
|
||||
$total = $makeQuery()->count();
|
||||
$rows = $makeQuery()->order('id desc')->page($page, $limit)->select();
|
||||
|
||||
$orderIds = [];
|
||||
foreach ($rows as $r) {
|
||||
@@ -350,7 +353,7 @@ class User extends Api
|
||||
$list[] = [
|
||||
'id' => (int)$r['id'],
|
||||
'type' => $r['type'],
|
||||
'type_label' => $this->formatWalletTypeLabel($r['type']),
|
||||
'type_label' => $r['type'] === 'recharge' && $r['remark'] === '后台人工充值' ? '后台人工充值' : $this->formatWalletTypeLabel($r['type']),
|
||||
'amount' => (float)$r['amount'],
|
||||
'balance' => (float)$r['balance'],
|
||||
'order_id' => $oid,
|
||||
|
||||
在新工单中引用
屏蔽一个用户