refactor: update match configuration and user matching logic

- Changed the daily free match limit to a lifetime limit, aligning with backend configurations.
- Updated the match price display to include original pricing for better user clarity.
- Refactored match quota handling to sync with the server, ensuring accurate match counts and purchase statuses.
- Enhanced UI messages to reflect changes in match availability and pricing.
- Removed deprecated logic related to daily match counts, streamlining the matching process.
This commit is contained in:
Alex-larget
2026-04-01 17:09:45 +08:00
parent bdd0795434
commit 360bba697b
26 changed files with 374 additions and 781 deletions

View File

@@ -146,6 +146,15 @@ function appendQueryToPath(path, key, value) {
return `${base}${sep}${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`
}
/** 本小程序 wx.navigateTo / switchTab 用的路径:补全前导 / */
function normalizeMiniProgramNavPath(p) {
if (p == null || typeof p !== 'string') return ''
let s = p.trim()
if (!s) return ''
if (!s.startsWith('/')) s = '/' + s.replace(/^\/+/, '')
return s
}
/** 当前用户已绑定手机号(与 app 内登录态一致) */
function getLoggedInUserPhone() {
const u = app.globalData.userInfo || {}
@@ -903,6 +912,27 @@ Page({
return
}
// 本小程序内页(链接标签类型 internal#标签 跳转当前小程序页面)
if (tagType === 'internal') {
const path = normalizeMiniProgramNavPath(pagePath || url)
if (!path) {
wx.showToast({ title: '未配置页面路径', icon: 'none' })
return
}
wx.navigateTo({
url: path,
fail: () => {
wx.switchTab({
url: path,
fail: (err) => {
wx.showToast({ title: err.errMsg || '跳转失败', icon: 'none' })
},
})
},
})
return
}
// 小程序类型:用密钥查 linkedMiniprograms 得 appId再唤醒需在 app.json 的 navigateToMiniProgramAppIdList 中配置)
if (tagType === 'miniprogram') {
if (!mpKey && label) {
@@ -930,10 +960,22 @@ Page({
if (mpKey) wx.showToast({ title: '未找到关联小程序配置', icon: 'none' })
}
// 小程序内部路径(pagePath 或 url 以 /pages/ 开头
const internalPath = pagePath || (url.startsWith('/pages/') ? url : '')
// 兼容:仅填 pagePath或 url 为内页路径(非 internal 类型也可走此分支
const rawInternal =
pagePath || (url.startsWith('/pages/') || url.startsWith('pages/') ? url : '')
const internalPath = normalizeMiniProgramNavPath(rawInternal)
if (internalPath) {
wx.navigateTo({ url: internalPath, fail: () => wx.switchTab({ url: internalPath }) })
wx.navigateTo({
url: internalPath,
fail: () => {
wx.switchTab({
url: internalPath,
fail: (err) => {
wx.showToast({ title: err.errMsg || '跳转失败', icon: 'none' })
},
})
},
})
return
}