优化页面翻译,优化统一订单页面审核操作

This commit is contained in:
2026-04-03 10:59:56 +08:00
parent 5ab85d1d53
commit 6f12afcd10
16 changed files with 462 additions and 83 deletions

View File

@@ -4,6 +4,7 @@ namespace app\admin\controller\mall;
use Throwable;
use app\common\controller\Backend;
use app\common\library\MallBonusGrantPush;
use app\common\model\MallOrder;
use app\common\model\MallUserAsset;
use support\think\Db;
@@ -251,7 +252,7 @@ class Order extends Backend
}
/**
* 手动重试(仅红利推送失败可重试
* 手动推送红利(同步调用 PlayX不限制自动重试次数成功则 ACCEPTED失败写入 fail_reason
*/
public function retry(Request $request): Response
{
@@ -276,17 +277,42 @@ class Order extends Backend
if ($order->type !== MallOrder::TYPE_BONUS) {
return $this->error(__('Only BONUS can retry'));
}
if ($order->grant_status !== MallOrder::GRANT_FAILED_RETRYABLE) {
return $this->error(__('Only FAILED_RETRYABLE can retry'));
}
if (($order->retry_count ?? 0) >= 3) {
return $this->error(__('Retry count exceeded'));
if ($order->status !== MallOrder::STATUS_PENDING) {
return $this->error(__('Order status must be PENDING'));
}
$order->grant_status = MallOrder::GRANT_NOT_SENT;
$allowedStatuses = [
MallOrder::GRANT_NOT_SENT,
MallOrder::GRANT_SENT_PENDING,
MallOrder::GRANT_FAILED_RETRYABLE,
MallOrder::GRANT_FAILED_FINAL,
];
if (!in_array($order->grant_status, $allowedStatuses, true)) {
return $this->error(__('Current grant status cannot be manually pushed'));
}
if (strval(config('playx.api.base_url', '')) === '') {
return $this->error(__('PlayX API not configured'));
}
$result = MallBonusGrantPush::push($order);
if ($result['ok']) {
$order->grant_status = MallOrder::GRANT_ACCEPTED;
$order->playx_transaction_id = $result['playx_transaction_id'];
$order->fail_reason = null;
$order->update_time = time();
$order->save();
return $this->success(__('Push succeeded'));
}
$failReason = __('Manual push failed') . ': ' . $result['message'];
$order->fail_reason = $failReason;
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
$order->update_time = time();
$order->save();
return $this->success(__('Retry queued'));
return $this->error($failReason);
}
}