This commit is contained in:
jiangyong27 2023-09-04 21:58:26 +08:00
parent 800eefcebe
commit 98b0466fb9
6 changed files with 32 additions and 15 deletions

View File

@ -8,18 +8,20 @@ import (
"enterprise/worker" "enterprise/worker"
) )
func main1() { func main() {
config.LoadServerConfig() config.LoadServerConfig()
global.InitGlobal() global.InitGlobal()
if err := worker.Init(); err != nil { /*
panic(err) if err := worker.Init(); err != nil {
} panic(err)
}
*/
if err := server.Start(); err != nil { if err := server.Start(); err != nil {
panic(err) panic(err)
} }
} }
func main() { func main3() {
config.LoadServerConfig() config.LoadServerConfig()
global.InitGlobal() global.InitGlobal()
//cfg := config.GetConfig() //cfg := config.GetConfig()

View File

@ -66,11 +66,11 @@ func (d *StaffSalaryDao) GetBy(username, month string) (*model.StaffSalary, erro
return &u, nil 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 var u []*model.StaffSalary
tx := GetDB().Table(d.TableName()) tx := GetDB().Table(d.TableName())
if status != 0 { if month != "" {
tx = tx.Where("status = ?", status) tx = tx.Where("month = ?", month)
} }
res := tx.Find(&u) res := tx.Find(&u)

View File

@ -1,5 +1,10 @@
package model package model
var (
StaffSalaryStatusNormal = 1
StaffSalaryStatusDisable = 2
)
type StaffSalary struct { type StaffSalary struct {
Id int64 Id int64
Username string Username string

View File

@ -4,14 +4,14 @@ address = "0.0.0.0:9283"
log_level = 6 log_level = 6
[mysql] [mysql]
host = "100.100.199.74" host = "192.168.2.50"
port = 3307 port = 3306
user = "root" user = "root"
pass = "ZW5aaGVuMIIBIj" pass = "ZW5aaGVuMIIBIj"
db = "enterprise" db = "enterprise"
[redis] [redis]
addr="127.0.0.1:6379" addr="192.168.2.50:6379"
db=0 db=0
password="" password=""

14
go.mod
View File

@ -17,7 +17,8 @@ require (
github.com/spf13/cast v1.5.1 github.com/spf13/cast v1.5.1
github.com/spf13/viper v1.16.0 github.com/spf13/viper v1.16.0
github.com/wechatpay-apiv3/wechatpay-go v0.2.17 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/driver/mysql v1.5.1
gorm.io/gorm v1.25.2 gorm.io/gorm v1.25.2
) )
@ -51,10 +52,13 @@ require (
github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // 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/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/redis/go-redis/v9 v9.0.3 // 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/robfig/cron/v3 v3.0.1 // indirect
github.com/spf13/afero v1.9.5 // indirect github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect
@ -62,13 +66,15 @@ require (
github.com/subosito/gotenv v1.4.2 // indirect github.com/subosito/gotenv v1.4.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // 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/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect go.uber.org/zap v1.21.0 // indirect
golang.org/x/arch v0.3.0 // indirect golang.org/x/arch v0.3.0 // indirect
golang.org/x/net v0.10.0 // indirect golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.8.0 // indirect golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.9.0 // indirect golang.org/x/text v0.12.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect

View File

@ -8,10 +8,14 @@ import (
func initRoutge(engine *gin.Engine) { func initRoutge(engine *gin.Engine) {
qyweixin := new(controller.QyWeixin) qyweixin := new(controller.QyWeixin)
staff := new(controller.Staff)
base := new(controller.Base) base := new(controller.Base)
apiGroup := engine.Group("/api") apiGroup := engine.Group("/api")
apiGroup.Use(base.Recovery) apiGroup.Use(base.Recovery)
apiGroup.Any("/qyweixin/approve", qyweixin.Approve) apiGroup.Any("/qyweixin/approve", qyweixin.Approve)
apiGroup.GET("/staff/salary", staff.Salary)
engine.LoadHTMLGlob("conf/template/*")
} }
func Start() error { func Start() error {