chore: oauth-second

This commit is contained in:
xiaojunnuo
2025-11-26 23:25:51 +08:00
parent 5a148aa3b9
commit e9427b4694
14 changed files with 306 additions and 47 deletions
@@ -0,0 +1,22 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
@Entity('cd_oauth_bind')
export class OauthBindEntity {
@PrimaryGeneratedColumn()
id: number;
@Column({ name: 'user_id', comment: '用户id' })
userId: number;
@Column({ name: 'type', comment: '第三方类型' })
type: string; // oidc, wechat, github, gitee , qq , alipay
@Column({ name: 'open_id', comment: '第三方openid' })
openId: string;
@Column({ name: 'create_time',comment: '创建时间', default: () => 'CURRENT_TIMESTAMP',})
createTime: Date;
@Column({ name: 'update_time', comment: '修改时间',default: () => 'CURRENT_TIMESTAMP',})
updateTime: Date;
}
@@ -0,0 +1,20 @@
import { SysSettingsService, SysInstallInfo } from "@certd/lib-server";
import { Inject, Provide, Scope, ScopeEnum } from "@midwayjs/core";
import { SiteInfo ,ISiteInfoGetter} from "@certd/plugin-lib";
@Provide("siteInfoGetter")
@Scope(ScopeEnum.Request, { allowDowngrade: true })
export class SiteInfoGetter implements ISiteInfoGetter{
@Inject()
sysSettingsService: SysSettingsService;
async getSiteInfo(): Promise<SiteInfo> {
const installInfo = await this.sysSettingsService.getSetting<SysInstallInfo>(SysInstallInfo);
return {
siteUrl: installInfo?.bindUrl || "",
}
}
}