75 lines
1.3 KiB
Go
75 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"log/slog"
|
|
"platform/pkg/env"
|
|
"platform/pkg/logs"
|
|
"platform/pkg/orm"
|
|
"platform/web/models"
|
|
q "platform/web/queries"
|
|
|
|
"golang.org/x/crypto/bcrypt"
|
|
)
|
|
|
|
func main() {
|
|
env.Init()
|
|
logs.Init()
|
|
orm.Init()
|
|
|
|
q.User.
|
|
Select(
|
|
q.User.Phone).
|
|
Create(&models.User{
|
|
Phone: "12312341234"})
|
|
|
|
q.Proxy.
|
|
Select(
|
|
q.Proxy.Version,
|
|
q.Proxy.Name,
|
|
q.Proxy.Host,
|
|
q.Proxy.Type).
|
|
Create(&models.Proxy{
|
|
Version: 1,
|
|
Name: "7a17e8b4-cdc3-4500-bf16-4a665991a7f6",
|
|
Host: "110.40.82.248",
|
|
Type: 1})
|
|
|
|
q.Node.
|
|
Select(
|
|
q.Node.Version,
|
|
q.Node.Name,
|
|
q.Node.Host,
|
|
q.Node.Isp,
|
|
q.Node.Prov,
|
|
q.Node.City,
|
|
q.Node.Status).
|
|
Create(&models.Node{
|
|
Version: 1,
|
|
Name: "test-node",
|
|
Host: "123",
|
|
Isp: "test-isp",
|
|
Prov: "test-prov",
|
|
City: "test-city",
|
|
Status: 1})
|
|
|
|
var secret, _ = bcrypt.GenerateFromPassword([]byte("test"), bcrypt.DefaultCost)
|
|
q.Client.
|
|
Select(
|
|
q.Client.ClientID,
|
|
q.Client.ClientSecret,
|
|
q.Client.GrantClient,
|
|
q.Client.GrantRefresh,
|
|
q.Client.Spec,
|
|
q.Client.Name).
|
|
Create(&models.Client{
|
|
ClientID: "test",
|
|
ClientSecret: string(secret),
|
|
GrantClient: true,
|
|
GrantRefresh: true,
|
|
Spec: 0,
|
|
Name: "默认客户端",
|
|
})
|
|
|
|
slog.Info("✔ Data inserted successfully")
|
|
}
|