mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-27 12:39:01 +08:00
feat: model.Database -> model.AppDatabase
This commit is contained in:
parent
1cd18a9938
commit
b2653c2aef
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,3 +22,4 @@ build
|
||||
# vendor/
|
||||
/pkg/
|
||||
backend/__debug_bin
|
||||
cmd/server/__debug_bin
|
||||
|
@ -48,4 +48,4 @@ cors:
|
||||
|
||||
# 加密设置
|
||||
encrypt:
|
||||
key: 1Panel123@2022!
|
||||
key: 1Panel123@2022!!
|
34
backend/app/service/mysql_test.go
Normal file
34
backend/app/service/mysql_test.go
Normal file
@ -0,0 +1,34 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
_ "gorm.io/driver/mysql"
|
||||
)
|
||||
|
||||
func TestMysql(t *testing.T) {
|
||||
connArgs := fmt.Sprintf("%s:%s@tcp(%s:%d)/?charset=utf8", "root", "Calong@2015", "localhost", 2306)
|
||||
db, err := sql.Open("mysql", connArgs)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
defer db.Close()
|
||||
ctx, cancelfunc := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelfunc()
|
||||
res, err := db.ExecContext(ctx, "CREATE DATABASE IF NOT EXISTS "+"songli")
|
||||
if err != nil {
|
||||
log.Printf("Error %s when creating DB\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
// res, err := db.Exec("SHOW DATABASES;")
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
fmt.Println(res)
|
||||
}
|
@ -24,7 +24,8 @@
|
||||
<SvgIcon :iconName="(subItem.meta?.icon as string)" :className="'svg-icon'"></SvgIcon>
|
||||
</el-icon>
|
||||
<template #title>
|
||||
<span style="margin-left: 10px">{{ $t(subItem.meta?.title as string) }}</span>
|
||||
<span v-if="subItem.meta?.icon">{{ $t(subItem.meta?.title as string) }}</span>
|
||||
<span v-else style="margin-left: 10px">{{ $t(subItem.meta?.title as string) }}</span>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
|
@ -97,10 +97,6 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const logSearch = reactive({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const weekOptions = [
|
||||
{ label: i18n.global.t('cronjob.monday'), value: 1 },
|
||||
{ label: i18n.global.t('cronjob.tuesday'), value: 2 },
|
||||
@ -112,9 +108,11 @@ const weekOptions = [
|
||||
];
|
||||
|
||||
const search = async () => {
|
||||
logSearch.page = paginationConfig.currentPage;
|
||||
logSearch.pageSize = paginationConfig.pageSize;
|
||||
const res = await getCronjobPage(logSearch);
|
||||
let params = {
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
const res = await getCronjobPage(params);
|
||||
data.value = res.data.items || [];
|
||||
for (const item of data.value) {
|
||||
if (item.targetDir !== '-') {
|
||||
|
@ -96,14 +96,14 @@ const loginRules = reactive({
|
||||
|
||||
const loginForm = reactive<Login.ReqLoginForm>({
|
||||
name: 'admin',
|
||||
password: 'Calong@2015',
|
||||
password: '1Panel@2022',
|
||||
captcha: '',
|
||||
captchaID: '',
|
||||
authMethod: '',
|
||||
});
|
||||
const mfaLoginForm = reactive<Login.MFALoginForm>({
|
||||
name: 'admin',
|
||||
password: 'Calong@2015',
|
||||
password: '1Panel@2022',
|
||||
secret: '',
|
||||
code: '',
|
||||
authMethod: '',
|
||||
|
@ -78,15 +78,12 @@ const paginationConfig = reactive({
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const logSearch = reactive({
|
||||
page: 1,
|
||||
pageSize: 5,
|
||||
});
|
||||
|
||||
const search = async () => {
|
||||
logSearch.page = paginationConfig.currentPage;
|
||||
logSearch.pageSize = paginationConfig.pageSize;
|
||||
const res = await getOperationList(logSearch);
|
||||
let params = {
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
const res = await getOperationList(params);
|
||||
data.value = res.data.items;
|
||||
paginationConfig.total = res.data.total;
|
||||
};
|
||||
|
1
go.sum
1
go.sum
@ -1466,6 +1466,7 @@ gorm.io/driver/sqlserver v1.3.2 h1:yYt8f/xdAKLY7lCCyXxIUEgZ/WsURos3dHrx8MKFGAk=
|
||||
gorm.io/gorm v1.23.4/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
|
||||
gorm.io/gorm v1.23.8 h1:h8sGJ+biDgBA1AD1Ha9gFCx7h8npU7AsLdlkX0n2TpE=
|
||||
gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
|
||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
|
||||
|
Loading…
Reference in New Issue
Block a user