's'
This commit is contained in:
21
app/cloudphone/lib/payment.ts
Normal file
21
app/cloudphone/lib/payment.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 支付状态 - 适配 nomadvip paidType(克隆自 nomadlms)
|
||||
*/
|
||||
|
||||
/** nomadvip 使用 paidType=vip 表示已支付 */
|
||||
export function isPaid(): boolean {
|
||||
if (typeof window === "undefined") return false;
|
||||
return localStorage.getItem("paidType") === "vip";
|
||||
}
|
||||
|
||||
/** 前 2 节为试看,无需支付 */
|
||||
export function isFreeTrial(moduleIndex: number, lessonIndex: number): boolean {
|
||||
if (moduleIndex === 0 && lessonIndex < 2) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** 章节是否可观看 */
|
||||
export function canWatchLesson(moduleIndex: number, lessonIndex: number): boolean {
|
||||
if (isFreeTrial(moduleIndex, lessonIndex)) return true;
|
||||
return isPaid();
|
||||
}
|
||||
Reference in New Issue
Block a user