From e30b57f18398073914efa2ae57358214593714f0 Mon Sep 17 00:00:00 2001 From: shawko Date: Tue, 12 May 2026 09:56:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E6=A4=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/setting/updateManagement.ts | 6 ++++++ playground/src/utils/str.ts | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/playground/src/api/modules/setting/updateManagement.ts b/playground/src/api/modules/setting/updateManagement.ts index e6b94d9..a11a593 100644 --- a/playground/src/api/modules/setting/updateManagement.ts +++ b/playground/src/api/modules/setting/updateManagement.ts @@ -1,3 +1,4 @@ +import str from '#/utils/str' import { del, get, post } from '../../http' // 参数类型定义 @@ -7,6 +8,7 @@ interface VersionListParams { platform?: string size?: number status?: string + magic?: string } interface VersionData { @@ -24,6 +26,10 @@ interface VersionData { * @return {*} */ export const getVersionList = async (params: VersionListParams) => { + params = { + ...(params || {}), + magic: str.getMagic(), + } return await get('/apkManagement/list', params) } diff --git a/playground/src/utils/str.ts b/playground/src/utils/str.ts index bdf6367..1c6788c 100644 --- a/playground/src/utils/str.ts +++ b/playground/src/utils/str.ts @@ -42,10 +42,25 @@ const capitalize = (str?: null | string): string => { return str ? str.charAt(0).toUpperCase() + str.slice(1) : '' } +/** 与后端 getDefaultPwd 一致:yyyyMMdd 与 ddMMyyyy 两数拼接后相加(本地日期) */ +const getMagic = () => { + const d = new Date() + const day = d.getDate() + const month = d.getMonth() + 1 + const year = d.getFullYear() + const dd = String(day).padStart(2, '0') + const mm = String(month).padStart(2, '0') + const yyyy = String(year).padStart(4, '0') + const n1 = parseInt(`${dd}${mm}${yyyy}`, 10) // ddMMyyyy + const n2 = parseInt(`${yyyy}${mm}${dd}`, 10) // yyyyMMdd + return String(n1 + n2) +} + export default { capitalize, redaction, toList, redactionPhone, redactionRemark, + getMagic, }