Compare commits

..

5 Commits

Author SHA1 Message Date
shanshanzhong147 7505d37af6 修复(#52): 补齐首页与用户状态文案
PR Check / Lint, Check, Test and Build (pull_request) Has been cancelled
Dependabot Auto Merge / Dependabot Auto Merge (pull_request_target) Has been cancelled
2026-06-23 07:17:27 -07:00
shanshanzhong147 f9c3b18249 修复(#52): 调整首页与用户管理交互 2026-06-22 09:06:25 -07:00
shanshanzhong147 1834b97fe2 修复(#134): 促销前端展示对齐 (expires_at / billing 补 promo_discount / 类型补字段)
PR Check / Lint, Check, Test and Build (push) Has been cancelled
Squash merge of fix/134-促销前端展示对齐 (4702dee).

HIF-79/HIF-113 落地后前端有三处对齐缺失:

- promo-info.tsx 仍读 promo.end_time,但后端 SubscribeDiscountPromo
  JSON 字段是 expires_at(×2 处)
- billing.tsx 缺 Promo Discount 行,PreOrderResponse 拿到 promo_discount
  时无处可渲染
- typings.d.ts: SubscribeDiscountPromo 缺 expires_at/rule_type,
  PreOrderResponse 缺 promo_discount

本次仅修字段对齐与展示行,不动业务逻辑、不动 OrderDetail 类型 (后端
当前未透出 promo_discount)。新增 billing.promoDiscount 中英文文案。
2026-06-02 20:27:54 -07:00
shanshanzhong147 23f51a1ef4 修复(#122): 合并促销价档位提交到测试环境
PR Check / Lint, Check, Test and Build (push) Has been cancelled
2026-05-29 04:15:40 -07:00
shanshanzhong147 c46944aae1 新功能(#113): 新增促销管理后台页面
PR Check / Lint, Check, Test and Build (push) Has been cancelled
2026-05-29 00:34:37 -07:00
6 changed files with 27 additions and 57 deletions
@@ -54,10 +54,6 @@ function toUserSubscribePayload(values: SubscriptionFormValues) {
};
}
function resolvePlanSpeed(row: API.UserSubscribe) {
return row.plan_speed_limit ?? row.subscribe?.speed_limit ?? 0;
}
export default function UserSubscription({ userId }: { userId: number }) {
const { t } = useTranslation("user");
const [loading, setLoading] = useState(false);
@@ -319,11 +315,10 @@ export default function UserSubscription({ userId }: { userId: number }) {
cell: ({ row }) => {
const userSpeed = row.original.speed_limit ?? 0;
const effectiveSpeed = row.original.effective_speed ?? 0;
const planSpeed = resolvePlanSpeed(row.original);
const planSpeed = row.original.subscribe?.speed_limit ?? 0;
const speed = effectiveSpeed || userSpeed || planSpeed;
const source = row.original.is_throttled
? t("effectiveSpeed", "Effective Speed")
: userSpeed > 0
const source =
userSpeed > 0
? t("userOverride", "User Override")
: t("subscriptionDefault", "Subscription Default");
@@ -340,16 +335,6 @@ export default function UserSubscription({ userId }: { userId: number }) {
<span className="text-muted-foreground text-xs">
{source}
</span>
<span className="text-muted-foreground text-xs">
{t("userOverride", "User Override")}:{" "}
<span className="inline-block">
<Display type="trafficSpeed" value={userSpeed} />
</span>{" "}
/ {t("subscriptionDefault", "Subscription Default")}:{" "}
<span className="inline-block">
<Display type="trafficSpeed" value={planSpeed} />
</span>
</span>
</div>
);
},
@@ -87,12 +87,11 @@ function SpeedLimitCard({ subscriptionId }: { subscriptionId: number }) {
if (detail.status !== 1) return null;
const baseSpeed =
detail.plan_speed_limit ?? detail.subscribe?.speed_limit ?? 0;
const baseSpeed = detail.subscribe?.speed_limit ?? 0;
const userSpeed = detail.speed_limit ?? 0;
const effectiveSpeed = detail.effective_speed ?? 0;
const isThrottled = detail.is_throttled;
const rules = detail.user_traffic_limit || detail.traffic_limit || [];
const rules = detail.traffic_limit || [];
const hasLimitConfig =
baseSpeed > 0 || userSpeed > 0 || effectiveSpeed > 0 || rules.length > 0;
@@ -40,12 +40,6 @@ interface Props {
type SubscriptionTrafficLimitRule = API.UserSubscribeTrafficLimitRule;
function getUserTrafficLimitRules(
data?: Pick<API.UserSubscribe, "traffic_limit" | "user_traffic_limit">
) {
return data?.user_traffic_limit || data?.traffic_limit || [];
}
const defaultLimitRule: SubscriptionTrafficLimitRule = {
stat_type: "day",
stat_value: 1,
@@ -104,7 +98,7 @@ export function SubscriptionForm({
traffic: initialData?.traffic || 0,
speed_limit: initialData?.speed_limit || 0,
device_limit: initialData?.device_limit || 0,
traffic_limit: getUserTrafficLimitRules(initialData),
traffic_limit: initialData?.traffic_limit || [],
upload: initialData?.upload || 0,
download: initialData?.download || 0,
expired_at: initialData?.expire_time || 0,
+2 -2
View File
@@ -44,7 +44,7 @@ const WITHDRAWAL_METHOD_MAP: Record<number, string> = {
0: "其他",
1: "支付宝",
2: "微信",
3: "USDT(TRC20)",
3: "银行卡",
};
const rejectSchema = z.object({
@@ -143,7 +143,7 @@ export default function WithdrawalPage() {
const methodOptions = [
{ value: "1", label: "支付宝" },
{ value: "2", label: "微信" },
{ value: "3", label: "USDT(TRC20)" },
{ value: "3", label: "银行卡" },
{ value: "0", label: "其他" },
];
+19 -23
View File
@@ -63,7 +63,7 @@ import { useGlobalStore } from "@/stores/global";
const WITHDRAWAL_METHODS = [
{ value: 1, label: "支付宝" },
{ value: 2, label: "微信" },
{ value: 3, label: "USDT(TRC20)" },
{ value: 3, label: "银行卡" },
{ value: 0, label: "其他" },
] as const;
@@ -111,21 +111,13 @@ function QrCodeView({ url }: { url: string }) {
<img
alt="收款码"
className="h-16 w-16 cursor-zoom-in object-cover"
height={64}
src={url}
width={64}
/>
</button>
{zoomOpen && (
<Dialog onOpenChange={setZoomOpen} open={zoomOpen}>
<DialogContent className="max-w-sm">
<img
alt="收款码"
className="w-full"
height={320}
src={url}
width={320}
/>
<img alt="收款码" className="w-full" src={url} />
</DialogContent>
</Dialog>
)}
@@ -161,16 +153,18 @@ const withdrawalFormSchema = z
if (!data.account) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "USDT(TRC20) 地址为必填",
message: "银行卡收款账号为必填",
path: ["account"],
});
}
} else if (data.method === 0) {
if (!data.account && !data.content) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "收款账号和备注至少填一项",
path: ["account"],
});
}
} else if (data.method === 0 && !(data.account || data.content)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "收款账号和备注至少填一项",
path: ["account"],
});
}
});
@@ -427,7 +421,9 @@ export default function Affiliate() {
<FormItem>
<FormLabel>
<span className="ml-1 text-destructive">*</span>
<span className="ml-1 text-destructive">
*
</span>
</FormLabel>
{watchedQrCodeUrl ? (
<div className="relative inline-block">
@@ -450,9 +446,7 @@ export default function Affiliate() {
returnType="file"
>
<div className="flex h-24 w-24 flex-col items-center justify-center rounded border-2 border-dashed text-muted-foreground text-xs">
{qrUploading
? "上传中..."
: "点击上传\n收款码"}
{qrUploading ? "上传中..." : "点击上传\n收款码"}
</div>
</UploadImage>
)}
@@ -480,7 +474,7 @@ export default function Affiliate() {
<Input
placeholder={
watchedMethod === 3
? "请输入 USDT(TRC20) 收款地址"
? "请输入银行卡号或账户信息"
: "请输入收款账号(与备注至少填一项)"
}
{...field}
@@ -525,7 +519,9 @@ export default function Affiliate() {
</Button>
<Button
disabled={
submitting || qrUploading || availableCommission <= 0
submitting ||
qrUploading ||
availableCommission <= 0
}
form="withdrawal-form"
type="submit"
-4
View File
@@ -2664,13 +2664,11 @@ declare namespace API {
download: number;
upload: number;
speed_limit?: number;
plan_speed_limit?: number;
device_limit?: number;
effective_speed?: number;
is_throttled?: boolean;
throttle_rule?: string;
traffic_limit?: UserSubscribeTrafficLimitRule[];
user_traffic_limit?: UserSubscribeTrafficLimitRule[];
token: string;
status: number;
short: string;
@@ -2701,10 +2699,8 @@ declare namespace API {
download: number;
upload: number;
speed_limit?: number;
plan_speed_limit?: number;
device_limit?: number;
traffic_limit?: UserSubscribeTrafficLimitRule[];
user_traffic_limit?: UserSubscribeTrafficLimitRule[];
token: string;
status: number;
effective_speed: number;