feat: 下载次数限制,免费额度用完后第一次需要分享,之后需要看广告

This commit is contained in:
R524809
2026-05-20 16:51:54 +08:00
parent d52339c0fa
commit 51650db04e
9 changed files with 282 additions and 225 deletions
+23 -4
View File
@@ -1,5 +1,9 @@
import { PAPER_SIZE } from '../constants/colors';
import { downloadPrint } from '../utils/downloadPrint';
import { downloadPrint, tryUnlockWithRewardedAd } from '../utils/downloadPrint';
import {
shouldShowShareGuide,
shouldUnlockWithAd,
} from '../utils/shareGuide';
import { BaseDrawService } from '../core/draw/baseDraw';
import tracker from '../utils/tracker';
import { defaultShareConfig } from '../config/config';
@@ -230,12 +234,28 @@ export function getPageCommonMethods(config: PageCommonMethodsConfig = {}) {
typeof this.getWorksheetStatsId === 'function'
? this.getWorksheetStatsId()
: this.data.functionId;
await downloadPrint(this.canvas, {
const downloadOptions = {
errorToast: '请先生成内容',
trackerName: this.data.pageTitle,
trackerMode: this.data.currentMode,
worksheetId,
});
};
// 第 2 次及以后满批:直接拉激励广告
if (shouldUnlockWithAd()) {
const unlocked = await tryUnlockWithRewardedAd();
if (!unlocked) {
return;
}
}
// 当日首次满批:仅分享解锁,弹窗引导
if (shouldShowShareGuide()) {
this.setData({ showShareDialog: true });
return;
}
await downloadPrint(this.canvas, downloadOptions);
},
getShareOptions(this: PageCanvasInstance): ShareOptions {
@@ -288,7 +308,6 @@ export function getPageCommonMethods(config: PageCommonMethodsConfig = {}) {
typeof this.getWorksheetStatsId === 'function'
? this.getWorksheetStatsId()
: this.data.functionId;
// 分享成功后下载(不限制次数)
await downloadPrint(this.canvas, {
errorToast: '请先生成内容',
trackerName: this.data.pageTitle,