From 98b0466fb9a9c1bf92a750a9ec1ff3a300f2ac49 Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Mon, 4 Sep 2023 21:58:26 +0800 Subject: [PATCH] salary --- cmd/enterprise.go | 12 +++++++----- common/dao/staff_salary.go | 6 +++--- common/model/staff_salary.go | 5 +++++ conf/server.conf.dev | 6 +++--- go.mod | 14 ++++++++++---- server/server.go | 4 ++++ 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/cmd/enterprise.go b/cmd/enterprise.go index e1ceaea..eaeeffd 100644 --- a/cmd/enterprise.go +++ b/cmd/enterprise.go @@ -8,18 +8,20 @@ import ( "enterprise/worker" ) -func main1() { +func main() { config.LoadServerConfig() global.InitGlobal() - if err := worker.Init(); err != nil { - panic(err) - } + /* + if err := worker.Init(); err != nil { + panic(err) + } + */ if err := server.Start(); err != nil { panic(err) } } -func main() { +func main3() { config.LoadServerConfig() global.InitGlobal() //cfg := config.GetConfig() diff --git a/common/dao/staff_salary.go b/common/dao/staff_salary.go index 9b36e68..5eac87c 100644 --- a/common/dao/staff_salary.go +++ b/common/dao/staff_salary.go @@ -66,11 +66,11 @@ func (d *StaffSalaryDao) GetBy(username, month string) (*model.StaffSalary, erro return &u, nil } -func (d *StaffSalaryDao) Query(status int) ([]*model.StaffSalary, error) { +func (d *StaffSalaryDao) Query(month string) ([]*model.StaffSalary, error) { var u []*model.StaffSalary tx := GetDB().Table(d.TableName()) - if status != 0 { - tx = tx.Where("status = ?", status) + if month != "" { + tx = tx.Where("month = ?", month) } res := tx.Find(&u) diff --git a/common/model/staff_salary.go b/common/model/staff_salary.go index b0023a1..f606063 100644 --- a/common/model/staff_salary.go +++ b/common/model/staff_salary.go @@ -1,5 +1,10 @@ package model +var ( + StaffSalaryStatusNormal = 1 + StaffSalaryStatusDisable = 2 +) + type StaffSalary struct { Id int64 Username string diff --git a/conf/server.conf.dev b/conf/server.conf.dev index 46f2a42..b6ec906 100644 --- a/conf/server.conf.dev +++ b/conf/server.conf.dev @@ -4,14 +4,14 @@ address = "0.0.0.0:9283" log_level = 6 [mysql] -host = "100.100.199.74" -port = 3307 +host = "192.168.2.50" +port = 3306 user = "root" pass = "ZW5aaGVuMIIBIj" db = "enterprise" [redis] -addr="127.0.0.1:6379" +addr="192.168.2.50:6379" db=0 password="" diff --git a/go.mod b/go.mod index 5e01b0b..d46ac84 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,8 @@ require ( github.com/spf13/cast v1.5.1 github.com/spf13/viper v1.16.0 github.com/wechatpay-apiv3/wechatpay-go v0.2.17 - golang.org/x/crypto v0.9.0 + github.com/xuri/excelize/v2 v2.8.0 + golang.org/x/crypto v0.12.0 gorm.io/driver/mysql v1.5.1 gorm.io/gorm v1.25.2 ) @@ -51,10 +52,13 @@ require ( github.com/mattn/go-isatty v0.0.19 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/redis/go-redis/v9 v9.0.3 // indirect + github.com/richardlehane/mscfb v1.0.4 // indirect + github.com/richardlehane/msoleps v1.0.3 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -62,13 +66,15 @@ require ( github.com/subosito/gotenv v1.4.2 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect + github.com/xuri/efp v0.0.0-20230802181842-ad255f2331ca // indirect + github.com/xuri/nfp v0.0.0-20230819163627-dc951e3ffe1a // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/net v0.14.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/server/server.go b/server/server.go index 02389af..cd852ab 100644 --- a/server/server.go +++ b/server/server.go @@ -8,10 +8,14 @@ import ( func initRoutge(engine *gin.Engine) { qyweixin := new(controller.QyWeixin) + staff := new(controller.Staff) base := new(controller.Base) apiGroup := engine.Group("/api") apiGroup.Use(base.Recovery) apiGroup.Any("/qyweixin/approve", qyweixin.Approve) + apiGroup.GET("/staff/salary", staff.Salary) + + engine.LoadHTMLGlob("conf/template/*") } func Start() error {