This commit is contained in:
@@ -54,7 +54,7 @@ func Serve(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
goose.SetBaseFS(database.MigrationFS)
|
goose.SetBaseFS(database.MigrationFS)
|
||||||
goose.SetTableName("migrations")
|
goose.SetTableName("migrations")
|
||||||
goose.AddNamedMigrationNoTxContext("20251219062732_river_job.go", RiverUp, RiverDown)
|
// goose.AddNamedMigrationNoTxContext("20251219062732_river_job.go", RiverUp, RiverDown)
|
||||||
|
|
||||||
return goose.RunContext(context.Background(), action, svc.DB, "migrations", args...)
|
return goose.RunContext(context.Background(), action, svc.DB, "migrations", args...)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ RechargeWechat = "13932043996"
|
|||||||
Port = 9888
|
Port = 9888
|
||||||
|
|
||||||
[Database]
|
[Database]
|
||||||
Host = "host.local"
|
Host = "postgres"
|
||||||
Database = "quyun"
|
Database = "quyun"
|
||||||
Password = "xixi0202"
|
Password = "xixi0202"
|
||||||
|
|
||||||
@@ -30,9 +30,9 @@ DB = 0
|
|||||||
[Ali]
|
[Ali]
|
||||||
AccessKeyId = "LTAI5t86SjiP9zRd3q2w7jQN"
|
AccessKeyId = "LTAI5t86SjiP9zRd3q2w7jQN"
|
||||||
AccessKeySecret = "hV7spvJuWh8w0EEIXj8NFi2uBlF4aS"
|
AccessKeySecret = "hV7spvJuWh8w0EEIXj8NFi2uBlF4aS"
|
||||||
Bucket ="rogee-bj"
|
Bucket = "rogee-bj"
|
||||||
Host ="https://assets.jdwan.com"
|
Host = "https://assets.jdwan.com"
|
||||||
Region ="cn-beijing"
|
Region = "cn-beijing"
|
||||||
|
|
||||||
[WeChat]
|
[WeChat]
|
||||||
AppID = "wx47649361b6eba174"
|
AppID = "wx47649361b6eba174"
|
||||||
@@ -42,12 +42,12 @@ EncodingAesKey = "OlgPgMvsl92zy5oErtEzRcziRT2txoN3jgEHV6RQZMY"
|
|||||||
DevMode = false
|
DevMode = false
|
||||||
|
|
||||||
[WeChat.Pay]
|
[WeChat.Pay]
|
||||||
NotifyURL="https://mp.jdwan.com/v1/pay/callback/wechat"
|
NotifyURL = "https://mp.jdwan.com/v1/pay/callback/wechat"
|
||||||
MchID = "1702644947"
|
MchID = "1702644947"
|
||||||
SerialNo = "4563EC584A35BC84FB27AA4100C934C9A91D59CA"
|
SerialNo = "4563EC584A35BC84FB27AA4100C934C9A91D59CA"
|
||||||
MechName = "佳芃(北京)企业管理咨询有限公司"
|
MechName = "佳芃(北京)企业管理咨询有限公司"
|
||||||
ApiV3Key="5UBDkxVDY44AKafkqN6YgYxgtkXP6Mw6"
|
ApiV3Key = "5UBDkxVDY44AKafkqN6YgYxgtkXP6Mw6"
|
||||||
PrivateKey="""-----BEGIN PRIVATE KEY-----
|
PrivateKey = """-----BEGIN PRIVATE KEY-----
|
||||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC+GjWdwRorgQXw
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC+GjWdwRorgQXw
|
||||||
Z8ouZeW8UsUgjiSUPKLJHGOZQESa09xmzm+DVZWNCPEHJvz1bDmSNXVsQUWRE/+y
|
Z8ouZeW8UsUgjiSUPKLJHGOZQESa09xmzm+DVZWNCPEHJvz1bDmSNXVsQUWRE/+y
|
||||||
MwSfe+faq0d4BZiw1ueFbRyj4Vw/x7B2vY0i8yo0VyTnWdC6QZRc+V+dbuPJM1Ok
|
MwSfe+faq0d4BZiw1ueFbRyj4Vw/x7B2vY0i8yo0VyTnWdC6QZRc+V+dbuPJM1Ok
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ Port = 8088
|
|||||||
[Database]
|
[Database]
|
||||||
Host = "10.1.1.2"
|
Host = "10.1.1.2"
|
||||||
Port = 5433
|
Port = 5433
|
||||||
Database = "quyun"
|
# Database = "quyun"
|
||||||
|
Database = "q1"
|
||||||
Password = "xixi0202"
|
Password = "xixi0202"
|
||||||
|
|
||||||
[JWT]
|
[JWT]
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ func (m *Config) checkDefault() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if m.TimeZone == "" {
|
if m.TimeZone == "" {
|
||||||
m.TimeZone = "Asia/Shanghai"
|
// m.TimeZone = "Asia/Shanghai"
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Port == 0 {
|
if m.Port == 0 {
|
||||||
@@ -104,9 +104,13 @@ func (m *Config) checkDefault() {
|
|||||||
|
|
||||||
func (m *Config) EmptyDsn() string {
|
func (m *Config) EmptyDsn() string {
|
||||||
// 基本 DSN
|
// 基本 DSN
|
||||||
dsnTpl := "host=%s user=%s password=%s port=%d dbname=%s sslmode=%s TimeZone=%s"
|
// dsnTpl := "host=%s user=%s password=%s port=%d dbname=%s sslmode=%s TimeZone=%s"
|
||||||
|
// m.checkDefault()
|
||||||
|
// base := fmt.Sprintf(dsnTpl, m.Host, m.Username, m.Password, m.Port, m.Database, m.SslMode, m.TimeZone)
|
||||||
|
|
||||||
|
dsnTpl := "host=%s user=%s password=%s port=%d dbname=%s sslmode=%s"
|
||||||
m.checkDefault()
|
m.checkDefault()
|
||||||
base := fmt.Sprintf(dsnTpl, m.Host, m.Username, m.Password, m.Port, m.Database, m.SslMode, m.TimeZone)
|
base := fmt.Sprintf(dsnTpl, m.Host, m.Username, m.Password, m.Port, m.Database, m.SslMode)
|
||||||
// 附加可选参数
|
// 附加可选参数
|
||||||
extras := ""
|
extras := ""
|
||||||
if m.UseSearchPath && m.Schema != "" {
|
if m.UseSearchPath && m.Schema != "" {
|
||||||
@@ -121,9 +125,9 @@ func (m *Config) EmptyDsn() string {
|
|||||||
// DSN connection dsn
|
// DSN connection dsn
|
||||||
func (m *Config) DSN() string {
|
func (m *Config) DSN() string {
|
||||||
// 基本 DSN
|
// 基本 DSN
|
||||||
dsnTpl := "host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=%s"
|
dsnTpl := "host=%s user=%s password=%s dbname=%s port=%d sslmode=%s"
|
||||||
m.checkDefault()
|
m.checkDefault()
|
||||||
base := fmt.Sprintf(dsnTpl, m.Host, m.Username, m.Password, m.Database, m.Port, m.SslMode, m.TimeZone)
|
base := fmt.Sprintf(dsnTpl, m.Host, m.Username, m.Password, m.Database, m.Port, m.SslMode)
|
||||||
// 附加可选参数
|
// 附加可选参数
|
||||||
extras := ""
|
extras := ""
|
||||||
if m.UseSearchPath && m.Schema != "" {
|
if m.UseSearchPath && m.Schema != "" {
|
||||||
|
|||||||
80
build.v2.sh
Executable file
80
build.v2.sh
Executable file
@@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
ADMIN_DIR="$ROOT_DIR/frontend/admin"
|
||||||
|
WECHAT_DIR="$ROOT_DIR/frontend/wechat"
|
||||||
|
BACKEND_DIR="$ROOT_DIR/backend_v1"
|
||||||
|
DOCKER_IMAGE="${DOCKER_IMAGE:-rogeecn/quyun}"
|
||||||
|
NPM_REGISTRY="${NPM_REGISTRY:-https://npm.hub.ipao.vip}"
|
||||||
|
GO_PROXY="${GO_PROXY:-https://go.hub.ipao.vip}" # fallback adds ,direct when exported
|
||||||
|
GO_NO_PROXY="${GO_NO_PROXY:-git.ipao.vip}"
|
||||||
|
IMAGE_ARCHIVE="${IMAGE_ARCHIVE:-$ROOT_DIR/quyun.v2.tgz}"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf '\n==> %s\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf 'Error: %s\n' "$1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_bun() {
|
||||||
|
if command -v bun >/dev/null 2>&1; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
log "Installing bun via npm"
|
||||||
|
npm install -g bun || die "Failed to install bun"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_frontend_build() {
|
||||||
|
local dir="$1"
|
||||||
|
local label="$2"
|
||||||
|
|
||||||
|
[[ -d "$dir" ]] || die "Missing frontend directory $dir"
|
||||||
|
log "Building ${label}"
|
||||||
|
pushd "$dir" >/dev/null
|
||||||
|
bun install
|
||||||
|
bun run build
|
||||||
|
popd >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
build_backend() {
|
||||||
|
[[ -d "$BACKEND_DIR" ]] || die "Missing backend directory"
|
||||||
|
log "Tidying Go modules"
|
||||||
|
pushd "$BACKEND_DIR" >/dev/null
|
||||||
|
export GOPROXY="${GO_PROXY},direct"
|
||||||
|
export GONOPROXY="$GO_NO_PROXY"
|
||||||
|
export GONOSUMDB="$GO_NO_PROXY"
|
||||||
|
go mod tidy
|
||||||
|
log "Building Go binary"
|
||||||
|
mkdir -p build
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/app .
|
||||||
|
popd >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
build_image() {
|
||||||
|
log "Building Docker image ${DOCKER_IMAGE}:v2"
|
||||||
|
sudo docker build -f Dockerfile -t "${DOCKER_IMAGE}:v2" "$ROOT_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
export_image() {
|
||||||
|
log "Exporting image to ${IMAGE_ARCHIVE}"
|
||||||
|
sudo docker save "${DOCKER_IMAGE}:v2" | gzip -c > "$IMAGE_ARCHIVE"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
export NPM_CONFIG_REGISTRY="$NPM_REGISTRY"
|
||||||
|
export npm_config_registry="$NPM_REGISTRY"
|
||||||
|
|
||||||
|
ensure_bun
|
||||||
|
run_frontend_build "$ADMIN_DIR" "frontend/Admin"
|
||||||
|
run_frontend_build "$WECHAT_DIR" "frontend/Wechat"
|
||||||
|
build_backend
|
||||||
|
build_image
|
||||||
|
export_image
|
||||||
|
log "Build finished"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Reference in New Issue
Block a user