chore: 数据库脚本同步

This commit is contained in:
xiaojunnuo
2025-11-29 04:06:51 +08:00
parent 53c88ad5af
commit d03b1e0608
4 changed files with 63 additions and 32 deletions

View File

@@ -10,7 +10,7 @@
<div class="mt-10">
<a-button class="w-full mt-10" type="primary" @click="goBindUser">绑定已有账号</a-button>
<a-button class="w-full mt-10" type="primary" @click="autoRegister">创建新账号</a-button>
<a-button v-if="settingStore.sysPublic.registerEnabled" class="w-full mt-10" type="primary" @click="autoRegister">创建新账号</a-button>
</div>
<div class="w-full mt-10">
@@ -27,9 +27,11 @@ import * as api from "./api";
import { useRoute, useRouter } from "vue-router";
import { useUserStore } from "/@/store/user";
import { notification } from "ant-design-vue";
import { useSettingStore } from "/@/store/settings";
const route = useRoute();
const router = useRouter();
const settingStore = useSettingStore();
const oauthType = route.params.type as string;
const validationCode = route.query.validationCode as string;
const forType = route.query.forType as string;

View File

@@ -54,39 +54,40 @@
<div class="helper">{{ t("certd.saveThenTest") }}</div>
</a-form-item>
</template>
<a-form-item :label="t('certd.sys.setting.enableOauth')" :name="['public', 'oauthEnabled']">
<div class="flex-o">
<a-switch v-model:checked="formState.public.oauthEnabled" :disabled="!settingsStore.isPlus" :title="t('certd.plusFeature')" />
<vip-button class="ml-5" mode="button"></vip-button>
</div>
</a-form-item>
<a-form-item v-if="formState.public.oauthEnabled" :label="t('certd.sys.setting.oauthProviders')" :name="['public', 'oauthProviders']">
<div class="flex flex-wrap">
<table class="w-full table-auto border-collapse border border-gray-400">
<thead>
<tr>
<th class="border border-gray-300 px-4 py-2 w-1/2">{{ t("certd.sys.setting.oauthType") }}</th>
<th class="border border-gray-300 px-4 py-2 w-1/2">{{ t("certd.sys.setting.oauthConfig") }}</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, key) of oauthProviders" :key="key">
<td class="border border-gray-300 px-4 py-2">
<div class="flex items-center" :title="item.desc">
<fs-icon :icon="item.icon" class="mr-2 text-blue-600" />
{{ item.title }}
</div>
</td>
<td class="border border-gray-300 px-4 py-2">
<AddonSelector v-model:model-value="item.addonId" addon-type="oauth" from="sys" :type="item.name" :placeholder="t('certd.sys.setting.oauthProviderSelectorPlaceholder')" />
</td>
</tr>
</tbody>
</table>
</div>
</a-form-item>
</template>
<a-form-item :label="t('certd.sys.setting.enableOauth')" :name="['public', 'oauthEnabled']">
<div class="flex-o">
<a-switch v-model:checked="formState.public.oauthEnabled" :disabled="!settingsStore.isPlus" :title="t('certd.plusFeature')" />
<vip-button class="ml-5" mode="button"></vip-button>
</div>
</a-form-item>
<a-form-item v-if="formState.public.oauthEnabled" :label="t('certd.sys.setting.oauthProviders')" :name="['public', 'oauthProviders']">
<div class="flex flex-wrap">
<table class="w-full table-auto border-collapse border border-gray-400">
<thead>
<tr>
<th class="border border-gray-300 px-4 py-2 w-1/2">{{ t("certd.sys.setting.oauthType") }}</th>
<th class="border border-gray-300 px-4 py-2 w-1/2">{{ t("certd.sys.setting.oauthConfig") }}</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, key) of oauthProviders" :key="key">
<td class="border border-gray-300 px-4 py-2">
<div class="flex items-center" :title="item.desc">
<fs-icon :icon="item.icon" class="mr-2 text-blue-600" />
{{ item.title }}
</div>
</td>
<td class="border border-gray-300 px-4 py-2">
<AddonSelector v-model:model-value="item.addonId" addon-type="oauth" from="sys" :type="item.name" :placeholder="t('certd.sys.setting.oauthProviderSelectorPlaceholder')" />
</td>
</tr>
</tbody>
</table>
</div>
</a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
</a-form-item>

View File

@@ -0,0 +1,14 @@
CREATE TABLE `cd_oauth_bound`
(
`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
`user_id` bigint NOT NULL,
`type` varchar(512) NOT NULL,
`open_id` varchar(512) NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX `index_oauth_bound_user_id` ON `cd_oauth_bound` (`user_id`);
CREATE INDEX `index_oauth_bound_open_id` ON `cd_oauth_bound` (`open_id`);

View File

@@ -0,0 +1,14 @@
CREATE TABLE "cd_oauth_bound"
(
"id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY NOT NULL,
"user_id" bigint NOT NULL,
"type" varchar(512) NOT NULL,
"open_id" varchar(512) NOT NULL,
"create_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
"update_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
CREATE INDEX "index_oauth_bound_user_id" ON "cd_oauth_bound" ("user_id");
CREATE INDEX "index_oauth_bound_open_id" ON "cd_oauth_bound" ("open_id");