chore: 同步阅读页、脚本、API 配置与小程序管理文档

Made-with: Cursor
This commit is contained in:
卡若
2026-04-15 19:07:02 +08:00
parent 3dd75746e6
commit d44a02b818
15 changed files with 1733 additions and 160 deletions

View File

@@ -309,6 +309,9 @@ Page({
// 好友从代付分享进入:待自动领取的 requestSn
pendingGiftRequestSn: '',
/** H5 / URL Link 带 openPay=1全屏小程序内自动调起本章微信支付非单页 */
pendingAutoSectionPay: false,
// 朋友圈单页模式scene 1154 / systemInfo.mode无法登录与支付仅引导「前往小程序」
readSinglePageMode: false,
momentsPaywallExpanded: false,
@@ -589,6 +592,7 @@ Page({
readSinglePageMode: this._detectReadSinglePage(),
momentsPaywallExpanded: false,
showMomentsLaunchGuideModal: false,
pendingAutoSectionPay: parseDatasetBool(options && options.openPay),
})
if (ref) {
@@ -652,6 +656,8 @@ Page({
this._applyPrevNext(chapterRes)
this.computeShowFullBookCta()
this.refreshPay365MarketingFromRules()
this._tryAutoPayAfterH5Launch()
} catch (e) {
console.error('[Read] 初始化失败:', e)
@@ -662,6 +668,41 @@ Page({
}
},
/** H5 落地 path 含 openPay=1与外链一致进入后尽快调起微信支付须全屏小程序、非免费、未解锁 */
_tryAutoPayAfterH5Launch() {
if (!this.data.pendingAutoSectionPay) return
if (this.data.readSinglePageMode || this._detectReadSinglePage()) {
this.setData({ pendingAutoSectionPay: false })
return
}
const section = this.data.section
if (
section &&
(section.isFree === true || (section.price !== undefined && Number(section.price) === 0))
) {
this.setData({ pendingAutoSectionPay: false })
wx.showToast({ title: '本章免费', icon: 'none' })
return
}
if (this.data.canAccess || accessManager.canAccessFullContent(this.data.accessState)) {
this.setData({ pendingAutoSectionPay: false })
return
}
const st = this.data.accessState
if (st === 'locked_not_purchased') {
this.setData({ pendingAutoSectionPay: false })
setTimeout(() => {
this.handlePurchaseSection()
}, 120)
return
}
if (st === 'locked_not_login') {
this.setData({ showLoginModal: true })
return
}
this.setData({ pendingAutoSectionPay: false })
},
_getGiftUnitPrice() {
const p = this.data.section?.price
const cfg = this.data.sectionPrice
@@ -1397,7 +1438,8 @@ Page({
copyLink() {
const userInfo = app.globalData.userInfo
const referralCode = userInfo?.referralCode || ''
const shareUrl = `https://soul.quwanzhi.com/read/${this.data.sectionId}${referralCode ? '?ref=' + referralCode : ''}`
const base = String((app.globalData && app.globalData.baseUrl) || 'https://soulapi.quwanzhi.com').replace(/\/$/, '')
const shareUrl = `${base}/read/${this.data.sectionId}${referralCode ? '?ref=' + referralCode : ''}`
wx.setClipboardData({
data: shareUrl,
@@ -1595,6 +1637,18 @@ Page({
}
wx.hideLoading()
if (this.data.pendingAutoSectionPay) {
if (canAccess) {
this.setData({ pendingAutoSectionPay: false })
} else if (accessManager.isFreeFromChapterData(chapterRes)) {
this.setData({ pendingAutoSectionPay: false })
wx.showToast({ title: '本章免费', icon: 'none' })
} else if (newAccessState === 'locked_not_purchased') {
this.setData({ pendingAutoSectionPay: false })
setTimeout(() => this.handlePurchaseSection(), 120)
}
}
} catch (e) {
wx.hideLoading()