From 94f0496da0bf76475328a5610ef8b77f6d69d72d Mon Sep 17 00:00:00 2001 From: guanchao <18612113337@163.com> Date: Fri, 9 Oct 2026 18:25:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=BB=84=E9=87=91=E7=9F=BF=E5=B7=A5?= =?UTF-8?q?=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- laf-cloud/functions/goldMiner/config.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/laf-cloud/functions/goldMiner/config.ts b/laf-cloud/functions/goldMiner/config.ts index d2dc7ec..47eb5d9 100644 --- a/laf-cloud/functions/goldMiner/config.ts +++ b/laf-cloud/functions/goldMiner/config.ts @@ -65,6 +65,10 @@ export function integer(value: any): number { } export function identifier(value: any): boolean { return typeof value === "string" && /^[A-Za-z0-9_:-]{1,100}$/.test(value); } export function isProduct(value: any): boolean { return typeof value === "string" && /^gold_miner(?:_[A-Za-z0-9_-]+)?$/.test(value); } +/** Match the six product IDs registered in WeChat; leave custom products unchanged. */ +export function paymentProductId(value: string): string { + return value.replace(/^gold_miner_vip([0-5])$/, "gold_miner_$1"); +} export function parseObject(value: any): any { if (typeof value === "string") { try { value = JSON.parse(value); } catch { reject("INVALID_INPUT", "请求参数不是合法的 JSON 字符串"); } } if (!value || typeof value !== "object" || Array.isArray(value)) reject("INVALID_INPUT", "请求参数必须是 JSON 对象,不能是 null、数组或普通字符串");