mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-04 11:50:15 +01:00
This commit is contained in:
parent
1cd7febe63
commit
4d6c9ea446
6 changed files with 39 additions and 58 deletions
|
|
@ -11,7 +11,7 @@ import {needSubscribe} from "../util/needSubscribe";
|
|||
import {syncGuide} from "../sync/syncGuide";
|
||||
import {hideElements} from "../protyle/ui/hideElements";
|
||||
import {getCloudURL, getIndexURL} from "./util/about";
|
||||
import {genUUID} from "../util/genID";
|
||||
import {iOSPurchase} from "../util/iOSPurchase";
|
||||
|
||||
const genSVGBG = () => {
|
||||
let html = "";
|
||||
|
|
@ -240,31 +240,7 @@ ${renewHTML}
|
|||
bindEvent: (element: Element) => {
|
||||
element.querySelectorAll('[data-action="iOSPay"]').forEach(item => {
|
||||
item.addEventListener("click", () => {
|
||||
if (window.siyuan.user) {
|
||||
fetchPost("/api/setting/getCloudUser", {
|
||||
token: window.siyuan.user.userToken,
|
||||
}, response => {
|
||||
if (window.siyuan.user.userSiYuanOneTimePayStatus !== response.data.userSiYuanOneTimePayStatus ||
|
||||
window.siyuan.user.userSiYuanProExpireTime !== response.data.userSiYuanProExpireTime ||
|
||||
window.siyuan.user.userSiYuanSubscriptionPlan !== response.data.userSiYuanSubscriptionPlan ||
|
||||
window.siyuan.user.userSiYuanSubscriptionType !== response.data.userSiYuanSubscriptionType ||
|
||||
window.siyuan.user.userSiYuanSubscriptionStatus !== response.data.userSiYuanSubscriptionStatus) {
|
||||
showMessage(window.siyuan.languages["_kernel"][19]);
|
||||
return;
|
||||
}
|
||||
window.siyuan.user = response.data;
|
||||
const productType = item.getAttribute("data-type");
|
||||
let productID;
|
||||
if (window.siyuan.config.cloudRegion === 0) {
|
||||
productID = productType === "function" ? "0" : "1";
|
||||
} else {
|
||||
productID = productType === "function" ? "2" : "3";
|
||||
}
|
||||
window.webkit.messageHandlers.purchase.postMessage(`${productID} ${genUUID().substring(0, 19)}${window.siyuan.config.cloudRegion}00${window.siyuan.user.userId.substring(0, 1)}-${window.siyuan.user.userId.substring(1)}`);
|
||||
});
|
||||
} else {
|
||||
showMessage(window.siyuan.languages.needLogin);
|
||||
}
|
||||
iOSPurchase(item.getAttribute("data-type"));
|
||||
});
|
||||
});
|
||||
const trialSubElement = element.querySelector("#trialSub");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue