From 54365528a8546ed94bdeb371bf057a7f26a1ad4a Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sat, 9 Aug 2025 23:41:59 +0800 Subject: [PATCH] chore: buy page and login --- packages/core/basic/src/utils/util.hash.ts | 16 +++++++++ packages/ui/certd-client/.env | 2 +- .../src/components/vip-button/index.vue | 10 ++++-- .../ui/certd-client/src/utils/util.env.ts | 34 +++++++++++-------- .../src/views/certd/cname/record/crud.tsx | 4 +-- .../src/views/sys/suite/user-suite/crud.tsx | 4 +-- .../ui/certd-server/.env.dev-localplus.yaml | 2 +- .../cname/service/cname-record-service.ts | 2 ++ 8 files changed, 51 insertions(+), 23 deletions(-) diff --git a/packages/core/basic/src/utils/util.hash.ts b/packages/core/basic/src/utils/util.hash.ts index 303ffa1d..450c70aa 100644 --- a/packages/core/basic/src/utils/util.hash.ts +++ b/packages/core/basic/src/utils/util.hash.ts @@ -17,10 +17,26 @@ function base64(data: string) { function base64Decode(data: string) { return Buffer.from(data, "base64").toString("utf8"); } + +function toHex(data: number | string) { + if (typeof data === "number") { + return data.toString(16); + } + return Buffer.from(data).toString("hex"); +} +function hexToStr(data: string) { + return Buffer.from(data, "hex").toString("utf8"); +} +function hexToNumber(data: string) { + return parseInt(data, 16); +} export const hashUtils = { md5, sha256, base64, base64Decode, hmacSha256, + toHex, + hexToStr, + hexToNumber }; diff --git a/packages/ui/certd-client/.env b/packages/ui/certd-client/.env index 3adf5c89..c29b8955 100644 --- a/packages/ui/certd-client/.env +++ b/packages/ui/certd-client/.env @@ -10,4 +10,4 @@ VITE_APP_LOGO=static/images/logo/logo.svg VITE_APP_LOGIN_LOGO=static/images/logo/rect-black.svg VITE_APP_PROJECT_PATH=https://github.com/certd/certd VITE_APP_NAMESPACE=fs -VITE_APP_VIP_PRODUCT_URL=http://localhost:1017/subject#/product/list \ No newline at end of file +VITE_APP_VIP_PRODUCT_URL="http://localhost:1017/subject#/product/list" \ No newline at end of file diff --git a/packages/ui/certd-client/src/components/vip-button/index.vue b/packages/ui/certd-client/src/components/vip-button/index.vue index 6a3823d6..c90accc2 100644 --- a/packages/ui/certd-client/src/components/vip-button/index.vue +++ b/packages/ui/certd-client/src/components/vip-button/index.vue @@ -21,7 +21,7 @@ import { useRouter } from "vue-router"; import { useUserStore } from "/@/store/user"; import { mitter } from "/@/utils/util.mitt"; import { useI18n } from "vue-i18n"; - +import { env } from "/@/utils/util.env"; const { t } = useI18n(); const settingStore = useSettingStore(); @@ -231,6 +231,10 @@ function openUpgrade() { title = t("vip.renew_pro_upgrade_business"); } + // const goBuyUrl = "https://afdian.com/a/greper" + const subjectId = settingStore.installInfo.siteId; + const appKey = settingStore.installInfo.appKey; + const goBuyUrl = `${env.VIP_PRODUCT_URL}?appKey=${appKey}&subjectId=${subjectId}`; const productInfo = settingStore.productInfo; const vipTypeDefine = { free: { @@ -258,7 +262,7 @@ function openUpgrade() { get() { return ( - + {t("vip.get_after_support")} @@ -291,7 +295,7 @@ function openUpgrade() { content: () => { let activationCodeGetWay = ( - + {t("vip.get_pro_code_after_support")} {t("vip.business_contact_author")} diff --git a/packages/ui/certd-client/src/utils/util.env.ts b/packages/ui/certd-client/src/utils/util.env.ts index fc55a7d1..c2232362 100644 --- a/packages/ui/certd-client/src/utils/util.env.ts +++ b/packages/ui/certd-client/src/utils/util.env.ts @@ -6,22 +6,28 @@ export function getEnvValue(key: string) { export class EnvConfig { MODE: string = import.meta.env.MODE; - API: string = import.meta.env.VITE_APP_API; - STORAGE: string = import.meta.env.VITE_APP_STORAGE; - TITLE: string = import.meta.env.VITE_APP_TITLE; - SLOGAN: string = import.meta.env.VITE_APP_SLOGAN; - LOGO: string = import.meta.env.VITE_APP_LOGO; - LOGIN_LOGO: string = import.meta.env.VITE_APP_LOGIN_LOGO; - ICP_NO: string = import.meta.env.VITE_APP_ICP_NO; - COPYRIGHT_YEAR: string = import.meta.env.VITE_APP_COPYRIGHT_YEAR; - COPYRIGHT_NAME: string = import.meta.env.VITE_APP_COPYRIGHT_NAME; - COPYRIGHT_URL: string = import.meta.env.VITE_APP_COPYRIGHT_URL; - PM_ENABLED: string = import.meta.env.VITE_APP_PM_ENABLED; + API: string; + STORAGE: string; + TITLE: string; + SLOGAN: string; + LOGO: string; + LOGIN_LOGO: string; + ICP_NO: string; + COPYRIGHT_YEAR: string; + COPYRIGHT_NAME: string; + COPYRIGHT_URL: string; + PM_ENABLED: string; + VIP_PRODUCT_URL: string; - init(env: any) { + constructor() { + this.init(); + } + init() { + const env = import.meta.env; for (const key in this) { - if (this.hasOwnProperty(key)) { - this[key] = env[key]; + const metaKey = "VITE_APP_" + key; + if (this.hasOwnProperty(key) && env.hasOwnProperty(metaKey)) { + this[key] = env[metaKey]; } } } diff --git a/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx b/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx index ddad615d..5de13480 100644 --- a/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx @@ -252,7 +252,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat }, }, createTime: { - title: t("certd.create_time"), + title: t("certd.createTime"), type: "datetime", form: { show: false, @@ -264,7 +264,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat }, }, updateTime: { - title: t("certd.update_time"), + title: t("certd.updateTime"), type: "datetime", form: { show: false, diff --git a/packages/ui/certd-client/src/views/sys/suite/user-suite/crud.tsx b/packages/ui/certd-client/src/views/sys/suite/user-suite/crud.tsx index efd8011f..e370d4be 100644 --- a/packages/ui/certd-client/src/views/sys/suite/user-suite/crud.tsx +++ b/packages/ui/certd-client/src/views/sys/suite/user-suite/crud.tsx @@ -375,7 +375,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat }, }, createTime: { - title: t("certd.create_time"), + title: t("certd.createTime"), type: "datetime", form: { show: false, @@ -387,7 +387,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat }, }, updateTime: { - title: t("certd.update_time"), + title: t("certd.updateTime"), type: "datetime", form: { show: false, diff --git a/packages/ui/certd-server/.env.dev-localplus.yaml b/packages/ui/certd-server/.env.dev-localplus.yaml index 24dce0e4..07879798 100644 --- a/packages/ui/certd-server/.env.dev-localplus.yaml +++ b/packages/ui/certd-server/.env.dev-localplus.yaml @@ -20,7 +20,7 @@ typeorm: dataSource: default: - database: './data/db-plus-dev-1.sqlite' + database: './data/db-plus-dev.sqlite' # plus server: 'http://127.0.0.1:11007' diff --git a/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts b/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts index b1757ba0..993ed43a 100644 --- a/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts +++ b/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts @@ -128,6 +128,8 @@ export class CnameRecordService extends BaseService { if (!param.id) { throw new ValidateException('id不能为空'); } + //hostRecord包含所有权校验信息,不允许用户修改hostRecord + delete param.hostRecord const old = await this.info(param.id); if (!old) {