worker/server

This commit is contained in:
jiangyong27 2025-03-06 13:42:54 +08:00
parent 614806c52d
commit f2745bf156
4 changed files with 20 additions and 5 deletions

View File

@ -9,7 +9,8 @@ RUN export GOROOT=/usr/local/go1.21.4 && \
export GOPRIVATE=gitlab.batiao8.com && \ export GOPRIVATE=gitlab.batiao8.com && \
export PATH=$PATH:$GOROOT/bin && \ export PATH=$PATH:$GOROOT/bin && \
go mod tidy && \ go mod tidy && \
go build cmd/enterprise.go && \ go build cmd/worker/worker.go && \
go build cmd/server/server.go && \
mv enterprise /app/bin && \ mv enterprise /app/bin && \
cp -r conf /app && \ cp -r conf /app && \
cp start.sh /app && \ cp start.sh /app && \

View File

@ -5,7 +5,6 @@ import (
"enterprise/common/global" "enterprise/common/global"
"enterprise/server" "enterprise/server"
_ "enterprise/service/salary_calculator" _ "enterprise/service/salary_calculator"
"enterprise/worker"
) )
func main() { func main() {
@ -13,8 +12,6 @@ func main() {
config.LoadAliPay() config.LoadAliPay()
global.InitGlobal() global.InitGlobal()
worker.InitCorp()
if err := server.Start(); err != nil { if err := server.Start(); err != nil {
panic(err) panic(err)
} }

17
cmd/worker/worker.go Normal file
View File

@ -0,0 +1,17 @@
package main
import (
"enterprise/common/config"
"enterprise/common/global"
_ "enterprise/service/salary_calculator"
"enterprise/worker"
)
func main() {
config.LoadServerConfig()
config.LoadAliPay()
global.InitGlobal()
worker.InitCorp()
select {}
}

View File

@ -4,7 +4,7 @@ ROOT=$(cd `dirname $0`; pwd)
cd $ROOT cd $ROOT
if [ "$BINARY" = "" ];then if [ "$BINARY" = "" ];then
BINARY="enterprise" BINARY="server"
fi fi
while [ true ];do while [ true ];do