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 75720d26..90a9d432 100644 --- a/packages/ui/certd-client/src/components/vip-button/index.vue +++ b/packages/ui/certd-client/src/components/vip-button/index.vue @@ -231,6 +231,7 @@ function openUpgrade() { title: "基础版", desc: "社区免费版", type: "free", + icon: "lucide:package-open", privilege: ["证书申请无限制", "域名数量无限制", "证书流水线数量无限制", "常用的主机、云平台、cdn等部署插件", "邮件、webhook通知方式"] }, plus: { @@ -244,6 +245,7 @@ function openUpgrade() { openStarModal(); } }, + icon: "stash:thumb-up", price: 29.9, get() { return ( @@ -259,6 +261,7 @@ function openUpgrade() { title: "商业版", desc: "商业授权,可对外运营", type: "comm", + icon: "vaadin:handshake", privilege: ["拥有专业版所有特权", "允许商用,可修改logo、标题", "数据统计", "插件管理", "多用户无限制", "支持用户支付"], price: 399, get() { @@ -293,8 +296,8 @@ function openUpgrade() { slots.push(
-

- {item.title} +

+ {item.title} {item.trial && ( @@ -303,8 +306,11 @@ function openUpgrade() { )}

-
{item.desc}
-
diff --git a/packages/ui/certd-client/src/views/sys/suite/user-suite/api.ts b/packages/ui/certd-client/src/views/sys/suite/user-suite/api.ts index ee4c77ce..682a3f0e 100644 --- a/packages/ui/certd-client/src/views/sys/suite/user-suite/api.ts +++ b/packages/ui/certd-client/src/views/sys/suite/user-suite/api.ts @@ -1,7 +1,7 @@ import { request } from "/src/api/service"; export function createApi() { - const apiPrefix = "/sys/suite/userSuites"; + const apiPrefix = "/sys/suite/user-suite"; return { async GetList(query: any) { return await request({ @@ -47,6 +47,14 @@ export function createApi() { url: apiPrefix + "/all", method: "post" }); + }, + + async GetSimpleUserByIds(ids: number[]) { + return await request({ + url: "/sys/authority/user/getSimpleUserByIds", + method: "post", + data: { ids } + }); } }; } 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 1d4e1951..5041bf7c 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 @@ -55,26 +55,26 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat }, actionbar: { buttons: { - add: { show: false }, - buy: { - text: "购买", - type: "primary", - click() { - router.push({ - path: "/certd/suite/buy" - }); - } - } + add: { show: false } + // buy: { + // text: "购买", + // type: "primary", + // click() { + // router.push({ + // path: "/certd/suite/buy" + // }); + // } + // } } }, rowHandle: { width: 200, fixed: "right", buttons: { - view: { show: false }, + view: { show: true }, copy: { show: false }, edit: { show: false }, - remove: { show: false } + remove: { show: true } // continue:{ // text:"续期", // type:"link", @@ -115,6 +115,17 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat width: 200 } }, + userId: { + title: "用户", + type: "table-select", + dict: dict({ + async getNodesByValues(ids: number[]) { + return await api.GetSimpleUserByIds(ids); + }, + value: "id", + label: "nickName" + }) + }, productType: { title: "类型", type: "dict-select", diff --git a/packages/ui/certd-server/src/controller/monitor/site-info-controller.ts b/packages/ui/certd-server/src/controller/monitor/site-info-controller.ts index 03efbc58..53f5a861 100644 --- a/packages/ui/certd-server/src/controller/monitor/site-info-controller.ts +++ b/packages/ui/certd-server/src/controller/monitor/site-info-controller.ts @@ -39,14 +39,18 @@ export class SiteInfoController extends CrudController { @Post('/add', { summary: Constants.per.authOnly }) async add(@Body(ALL) bean: any) { bean.userId = this.getUserId(); - return await super.add(bean); + const res = await this.service.add(bean); + await this.service.check(res.id); + return this.ok(res); } @Post('/update', { summary: Constants.per.authOnly }) async update(@Body(ALL) bean) { await this.service.checkUserId(bean.id, this.getUserId()); delete bean.userId; - return await super.update(bean); + await this.service.update(bean); + await this.service.check(bean.id); + return this.ok(); } @Post('/info', { summary: Constants.per.authOnly }) async info(@Query('id') id: number) { diff --git a/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts b/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts index 048922d5..e31e915c 100644 --- a/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts +++ b/packages/ui/certd-server/src/controller/sys/authority/user-controller.ts @@ -4,6 +4,7 @@ import { CrudController } from '@certd/lib-server'; import { RoleService } from '../../../modules/sys/authority/service/role-service.js'; import { PermissionService } from '../../../modules/sys/authority/service/permission-service.js'; import { Constants } from '@certd/lib-server'; +import { In } from 'typeorm'; /** * 系统用户 @@ -23,6 +24,24 @@ export class UserController extends CrudController { return this.service; } + @Post('/getSimpleUserByIds', { summary: 'sys:auth:user:add' }) + async getSimpleUserByIds(@Body('ids') ids: number[]) { + const users = await this.service.find({ + select: { + id: true, + username: true, + nickName: true, + mobile: true, + phoneCode: true, + }, + where: { + id: In(ids), + }, + }); + + return this.ok(users); + } + @Post('/page', { summary: 'sys:auth:user:view' }) async page( @Body(ALL) diff --git a/packages/ui/certd-server/src/modules/monitor/service/site-info-service.ts b/packages/ui/certd-server/src/modules/monitor/service/site-info-service.ts index 4308eaa0..7ac256a3 100644 --- a/packages/ui/certd-server/src/modules/monitor/service/site-info-service.ts +++ b/packages/ui/certd-server/src/modules/monitor/service/site-info-service.ts @@ -51,7 +51,16 @@ export class SiteInfoService extends BaseService { } } - return await this.repository.save(data); + data.disabled = false; + return await super.add(data); + } + + async update(data: any) { + if (!data.id) { + throw new Error('id is required'); + } + delete data.userId; + await super.update(data); } async getUserMonitorCount(userId: number) {