Compare commits
8 Commits
941f0f4a8c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fdc1e2e88 | |||
| 186af5a55f | |||
| 6bec4e7758 | |||
| f9e4e61d93 | |||
| 8b6727dac1 | |||
| b97d33a24f | |||
| 6f12afcd10 | |||
| 5ab85d1d53 |
@@ -66,7 +66,7 @@ class Dashboard extends Backend
|
||||
$pendingPhysicalToShip = MallOrder::where('type', MallOrder::TYPE_PHYSICAL)
|
||||
->where('status', MallOrder::STATUS_PENDING)
|
||||
->count();
|
||||
$grantFailedRetryableCount = MallOrder::whereIn('type', [MallOrder::TYPE_BONUS, MallOrder::TYPE_WITHDRAW])
|
||||
$grantFailedRetryableCount = MallOrder::where('type', MallOrder::TYPE_BONUS)
|
||||
->where('grant_status', MallOrder::GRANT_FAILED_RETRYABLE)
|
||||
->count();
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -202,7 +203,7 @@ class Order extends Backend
|
||||
$id = $data['id'] ?? 0;
|
||||
$rejectReason = $data['reject_reason'] ?? '';
|
||||
|
||||
if (!$id || $rejectReason === '') {
|
||||
if (!$id) {
|
||||
return $this->error(__('Missing required fields'));
|
||||
}
|
||||
|
||||
@@ -214,6 +215,10 @@ class Order extends Backend
|
||||
return $this->error(__('Order status must be PENDING'));
|
||||
}
|
||||
|
||||
if ($order->type === MallOrder::TYPE_PHYSICAL && $rejectReason === '') {
|
||||
return $this->error(__('Missing required fields'));
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
$asset = MallUserAsset::where('playx_user_id', $order->user_id ?? '')->find();
|
||||
@@ -229,7 +234,11 @@ class Order extends Backend
|
||||
|
||||
$order->status = MallOrder::STATUS_REJECTED;
|
||||
$order->reject_reason = $rejectReason;
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||
if ($order->type === MallOrder::TYPE_BONUS) {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||
} else {
|
||||
$order->grant_status = MallOrder::GRANT_NOT_APPLICABLE;
|
||||
}
|
||||
$order->update_time = time();
|
||||
$order->save();
|
||||
|
||||
@@ -243,7 +252,7 @@ class Order extends Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动重试(仅红利/提现,且必须 FAILED_RETRYABLE)
|
||||
* 手动推送红利(同步调用 PlayX,不限制自动重试次数;成功则 ACCEPTED,失败写入 fail_reason)
|
||||
*/
|
||||
public function retry(Request $request): Response
|
||||
{
|
||||
@@ -265,20 +274,45 @@ class Order extends Backend
|
||||
if (!$order) {
|
||||
return $this->error(__('Record not found'));
|
||||
}
|
||||
if (!in_array($order->type, [MallOrder::TYPE_BONUS, MallOrder::TYPE_WITHDRAW], true)) {
|
||||
return $this->error(__('Only BONUS/WITHDRAW can retry'));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,4 +95,9 @@ return [
|
||||
'%d records and files have been deleted' => '%d records and files have been deleted',
|
||||
'Please input correct username' => 'Please enter the correct username',
|
||||
'Group Name Arr' => 'Group Name Arr',
|
||||
'Push succeeded' => 'Push succeeded',
|
||||
'Manual push failed' => 'Manual push failed',
|
||||
'PlayX API not configured' => 'PlayX API not configured',
|
||||
'Current grant status cannot be manually pushed' => 'Current grant status cannot be manually pushed',
|
||||
'Order status must be PENDING' => 'Order status must be PENDING',
|
||||
];
|
||||
@@ -114,4 +114,9 @@ return [
|
||||
'%d records and files have been deleted' => '已删除%d条记录和文件',
|
||||
'Please input correct username' => '请输入正确的用户名',
|
||||
'Group Name Arr' => '分组名称数组',
|
||||
'Push succeeded' => '推送成功',
|
||||
'Manual push failed' => '手动推送失败',
|
||||
'PlayX API not configured' => 'PlayX 接口未配置',
|
||||
'Current grant status cannot be manually pushed' => '当前发放状态不可手动推送',
|
||||
'Order status must be PENDING' => '订单状态须为处理中',
|
||||
];
|
||||
@@ -148,7 +148,7 @@ class Playx extends Api
|
||||
|
||||
/**
|
||||
* Daily Push API - PlayX 调用商城接收 T+1 数据
|
||||
* POST /api/v1/playx/daily-push
|
||||
* POST /api/v1/mall/dailyPush
|
||||
*/
|
||||
public function dailyPush(Request $request): Response
|
||||
{
|
||||
@@ -173,7 +173,7 @@ class Playx extends Api
|
||||
if ($sig === '' || $ts === '' || $rid === '') {
|
||||
return $this->error(__('Daily push signature missing or incomplete'), null, 0, ['statusCode' => 401]);
|
||||
}
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/playx/daily-push\n" . hash('sha256', json_encode($body));
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/mall/dailyPush\n" . hash('sha256', json_encode($body));
|
||||
$expected = hash_hmac('sha256', $canonical, $secret);
|
||||
if (!hash_equals($expected, $sig)) {
|
||||
return $this->error(__('Daily push signature verification failed'), null, 0, ['statusCode' => 401]);
|
||||
@@ -942,6 +942,8 @@ class Playx extends Api
|
||||
'grant_status' => MallOrder::GRANT_NOT_SENT,
|
||||
'create_time' => time(),
|
||||
'update_time' => time(),
|
||||
'start_time' => date('Y-m-d H:i:s', time()),
|
||||
'end_time' => date('Y-m-d H:i:s', time()+86400*3),
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
@@ -1016,6 +1018,7 @@ class Playx extends Api
|
||||
'receiver_name' => $snapshot['receiver_name'],
|
||||
'receiver_phone' => $snapshot['receiver_phone'],
|
||||
'receiver_address' => $snapshot['receiver_address'],
|
||||
'grant_status' => MallOrder::GRANT_NOT_APPLICABLE,
|
||||
'create_time' => time(),
|
||||
'update_time' => time(),
|
||||
]);
|
||||
@@ -1082,7 +1085,7 @@ class Playx extends Api
|
||||
'amount' => $amount,
|
||||
'multiplier' => $multiplier,
|
||||
'external_transaction_id' => $orderNo,
|
||||
'grant_status' => MallOrder::GRANT_NOT_SENT,
|
||||
'grant_status' => MallOrder::GRANT_NOT_APPLICABLE,
|
||||
'create_time' => time(),
|
||||
'update_time' => time(),
|
||||
]);
|
||||
@@ -1093,11 +1096,6 @@ class Playx extends Api
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$baseUrl = config('playx.api.base_url', '');
|
||||
if ($baseUrl !== '') {
|
||||
$this->callPlayxBalanceCredit($order, $playxUserId);
|
||||
}
|
||||
|
||||
return $this->success(__('Withdraw submitted, please wait about 10 minutes'), [
|
||||
'order_id' => $order->id,
|
||||
'status' => 'PENDING',
|
||||
@@ -1143,39 +1141,4 @@ class Playx extends Api
|
||||
}
|
||||
}
|
||||
|
||||
private function callPlayxBalanceCredit(MallOrder $order, string $userId): void
|
||||
{
|
||||
$baseUrl = rtrim(config('playx.api.base_url', ''), '/');
|
||||
$url = config('playx.api.balance_credit_url', '/api/v1/balance/credit');
|
||||
if ($baseUrl === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$client = new \GuzzleHttp\Client(['timeout' => 15]);
|
||||
$res = $client->post($baseUrl . $url, [
|
||||
'json' => [
|
||||
'request_id' => 'mall_withdraw_' . uniqid(),
|
||||
'externalTransactionId' => $order->external_transaction_id,
|
||||
'user_id' => $userId,
|
||||
'amount' => $order->amount,
|
||||
'multiplier' => $order->multiplier,
|
||||
],
|
||||
]);
|
||||
$data = json_decode(strval($res->getBody()), true);
|
||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||
$order->playx_transaction_id = $data['playx_transaction_id'] ?? '';
|
||||
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||
$order->save();
|
||||
} else {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||
$order->fail_reason = $data['message'] ?? 'unknown';
|
||||
$order->save();
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||
$order->fail_reason = $e->getMessage();
|
||||
$order->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
85
app/common/library/MallBonusGrantPush.php
Normal file
85
app/common/library/MallBonusGrantPush.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\library;
|
||||
|
||||
use app\common\model\MallItem;
|
||||
use app\common\model\MallOrder;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
/**
|
||||
* 红利订单调用 PlayX bonus/grant(与定时任务、后台手动推送共用)
|
||||
*/
|
||||
final class MallBonusGrantPush
|
||||
{
|
||||
/**
|
||||
* @return array{ok: bool, message: string, playx_transaction_id: string}
|
||||
*/
|
||||
public static function push(MallOrder $order): array
|
||||
{
|
||||
$baseUrl = rtrim(strval(config('playx.api.base_url', '')), '/');
|
||||
if ($baseUrl === '') {
|
||||
return [
|
||||
'ok' => false,
|
||||
'message' => 'PlayX base_url not configured',
|
||||
'playx_transaction_id' => '',
|
||||
];
|
||||
}
|
||||
|
||||
$path = strval(config('playx.api.bonus_grant_url', '/api/v1/bonus/grant'));
|
||||
$url = $baseUrl . $path;
|
||||
|
||||
$item = MallItem::where('id', $order->mall_item_id)->find();
|
||||
$rewardName = $item ? strval($item->title) : '';
|
||||
$category = $item ? strval($item->category) : 'daily';
|
||||
$categoryTitle = $item ? strval($item->category_title) : '';
|
||||
$multiplier = intval($order->multiplier ?? 0);
|
||||
if ($multiplier <= 0) {
|
||||
$multiplier = 1;
|
||||
}
|
||||
|
||||
$client = new Client([
|
||||
'timeout' => 20,
|
||||
'http_errors' => false,
|
||||
]);
|
||||
|
||||
$requestId = 'mall_bonus_' . uniqid();
|
||||
|
||||
try {
|
||||
$res = $client->post($url, [
|
||||
'json' => [
|
||||
'request_id' => $requestId,
|
||||
'externalTransactionId' => $order->external_transaction_id,
|
||||
'user_id' => $order->user_id,
|
||||
'amount' => $order->amount,
|
||||
'rewardName' => $rewardName,
|
||||
'category' => $category,
|
||||
'categoryTitle' => $categoryTitle,
|
||||
'multiplier' => $multiplier,
|
||||
],
|
||||
]);
|
||||
|
||||
$data = json_decode(strval($res->getBody()), true) ?? [];
|
||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||
return [
|
||||
'ok' => true,
|
||||
'message' => '',
|
||||
'playx_transaction_id' => strval($data['playx_transaction_id'] ?? ''),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'ok' => false,
|
||||
'message' => strval($data['message'] ?? 'PlayX bonus grant not accepted'),
|
||||
'playx_transaction_id' => '',
|
||||
];
|
||||
} catch (\Throwable $e) {
|
||||
return [
|
||||
'ok' => false,
|
||||
'message' => $e->getMessage(),
|
||||
'playx_transaction_id' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,9 @@ class MallOrder extends Model
|
||||
public const GRANT_FAILED_RETRYABLE = 'FAILED_RETRYABLE';
|
||||
public const GRANT_FAILED_FINAL = 'FAILED_FINAL';
|
||||
|
||||
/** 非红利订单不参与 PlayX/Angpow 推送,固定为该占位值 */
|
||||
public const GRANT_NOT_APPLICABLE = '---';
|
||||
|
||||
protected array $type = [
|
||||
'create_time' => 'integer',
|
||||
'update_time' => 'integer',
|
||||
|
||||
@@ -238,17 +238,17 @@ class AngpowImportJobs
|
||||
return null;
|
||||
}
|
||||
|
||||
$createTime = $order->create_time ?? null;
|
||||
if (!is_int($createTime)) {
|
||||
if (is_numeric($createTime)) {
|
||||
$createTime = intval($createTime);
|
||||
} else {
|
||||
$createTime = time();
|
||||
}
|
||||
}
|
||||
// $createTime = $order->create_time ?? null;
|
||||
// if (!is_int($createTime)) {
|
||||
// if (is_numeric($createTime)) {
|
||||
// $createTime = intval($createTime);
|
||||
// } else {
|
||||
// $createTime = time();
|
||||
// }
|
||||
// }
|
||||
|
||||
$start = gmdate('Y-m-d\TH:i:s\Z', $createTime);
|
||||
$end = gmdate('Y-m-d\TH:i:s\Z', $createTime + 86400);
|
||||
$start = gmdate('Y-m-d H:i:s', strtotime($order->start_time));
|
||||
$end = gmdate('Y-m-d H:i:s', strtotime($order->end_time));
|
||||
|
||||
return [
|
||||
'member_login' => strval($asset->playx_user_id),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace app\process;
|
||||
|
||||
use app\common\model\MallItem;
|
||||
use app\common\library\MallBonusGrantPush;
|
||||
use app\common\model\MallOrder;
|
||||
use app\common\model\MallUserAsset;
|
||||
use GuzzleHttp\Client;
|
||||
@@ -47,7 +47,8 @@ class PlayxJobs
|
||||
$path = strval(config('playx.api.transaction_status_url', '/api/v1/transaction/status'));
|
||||
$url = rtrim($baseUrl, '/') . $path;
|
||||
|
||||
$list = MallOrder::where('grant_status', MallOrder::GRANT_ACCEPTED)
|
||||
$list = MallOrder::where('type', MallOrder::TYPE_BONUS)
|
||||
->where('grant_status', MallOrder::GRANT_ACCEPTED)
|
||||
->where('status', MallOrder::STATUS_PENDING)
|
||||
->order('id', 'desc')
|
||||
->limit(50)
|
||||
@@ -98,13 +99,9 @@ class PlayxJobs
|
||||
return;
|
||||
}
|
||||
|
||||
$bonusPath = strval(config('playx.api.bonus_grant_url', '/api/v1/bonus/grant'));
|
||||
$withdrawPath = strval(config('playx.api.balance_credit_url', '/api/v1/balance/credit'));
|
||||
$bonusUrl = rtrim($baseUrl, '/') . $bonusPath;
|
||||
$withdrawUrl = rtrim($baseUrl, '/') . $withdrawPath;
|
||||
|
||||
$maxRetry = 3;
|
||||
$list = MallOrder::whereIn('grant_status', [
|
||||
$list = MallOrder::where('type', MallOrder::TYPE_BONUS)
|
||||
->whereIn('grant_status', [
|
||||
MallOrder::GRANT_NOT_SENT,
|
||||
MallOrder::GRANT_FAILED_RETRYABLE,
|
||||
])
|
||||
@@ -124,14 +121,12 @@ class PlayxJobs
|
||||
$order->retry_count = intval($order->retry_count ?? 0) + 1;
|
||||
|
||||
try {
|
||||
$this->sendGrantByOrder($order, $bonusUrl, $withdrawUrl, $maxRetry);
|
||||
$this->sendGrantByOrder($order, $maxRetry);
|
||||
} catch (\Throwable $e) {
|
||||
$order->fail_reason = $e->getMessage();
|
||||
if (intval($order->retry_count) >= $maxRetry) {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||
$order->status = MallOrder::STATUS_REJECTED;
|
||||
$order->save();
|
||||
$this->refundPoints($order);
|
||||
} else {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||
$order->save();
|
||||
@@ -167,99 +162,31 @@ class PlayxJobs
|
||||
return false;
|
||||
}
|
||||
|
||||
private function sendGrantByOrder(MallOrder $order, string $bonusUrl, string $withdrawUrl, int $maxRetry): void
|
||||
private function sendGrantByOrder(MallOrder $order, int $maxRetry): void
|
||||
{
|
||||
$item = null;
|
||||
if ($order->mallItem) {
|
||||
$item = $order->mallItem;
|
||||
} else {
|
||||
$item = MallItem::where('id', $order->mall_item_id)->find();
|
||||
}
|
||||
|
||||
if ($order->type === MallOrder::TYPE_BONUS) {
|
||||
$rewardName = $item ? strval($item->title) : '';
|
||||
$category = $item ? strval($item->category) : 'daily';
|
||||
$categoryTitle = $item ? strval($item->category_title) : '';
|
||||
$multiplier = intval($order->multiplier ?? 0);
|
||||
if ($multiplier <= 0) {
|
||||
$multiplier = 1;
|
||||
}
|
||||
|
||||
$requestId = 'mall_retry_bonus_' . uniqid();
|
||||
$res = $this->http->post($bonusUrl, [
|
||||
'json' => [
|
||||
'request_id' => $requestId,
|
||||
'externalTransactionId' => $order->external_transaction_id,
|
||||
'user_id' => $order->user_id,
|
||||
'amount' => $order->amount,
|
||||
'rewardName' => $rewardName,
|
||||
'category' => $category,
|
||||
'categoryTitle' => $categoryTitle,
|
||||
'multiplier' => $multiplier,
|
||||
],
|
||||
]);
|
||||
|
||||
$data = json_decode(strval($res->getBody()), true) ?? [];
|
||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||
$order->playx_transaction_id = strval($data['playx_transaction_id'] ?? '');
|
||||
$order->save();
|
||||
return;
|
||||
}
|
||||
|
||||
$order->fail_reason = strval($data['message'] ?? 'PlayX bonus grant not accepted');
|
||||
if (intval($order->retry_count) >= $maxRetry) {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||
$order->status = MallOrder::STATUS_REJECTED;
|
||||
$order->save();
|
||||
$this->refundPoints($order);
|
||||
return;
|
||||
}
|
||||
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||
$order->save();
|
||||
if ($order->type !== MallOrder::TYPE_BONUS) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($order->type === MallOrder::TYPE_WITHDRAW) {
|
||||
$multiplier = intval($order->multiplier ?? 0);
|
||||
if ($multiplier <= 0) {
|
||||
$multiplier = 1;
|
||||
}
|
||||
$requestId = 'mall_retry_withdraw_' . uniqid();
|
||||
$res = $this->http->post($withdrawUrl, [
|
||||
'json' => [
|
||||
'request_id' => $requestId,
|
||||
'externalTransactionId' => $order->external_transaction_id,
|
||||
'user_id' => $order->user_id,
|
||||
'amount' => $order->amount,
|
||||
'multiplier' => $multiplier,
|
||||
],
|
||||
]);
|
||||
|
||||
$data = json_decode(strval($res->getBody()), true) ?? [];
|
||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||
$order->playx_transaction_id = strval($data['playx_transaction_id'] ?? '');
|
||||
$order->save();
|
||||
return;
|
||||
}
|
||||
|
||||
$order->fail_reason = strval($data['message'] ?? 'PlayX balance credit not accepted');
|
||||
if (intval($order->retry_count) >= $maxRetry) {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||
$order->status = MallOrder::STATUS_REJECTED;
|
||||
$order->save();
|
||||
$this->refundPoints($order);
|
||||
return;
|
||||
}
|
||||
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||
$result = MallBonusGrantPush::push($order);
|
||||
if ($result['ok']) {
|
||||
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||
$order->playx_transaction_id = $result['playx_transaction_id'];
|
||||
$order->save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// PHYSICAL 目前由后台手工发货/驳回,不参与 PlayX 发放重试
|
||||
$order->fail_reason = $result['message'];
|
||||
if (intval($order->retry_count) >= $maxRetry) {
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||
$order->save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||
$order->save();
|
||||
}
|
||||
|
||||
private function refundPoints(MallOrder $order): void
|
||||
|
||||
@@ -13,7 +13,7 @@ return [
|
||||
// Daily Push 签名校验(PlayX 调用商城时使用)
|
||||
'daily_push_secret' => strval(env('PLAYX_DAILY_PUSH_SECRET', '')),
|
||||
/**
|
||||
* 合作方 JWT 验签密钥(HS256)。非空时:daily-push 等回调需带 Authorization: Bearer
|
||||
* 合作方 JWT 验签密钥(HS256)。非空时:dailyPush 等回调需带 Authorization: Bearer
|
||||
* 仅写入部署环境变量,勿提交仓库。
|
||||
*/
|
||||
'partner_jwt_secret' => strval(env('PLAYX_PARTNER_JWT_SECRET', '')),
|
||||
|
||||
@@ -526,7 +526,7 @@ curl -G 'http://localhost:1818/api/v1/mall/orders' --data-urlencode 'session_id=
|
||||
- 发货:录入物流公司、单号 → `SHIPPED`
|
||||
- 驳回:录入驳回原因 → `REJECTED`,自动退回积分
|
||||
- **红利/提现订单**:
|
||||
- 展示 `external_transaction_id`、`playx_transaction_id`、发放子状态
|
||||
- 展示 `external_transaction_id`、`playx_transaction_id`、推送playx
|
||||
- 手动重试:仅对 `FAILED_RETRYABLE` 状态,记录 `retry_request_id`、操作者、原因
|
||||
|
||||
### 2.3 用户资产与人工调账
|
||||
|
||||
11
tmp_sig.php
11
tmp_sig.php
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
//脚本执行指令 php tmp_sig.php
|
||||
$secret = '5590a339502b133f4d0c545c3cdad159a4827dfccb3f51bb110c56f9b96568ca';
|
||||
$ts = '1700000123';
|
||||
$rid = 'req_1700000000_234567';
|
||||
$ts = '1775525663';
|
||||
$rid = 'req_1775525663_123';
|
||||
$body = [
|
||||
'report_date' => '1700000123',
|
||||
'report_date' => '1775525663',
|
||||
'member' => [
|
||||
[
|
||||
'member_id' => '234567',
|
||||
'member_id' => '123',
|
||||
'login' => 'zhenhui',
|
||||
'ltv_deposit' => 1500,
|
||||
'ltv_withdrawal' => 1800,
|
||||
@@ -18,7 +19,7 @@ $body = [
|
||||
];
|
||||
|
||||
$json = json_encode($body);
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/playx/daily-push\n" . hash('sha256', $json);
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/mall/dailyPush\n" . hash('sha256', $json);
|
||||
|
||||
echo "json={$json}\n";
|
||||
echo "sha256=" . hash('sha256', $json) . "\n";
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/**
|
||||
* backend common language package
|
||||
*/
|
||||
import menu from './en/menu'
|
||||
|
||||
export default {
|
||||
menu,
|
||||
Balance: 'Balance',
|
||||
Integral: 'Integral',
|
||||
Connection: 'connection',
|
||||
|
||||
@@ -1,38 +1,43 @@
|
||||
export default {
|
||||
id: 'id',
|
||||
user_id: 'user_id',
|
||||
type: 'type',
|
||||
'type BONUS': 'Bonus(BONUS)',
|
||||
'type PHYSICAL': 'Physical(PHYSICAL)',
|
||||
'type WITHDRAW': 'Withdraw(WITHDRAW)',
|
||||
status: 'status',
|
||||
'status PENDING': 'Pending(PENDING)',
|
||||
'status COMPLETED': 'Completed(COMPLETED)',
|
||||
'status SHIPPED': 'Shipped(SHIPPED)',
|
||||
'status REJECTED': 'Rejected(REJECTED)',
|
||||
mall_item_id: 'mall_item_id',
|
||||
mallitem__title: 'title',
|
||||
points_cost: 'points_cost',
|
||||
amount: 'amount',
|
||||
multiplier: 'multiplier',
|
||||
external_transaction_id: 'external_transaction_id',
|
||||
playx_transaction_id: 'playx_transaction_id',
|
||||
grant_status: 'grant_status',
|
||||
'grant_status NOT_SENT': 'NOT_SENT',
|
||||
'grant_status SENT_PENDING': 'SENT_PENDING',
|
||||
'grant_status ACCEPTED': 'ACCEPTED',
|
||||
'grant_status FAILED_RETRYABLE': 'FAILED_RETRYABLE',
|
||||
'grant_status FAILED_FINAL': 'FAILED_FINAL',
|
||||
fail_reason: 'fail_reason',
|
||||
reject_reason: 'reject_reason',
|
||||
shipping_company: 'shipping_company',
|
||||
shipping_no: 'shipping_no',
|
||||
receiver_name: 'receiver_name',
|
||||
receiver_phone: 'receiver_phone',
|
||||
receiver_address: 'receiver_address',
|
||||
mall_address_id: 'mall_address_id',
|
||||
create_time: 'create_time',
|
||||
update_time: 'update_time',
|
||||
'quick Search Fields': 'ID',
|
||||
approve: 'Review',
|
||||
manual_retry: 'Retry grant',
|
||||
retry_confirm: 'Queue this order for grant retry?',
|
||||
id: 'Order ID',
|
||||
user_id: 'User ID',
|
||||
type: 'Type',
|
||||
'type BONUS': 'Bonus',
|
||||
'type PHYSICAL': 'Physical',
|
||||
'type WITHDRAW': 'Withdraw',
|
||||
status: 'Status',
|
||||
'status PENDING': 'Pending',
|
||||
'status COMPLETED': 'Completed',
|
||||
'status SHIPPED': 'Shipped',
|
||||
'status REJECTED': 'Rejected',
|
||||
mall_item_id: 'Product ID',
|
||||
mallitem__title: 'Product title',
|
||||
points_cost: 'Points spent',
|
||||
amount: 'Cash amount',
|
||||
multiplier: 'Turnover multiplier',
|
||||
external_transaction_id: 'Order number',
|
||||
playx_transaction_id: 'PlayX transaction ID',
|
||||
grant_status: 'Grant status',
|
||||
'grant_status NOT_SENT': 'Not sent',
|
||||
'grant_status SENT_PENDING': 'Sent (queued)',
|
||||
'grant_status ACCEPTED': 'Accepted',
|
||||
'grant_status FAILED_RETRYABLE': 'Failed (retryable)',
|
||||
'grant_status FAILED_FINAL': 'Failed (final)',
|
||||
'grant_status ---': '—',
|
||||
fail_reason: 'Failure reason',
|
||||
reject_reason: 'Rejection reason',
|
||||
shipping_company: 'Carrier',
|
||||
shipping_no: 'Tracking number',
|
||||
receiver_name: 'Recipient name',
|
||||
receiver_phone: 'Recipient phone',
|
||||
receiver_address: 'Shipping address',
|
||||
mall_address_id: 'Address ID',
|
||||
start_time: 'Redemption time',
|
||||
end_time: 'Collection end time',
|
||||
create_time: 'Created at',
|
||||
update_time: 'Updated at',
|
||||
'quick Search Fields': 'Order ID',
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ export default {
|
||||
'grant_status ACCEPTED': 'ACCEPTED',
|
||||
'grant_status FAILED_RETRYABLE': 'FAILED_RETRYABLE',
|
||||
'grant_status FAILED_FINAL': 'FAILED_FINAL',
|
||||
'grant_status ---': '---',
|
||||
fail_reason: 'fail_reason',
|
||||
reject_reason: 'reject_reason',
|
||||
shipping_company: 'shipping_company',
|
||||
|
||||
119
web/src/lang/backend/en/menu.ts
Normal file
119
web/src/lang/backend/en/menu.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Admin menu titles (admin_rule.name → menu.names.{name with / as _})
|
||||
*/
|
||||
export default {
|
||||
names: {
|
||||
dashboard: 'Dashboard',
|
||||
dashboard_index: 'Browse',
|
||||
dashboard_dashboard: 'Dashboard',
|
||||
auth: 'Access control',
|
||||
auth_group: 'Admin groups',
|
||||
auth_group_index: 'Browse',
|
||||
auth_group_add: 'Add',
|
||||
auth_group_edit: 'Edit',
|
||||
auth_group_del: 'Delete',
|
||||
auth_admin: 'Administrators',
|
||||
auth_admin_index: 'Browse',
|
||||
auth_admin_add: 'Add',
|
||||
auth_admin_edit: 'Edit',
|
||||
auth_admin_del: 'Delete',
|
||||
auth_rule: 'Menu rules',
|
||||
auth_rule_index: 'Browse',
|
||||
auth_rule_add: 'Add',
|
||||
auth_rule_edit: 'Edit',
|
||||
auth_rule_del: 'Delete',
|
||||
auth_rule_sortable: 'Sort',
|
||||
auth_adminLog: 'Admin logs',
|
||||
auth_adminLog_index: 'Browse',
|
||||
user: 'Members',
|
||||
user_user: 'Members',
|
||||
user_user_index: 'Browse',
|
||||
user_user_add: 'Add',
|
||||
user_user_edit: 'Edit',
|
||||
user_user_del: 'Delete',
|
||||
user_group: 'Member groups',
|
||||
user_group_index: 'Browse',
|
||||
user_group_add: 'Add',
|
||||
user_group_edit: 'Edit',
|
||||
user_group_del: 'Delete',
|
||||
user_rule: 'Member rules',
|
||||
user_rule_index: 'Browse',
|
||||
user_rule_add: 'Add',
|
||||
user_rule_edit: 'Edit',
|
||||
user_rule_del: 'Delete',
|
||||
user_rule_sortable: 'Sort',
|
||||
user_moneyLog: 'Balance logs',
|
||||
user_moneyLog_index: 'Browse',
|
||||
user_moneyLog_add: 'Add',
|
||||
user_scoreLog: 'Points logs',
|
||||
user_scoreLog_index: 'Browse',
|
||||
user_scoreLog_add: 'Add',
|
||||
routine: 'General',
|
||||
routine_config: 'System config',
|
||||
routine_config_index: 'Browse',
|
||||
routine_config_edit: 'Edit',
|
||||
routine_config_add: 'Add',
|
||||
routine_config_del: 'Delete',
|
||||
routine_attachment: 'Attachments',
|
||||
routine_attachment_index: 'Browse',
|
||||
routine_attachment_edit: 'Edit',
|
||||
routine_attachment_del: 'Delete',
|
||||
routine_adminInfo: 'Profile',
|
||||
routine_adminInfo_index: 'Browse',
|
||||
routine_adminInfo_edit: 'Edit',
|
||||
security: 'Data security',
|
||||
security_dataRecycleLog: 'Recycle bin',
|
||||
security_dataRecycleLog_index: 'Browse',
|
||||
security_dataRecycleLog_del: 'Delete',
|
||||
security_dataRecycleLog_restore: 'Restore',
|
||||
security_dataRecycleLog_info: 'Details',
|
||||
security_sensitiveDataLog: 'Sensitive data logs',
|
||||
security_sensitiveDataLog_index: 'Browse',
|
||||
security_sensitiveDataLog_del: 'Delete',
|
||||
security_sensitiveDataLog_rollback: 'Rollback',
|
||||
security_sensitiveDataLog_info: 'Details',
|
||||
security_dataRecycle: 'Recycle rules',
|
||||
security_dataRecycle_index: 'Browse',
|
||||
security_dataRecycle_add: 'Add',
|
||||
security_dataRecycle_edit: 'Edit',
|
||||
security_dataRecycle_del: 'Delete',
|
||||
security_sensitiveData: 'Sensitive field rules',
|
||||
security_sensitiveData_index: 'Browse',
|
||||
security_sensitiveData_add: 'Add',
|
||||
security_sensitiveData_edit: 'Edit',
|
||||
security_sensitiveData_del: 'Delete',
|
||||
buildadmin: 'BuildAdmin',
|
||||
buildadmin_buildadmin: 'BuildAdmin',
|
||||
moduleStore_moduleStore: 'Module store',
|
||||
moduleStore_moduleStore_index: 'Browse',
|
||||
moduleStore_moduleStore_install: 'Install',
|
||||
moduleStore_moduleStore_changeState: 'Change state',
|
||||
moduleStore_moduleStore_uninstall: 'Uninstall',
|
||||
moduleStore_moduleStore_update: 'Update',
|
||||
crud_crud: 'CRUD generator',
|
||||
crud_crud_index: 'Browse',
|
||||
crud_crud_generate: 'Generate',
|
||||
crud_crud_delete: 'Delete',
|
||||
mall: 'Points mall',
|
||||
mall_userAsset: 'User assets',
|
||||
mall_userAsset_index: 'Browse',
|
||||
mall_userAsset_edit: 'Edit',
|
||||
mall_userAsset_del: 'Delete',
|
||||
mall_address: 'Shipping addresses',
|
||||
mall_order: 'Orders',
|
||||
mall_order_add: 'Add',
|
||||
mall_order_edit: 'Edit',
|
||||
mall_order_del: 'Delete',
|
||||
mall_order_approve: 'Approve',
|
||||
mall_dailyPush: 'Daily push',
|
||||
mall_claimLog: 'Claim log',
|
||||
mall_item: 'Products',
|
||||
mall_playxOrder: 'PlayX orders',
|
||||
mall_playxCenter: 'PlayX center',
|
||||
mall_playxClaimLog: 'PlayX claim log',
|
||||
mall_playxDailyPush: 'PlayX daily push',
|
||||
mall_playxUserAsset: 'PlayX user assets',
|
||||
mall_pintsOrder: 'Points orders',
|
||||
mall_redemptionOrder: 'Redemption orders',
|
||||
},
|
||||
}
|
||||
@@ -2,7 +2,10 @@
|
||||
* 后台公共语言包
|
||||
* 覆盖风险:请避免使用页面语言包的目录名、文件名作为翻译 key
|
||||
*/
|
||||
import menu from './zh-cn/menu'
|
||||
|
||||
export default {
|
||||
menu,
|
||||
Balance: '余额',
|
||||
Integral: '积分',
|
||||
Connection: '连接标识',
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
export default {
|
||||
approve: '审核',
|
||||
manual_retry: '手动重试',
|
||||
retry_confirm: '确认将该订单加入重试队列?',
|
||||
id: 'ID',
|
||||
user_id: '用户ID',
|
||||
type: '类型',
|
||||
@@ -17,12 +20,13 @@ export default {
|
||||
multiplier: '流水倍数',
|
||||
external_transaction_id: '订单号',
|
||||
playx_transaction_id: 'PlayX流水号',
|
||||
grant_status: '发放子状态',
|
||||
grant_status: '推送playx状态',
|
||||
'grant_status NOT_SENT': '未发送',
|
||||
'grant_status SENT_PENDING': '已发送排队',
|
||||
'grant_status ACCEPTED': '已接收(accepted)',
|
||||
'grant_status ACCEPTED': '已接收',
|
||||
'grant_status FAILED_RETRYABLE': '失败可重试',
|
||||
'grant_status FAILED_FINAL': '失败最终',
|
||||
'grant_status ---': '---',
|
||||
fail_reason: '失败原因',
|
||||
reject_reason: '驳回原因',
|
||||
shipping_company: '物流公司',
|
||||
@@ -31,8 +35,9 @@ export default {
|
||||
receiver_phone: '收货电话',
|
||||
receiver_address: '收货地址',
|
||||
mall_address_id: '地址ID',
|
||||
start_time: '兑换时间',
|
||||
end_time: '领取结束时间',
|
||||
create_time: '创建时间',
|
||||
update_time: '修改时间',
|
||||
'quick Search Fields': 'ID',
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
title: 'PlayX 对接中心',
|
||||
desc: '集中管理积分商城与 PlayX 的订单、推送、领取与资产数据。建议优先处理“发放子状态=失败可重试”的订单。',
|
||||
desc: '集中管理积分商城与 PlayX 的订单、推送、领取与资产数据。建议优先处理“推送playx状态=失败可重试”的订单。',
|
||||
orders: '统一订单',
|
||||
dailyPush: '每日推送',
|
||||
claimLog: '领取记录',
|
||||
|
||||
@@ -17,12 +17,13 @@ export default {
|
||||
multiplier: '流水倍数',
|
||||
external_transaction_id: '订单号',
|
||||
playx_transaction_id: 'PlayX流水号',
|
||||
grant_status: '发放子状态',
|
||||
grant_status: '推送playx状态',
|
||||
'grant_status NOT_SENT': '未发送',
|
||||
'grant_status SENT_PENDING': '已发送排队',
|
||||
'grant_status ACCEPTED': '已接收(accepted)',
|
||||
'grant_status FAILED_RETRYABLE': '失败可重试',
|
||||
'grant_status FAILED_FINAL': '失败最终',
|
||||
'grant_status ---': '---',
|
||||
fail_reason: '失败原因',
|
||||
reject_reason: '驳回原因',
|
||||
shipping_company: '物流公司',
|
||||
|
||||
120
web/src/lang/backend/zh-cn/menu.ts
Normal file
120
web/src/lang/backend/zh-cn/menu.ts
Normal file
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* 后台菜单标题(与 admin_rule.name 对应:menu.names.{name 中 / 改为 _})
|
||||
*/
|
||||
export default {
|
||||
names: {
|
||||
/** version202 后菜单 name 为 dashboard,不再使用 dashboard/dashboard */
|
||||
dashboard: '控制台',
|
||||
dashboard_index: '查看',
|
||||
dashboard_dashboard: '控制台',
|
||||
auth: '权限管理',
|
||||
auth_group: '角色组管理',
|
||||
auth_group_index: '查看',
|
||||
auth_group_add: '添加',
|
||||
auth_group_edit: '编辑',
|
||||
auth_group_del: '删除',
|
||||
auth_admin: '管理员管理',
|
||||
auth_admin_index: '查看',
|
||||
auth_admin_add: '添加',
|
||||
auth_admin_edit: '编辑',
|
||||
auth_admin_del: '删除',
|
||||
auth_rule: '菜单规则管理',
|
||||
auth_rule_index: '查看',
|
||||
auth_rule_add: '添加',
|
||||
auth_rule_edit: '编辑',
|
||||
auth_rule_del: '删除',
|
||||
auth_rule_sortable: '快速排序',
|
||||
auth_adminLog: '管理员日志管理',
|
||||
auth_adminLog_index: '查看',
|
||||
user: '会员管理',
|
||||
user_user: '会员管理',
|
||||
user_user_index: '查看',
|
||||
user_user_add: '添加',
|
||||
user_user_edit: '编辑',
|
||||
user_user_del: '删除',
|
||||
user_group: '会员分组管理',
|
||||
user_group_index: '查看',
|
||||
user_group_add: '添加',
|
||||
user_group_edit: '编辑',
|
||||
user_group_del: '删除',
|
||||
user_rule: '会员规则管理',
|
||||
user_rule_index: '查看',
|
||||
user_rule_add: '添加',
|
||||
user_rule_edit: '编辑',
|
||||
user_rule_del: '删除',
|
||||
user_rule_sortable: '快速排序',
|
||||
user_moneyLog: '会员余额管理',
|
||||
user_moneyLog_index: '查看',
|
||||
user_moneyLog_add: '添加',
|
||||
user_scoreLog: '会员积分管理',
|
||||
user_scoreLog_index: '查看',
|
||||
user_scoreLog_add: '添加',
|
||||
routine: '常规管理',
|
||||
routine_config: '系统配置',
|
||||
routine_config_index: '查看',
|
||||
routine_config_edit: '编辑',
|
||||
routine_config_add: '添加',
|
||||
routine_config_del: '删除',
|
||||
routine_attachment: '附件管理',
|
||||
routine_attachment_index: '查看',
|
||||
routine_attachment_edit: '编辑',
|
||||
routine_attachment_del: '删除',
|
||||
routine_adminInfo: '个人资料',
|
||||
routine_adminInfo_index: '查看',
|
||||
routine_adminInfo_edit: '编辑',
|
||||
security: '数据安全管理',
|
||||
security_dataRecycleLog: '数据回收站',
|
||||
security_dataRecycleLog_index: '查看',
|
||||
security_dataRecycleLog_del: '删除',
|
||||
security_dataRecycleLog_restore: '还原',
|
||||
security_dataRecycleLog_info: '查看详情',
|
||||
security_sensitiveDataLog: '敏感数据修改记录',
|
||||
security_sensitiveDataLog_index: '查看',
|
||||
security_sensitiveDataLog_del: '删除',
|
||||
security_sensitiveDataLog_rollback: '回滚',
|
||||
security_sensitiveDataLog_info: '查看详情',
|
||||
security_dataRecycle: '数据回收规则管理',
|
||||
security_dataRecycle_index: '查看',
|
||||
security_dataRecycle_add: '添加',
|
||||
security_dataRecycle_edit: '编辑',
|
||||
security_dataRecycle_del: '删除',
|
||||
security_sensitiveData: '敏感字段规则管理',
|
||||
security_sensitiveData_index: '查看',
|
||||
security_sensitiveData_add: '添加',
|
||||
security_sensitiveData_edit: '编辑',
|
||||
security_sensitiveData_del: '删除',
|
||||
buildadmin: 'BuildAdmin',
|
||||
buildadmin_buildadmin: 'BuildAdmin',
|
||||
moduleStore_moduleStore: '模块市场',
|
||||
moduleStore_moduleStore_index: '查看',
|
||||
moduleStore_moduleStore_install: '安装',
|
||||
moduleStore_moduleStore_changeState: '调整状态',
|
||||
moduleStore_moduleStore_uninstall: '卸载',
|
||||
moduleStore_moduleStore_update: '更新',
|
||||
crud_crud: 'CRUD代码生成',
|
||||
crud_crud_index: '查看',
|
||||
crud_crud_generate: '生成',
|
||||
crud_crud_delete: '删除',
|
||||
mall: '积分商城',
|
||||
mall_userAsset: '用户资产',
|
||||
mall_userAsset_index: '查看',
|
||||
mall_userAsset_edit: '编辑',
|
||||
mall_userAsset_del: '删除',
|
||||
mall_address: '收货地址管理',
|
||||
mall_order: '统一订单',
|
||||
mall_order_add: '新增',
|
||||
mall_order_edit: '编辑',
|
||||
mall_order_del: '删除',
|
||||
mall_order_approve: '审核通过',
|
||||
mall_dailyPush: '每日推送',
|
||||
mall_claimLog: '领取记录',
|
||||
mall_item: '商品管理',
|
||||
mall_playxOrder: 'PlayX订单',
|
||||
mall_playxCenter: 'PlayX中心',
|
||||
mall_playxClaimLog: 'PlayX领取记录',
|
||||
mall_playxDailyPush: 'PlayX每日推送',
|
||||
mall_playxUserAsset: 'PlayX用户资产',
|
||||
mall_pintsOrder: '积分订单',
|
||||
mall_redemptionOrder: '兑换订单',
|
||||
},
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<el-sub-menu @click="onClickSubMenu(menu)" :index="getMenuKey(menu)" :key="getMenuKey(menu)">
|
||||
<template #title>
|
||||
<Icon :color="config.getColorVal('menuColor')" :name="menu.meta?.icon ? menu.meta?.icon : config.layout.menuDefaultIcon" />
|
||||
<span>{{ menu.meta?.title ? menu.meta?.title : $t('noTitle') }}</span>
|
||||
<span>{{ menuTitleFromRoute(menu) }}</span>
|
||||
</template>
|
||||
<MenuTree :extends="{ ...props.extends, level: props.extends.level + 1 }" :menus="menu.children" />
|
||||
</el-sub-menu>
|
||||
@@ -12,7 +12,7 @@
|
||||
<template v-else>
|
||||
<el-menu-item @click="onClickMenu(menu)" :index="getMenuKey(menu)" :key="getMenuKey(menu)">
|
||||
<Icon :color="config.getColorVal('menuColor')" :name="menu.meta?.icon ? menu.meta?.icon : config.layout.menuDefaultIcon" />
|
||||
<span>{{ menu.meta?.title ? menu.meta?.title : $t('noTitle') }}</span>
|
||||
<span>{{ menuTitleFromRoute(menu) }}</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
@@ -23,6 +23,7 @@ import { ElNotification } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
import { menuTitleFromRoute } from '/@/utils/menuI18n'
|
||||
import { getFirstRoute, getMenuKey, onClickMenu } from '/@/utils/router'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:ref="tabsRefs.set"
|
||||
:key="idx"
|
||||
>
|
||||
{{ item.meta.title }}
|
||||
{{ menuTitleFromRoute(item) }}
|
||||
<transition @after-leave="selectNavTab(tabsRefs[navTabs.state.activeIndex])" name="el-fade-in">
|
||||
<Icon v-show="navTabs.state.tabsView.length > 1" class="close-icon" @click.stop="closeTab(item)" size="15" name="el-icon-Close" />
|
||||
</transition>
|
||||
@@ -29,6 +29,7 @@ import type { ContextMenuItem, ContextMenuItemClickEmitArg } from '/@/components
|
||||
import useCurrentInstance from '/@/utils/useCurrentInstance'
|
||||
import Contextmenu from '/@/components/contextmenu/index.vue'
|
||||
import horizontalScroll from '/@/utils/horizontalScroll'
|
||||
import { menuTitleFromRoute } from '/@/utils/menuI18n'
|
||||
import { getFirstRoute, routePush } from '/@/utils/router'
|
||||
import { adminBaseRoutePath } from '/@/router/static/adminBase'
|
||||
|
||||
|
||||
33
web/src/utils/menuI18n.ts
Normal file
33
web/src/utils/menuI18n.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router'
|
||||
import { i18n } from '/@/lang/index'
|
||||
|
||||
/**
|
||||
* 后台菜单/标签标题:优先按路由 name(对应 admin_rule.name)匹配 menu.names.*
|
||||
*/
|
||||
export function menuI18nKeyFromName(name: string | symbol | null | undefined): string {
|
||||
if (name == null || name === '') {
|
||||
return ''
|
||||
}
|
||||
const n = String(name).trim()
|
||||
if (!n) {
|
||||
return ''
|
||||
}
|
||||
return `menu.names.${n.replace(/\//g, '_')}`
|
||||
}
|
||||
|
||||
export function menuTitleFromName(name: string | symbol | null | undefined, fallback?: string): string {
|
||||
const key = menuI18nKeyFromName(name)
|
||||
if (key && i18n.global.te(key)) {
|
||||
return String(i18n.global.t(key))
|
||||
}
|
||||
if (fallback && i18n.global.te(fallback)) {
|
||||
return String(i18n.global.t(fallback))
|
||||
}
|
||||
return fallback || ''
|
||||
}
|
||||
|
||||
export function menuTitleFromRoute(route: RouteRecordRaw | RouteLocationNormalized): string {
|
||||
const name = route.name
|
||||
const metaTitle = route.meta && typeof route.meta.title === 'string' ? route.meta.title : ''
|
||||
return menuTitleFromName(name, metaTitle) || metaTitle || String(i18n.global.t('noTitle'))
|
||||
}
|
||||
@@ -34,7 +34,7 @@ const optButtons: OptButton[] = defaultOptButtons(['edit', 'delete']).map((btn)
|
||||
btn.name === 'edit'
|
||||
? {
|
||||
...btn,
|
||||
title: '审核',
|
||||
title: t('mall.order.approve'),
|
||||
type: 'primary',
|
||||
class: 'table-row-edit',
|
||||
icon: 'fa fa-check',
|
||||
@@ -125,6 +125,15 @@ const baTable = new baTableClass(
|
||||
label: t('mall.order.grant_status'),
|
||||
prop: 'grant_status',
|
||||
align: 'center',
|
||||
minWidth: 100,
|
||||
custom: {
|
||||
NOT_SENT: 'info',
|
||||
SENT_PENDING: 'primary',
|
||||
ACCEPTED: 'primary',
|
||||
FAILED_RETRYABLE: 'error',
|
||||
FAILED_FINAL: 'error',
|
||||
'---': 'info',
|
||||
},
|
||||
operator: 'eq',
|
||||
sortable: false,
|
||||
render: 'tag',
|
||||
@@ -134,6 +143,7 @@ const baTable = new baTableClass(
|
||||
ACCEPTED: t('mall.order.grant_status ACCEPTED'),
|
||||
FAILED_RETRYABLE: t('mall.order.grant_status FAILED_RETRYABLE'),
|
||||
FAILED_FINAL: t('mall.order.grant_status FAILED_FINAL'),
|
||||
'---': t('mall.order.grant_status ---'),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -200,6 +210,24 @@ const baTable = new baTableClass(
|
||||
operatorPlaceholder: t('Fuzzy query'),
|
||||
},
|
||||
{ label: t('mall.order.mall_address_id'), prop: 'mall_address_id', align: 'center', width: 100, operator: 'eq', sortable: false },
|
||||
{
|
||||
label: t('mall.order.start_time'),
|
||||
prop: 'start_time',
|
||||
align: 'center',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
sortable: 'custom',
|
||||
width: 160,
|
||||
},
|
||||
{
|
||||
label: t('mall.order.end_time'),
|
||||
prop: 'end_time',
|
||||
align: 'center',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
sortable: 'custom',
|
||||
width: 160,
|
||||
},
|
||||
{
|
||||
label: t('mall.order.create_time'),
|
||||
prop: 'create_time',
|
||||
@@ -215,6 +243,7 @@ const baTable = new baTableClass(
|
||||
label: t('mall.order.update_time'),
|
||||
prop: 'update_time',
|
||||
align: 'center',
|
||||
show: false,
|
||||
render: 'datetime',
|
||||
operator: 'RANGE',
|
||||
comSearchRender: 'datetime',
|
||||
@@ -225,7 +254,7 @@ const baTable = new baTableClass(
|
||||
{
|
||||
label: t('Operate'),
|
||||
align: 'center',
|
||||
width: 80,
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
@@ -233,17 +262,20 @@ const baTable = new baTableClass(
|
||||
{
|
||||
render: 'confirmButton',
|
||||
name: 'retry',
|
||||
title: 'Retry',
|
||||
text: '手动重试',
|
||||
type: 'warning',
|
||||
icon: '',
|
||||
title: t('mall.order.manual_retry'),
|
||||
text: '',
|
||||
type: 'primary',
|
||||
class: 'table-row-edit',
|
||||
icon: 'fa fa-refresh',
|
||||
display: (row: TableRow) =>
|
||||
(row.type === 'BONUS' || row.type === 'WITHDRAW') && row.grant_status === 'FAILED_RETRYABLE' && row.status === 'PENDING',
|
||||
row.type === 'BONUS' &&
|
||||
row.status === 'PENDING' &&
|
||||
['NOT_SENT', 'SENT_PENDING', 'FAILED_RETRYABLE', 'FAILED_FINAL'].includes(String(row.grant_status)),
|
||||
popconfirm: {
|
||||
title: '确认将该订单加入重试队列?',
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'warning',
|
||||
title: t('mall.order.retry_confirm'),
|
||||
confirmButtonText: t('Confirm'),
|
||||
cancelButtonText: t('Cancel'),
|
||||
confirmButtonType: 'primary',
|
||||
},
|
||||
click: async (row: TableRow) => {
|
||||
await createAxios(
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</template>
|
||||
|
||||
<template v-else-if="usePagedActions">
|
||||
<template v-if="action === 'approveShip'">
|
||||
<template v-if="action === 'approveShip' && isPhysical">
|
||||
<FormItem
|
||||
:label="t('mall.order.shipping_company')"
|
||||
type="string"
|
||||
@@ -75,6 +75,7 @@
|
||||
</template>
|
||||
<template v-else-if="action === 'reject'">
|
||||
<FormItem
|
||||
v-if="isPhysical"
|
||||
:label="t('mall.order.reject_reason')"
|
||||
type="textarea"
|
||||
v-model="baTable.form.items!.reject_reason"
|
||||
@@ -83,6 +84,9 @@
|
||||
@keyup.enter.stop=""
|
||||
:placeholder="t('Please input field', { field: t('mall.order.reject_reason') })"
|
||||
/>
|
||||
<el-alert v-else type="info" :closable="false" show-icon>
|
||||
确认后将驳回该订单并退回积分(红利/提现订单无需填写驳回原因)。
|
||||
</el-alert>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -97,29 +101,31 @@
|
||||
:input-attr="{ content: { PENDING: t('mall.order.status PENDING'), COMPLETED: t('mall.order.status COMPLETED'), SHIPPED: t('mall.order.status SHIPPED'), REJECTED: t('mall.order.status REJECTED') } }"
|
||||
:placeholder="t('Please select field', { field: t('mall.order.status') })"
|
||||
/>
|
||||
<FormItem
|
||||
:label="t('mall.order.shipping_company')"
|
||||
type="string"
|
||||
v-model="baTable.form.items!.shipping_company"
|
||||
prop="shipping_company"
|
||||
:placeholder="t('Please input field', { field: t('mall.order.shipping_company') })"
|
||||
/>
|
||||
<FormItem
|
||||
:label="t('mall.order.shipping_no')"
|
||||
type="string"
|
||||
v-model="baTable.form.items!.shipping_no"
|
||||
prop="shipping_no"
|
||||
:placeholder="t('Please input field', { field: t('mall.order.shipping_no') })"
|
||||
/>
|
||||
<FormItem
|
||||
:label="t('mall.order.reject_reason')"
|
||||
type="textarea"
|
||||
v-model="baTable.form.items!.reject_reason"
|
||||
prop="reject_reason"
|
||||
:input-attr="{ rows: 3 }"
|
||||
@keyup.enter.stop=""
|
||||
:placeholder="t('Please input field', { field: t('mall.order.reject_reason') })"
|
||||
/>
|
||||
<template v-if="isPhysical">
|
||||
<FormItem
|
||||
:label="t('mall.order.shipping_company')"
|
||||
type="string"
|
||||
v-model="baTable.form.items!.shipping_company"
|
||||
prop="shipping_company"
|
||||
:placeholder="t('Please input field', { field: t('mall.order.shipping_company') })"
|
||||
/>
|
||||
<FormItem
|
||||
:label="t('mall.order.shipping_no')"
|
||||
type="string"
|
||||
v-model="baTable.form.items!.shipping_no"
|
||||
prop="shipping_no"
|
||||
:placeholder="t('Please input field', { field: t('mall.order.shipping_no') })"
|
||||
/>
|
||||
<FormItem
|
||||
:label="t('mall.order.reject_reason')"
|
||||
type="textarea"
|
||||
v-model="baTable.form.items!.reject_reason"
|
||||
prop="reject_reason"
|
||||
:input-attr="{ rows: 3 }"
|
||||
@keyup.enter.stop=""
|
||||
:placeholder="t('Please input field', { field: t('mall.order.reject_reason') })"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -159,7 +165,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, reactive, ref, useTemplateRef, watch } from 'vue'
|
||||
import { computed, inject, ref, useTemplateRef, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
import baTableClass from '/@/utils/baTable'
|
||||
@@ -261,7 +267,10 @@ const submitShip = async () => {
|
||||
const submitReject = async () => {
|
||||
const id = baTable.form.items?.id
|
||||
const rejectReason = (baTable.form.items?.reject_reason || '').toString().trim()
|
||||
if (!id || rejectReason === '') {
|
||||
if (!id) {
|
||||
return
|
||||
}
|
||||
if (isPhysical.value && rejectReason === '') {
|
||||
ElMessage.error('请填写驳回原因')
|
||||
return
|
||||
}
|
||||
@@ -279,10 +288,15 @@ const submitReject = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
||||
shipping_company: [buildValidatorData({ name: 'required', title: t('mall.order.shipping_company') })],
|
||||
shipping_no: [buildValidatorData({ name: 'required', title: t('mall.order.shipping_no') })],
|
||||
reject_reason: [buildValidatorData({ name: 'required', title: t('mall.order.reject_reason') })],
|
||||
const rules = computed<Partial<Record<string, FormItemRule[]>>>(() => {
|
||||
if (!isPhysical.value) {
|
||||
return {}
|
||||
}
|
||||
return {
|
||||
shipping_company: [buildValidatorData({ name: 'required', title: t('mall.order.shipping_company') })],
|
||||
shipping_no: [buildValidatorData({ name: 'required', title: t('mall.order.shipping_no') })],
|
||||
reject_reason: [buildValidatorData({ name: 'required', title: t('mall.order.reject_reason') })],
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ const baTable = new baTableClass(
|
||||
ACCEPTED: t('mall.playxOrder.grant_status ACCEPTED'),
|
||||
FAILED_RETRYABLE: t('mall.playxOrder.grant_status FAILED_RETRYABLE'),
|
||||
FAILED_FINAL: t('mall.playxOrder.grant_status FAILED_FINAL'),
|
||||
'---': t('mall.playxOrder.grant_status ---'),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -116,7 +117,9 @@ const baTable = new baTableClass(
|
||||
type: 'warning',
|
||||
icon: '',
|
||||
display: (row: TableRow) =>
|
||||
(row.type === 'BONUS' || row.type === 'WITHDRAW') && row.grant_status === 'FAILED_RETRYABLE' && row.status === 'PENDING',
|
||||
row.type === 'BONUS' &&
|
||||
row.status === 'PENDING' &&
|
||||
['NOT_SENT', 'SENT_PENDING', 'FAILED_RETRYABLE', 'FAILED_FINAL'].includes(String(row.grant_status)),
|
||||
popconfirm: {
|
||||
title: '确认将该订单加入重试队列?',
|
||||
confirmButtonText: '确认',
|
||||
@@ -126,7 +129,7 @@ const baTable = new baTableClass(
|
||||
click: async (row: TableRow) => {
|
||||
await createAxios(
|
||||
{
|
||||
url: '/admin/mall.PlayxOrder/retry',
|
||||
url: '/admin/mall.Order/retry',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: row.id,
|
||||
|
||||
Reference in New Issue
Block a user