diff --git a/utils/sharePath.js b/utils/sharePath.js index 6db04ae..5461285 100644 --- a/utils/sharePath.js +++ b/utils/sharePath.js @@ -33,6 +33,27 @@ export function buildGroupTargetPath(params) { return targetPath } +export function buildGroupShopTargetPath(shopId) { + if (!shopId) return '' + return '/package2/group/groupBuySingle?type=shop&shopId=' + encodeURIComponent(shopId) +} + +export function resolveMiniCodeSceneTarget(scene) { + let value = String(scene || '').trim() + if (!value) return '' + try { + value = decodeURIComponent(value) + } catch (e) {} + if (!value) return '' + if (value.indexOf('groupShop:') === 0) { + return buildGroupShopTargetPath(value.replace('groupShop:', '')) + } + if (/^s[A-Za-z0-9_-]{1,31}$/.test(value)) { + return buildGroupShopTargetPath(value.slice(1)) + } + return '' +} + export function normalizeShareTargetPath(value) { let targetPath = String(value || '') if (targetPath.indexOf('%2F') === 0 || targetPath.indexOf('%2f') === 0) {