This commit is contained in:
laodaming
2023-06-12 14:05:35 +08:00
parent 7d21c9ebc8
commit 53a3490837
24 changed files with 564 additions and 27 deletions

View File

@@ -23,6 +23,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Handler: SaveCanteenTypeProductHandler(serverCtx),
},
},
//rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
)
}

View File

@@ -1,19 +1,20 @@
package svc
import (
"fusenapi/initalize"
"fusenapi/server/canteen/internal/config"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"gorm.io/gorm"
)
type ServiceContext struct {
Config config.Config
MysqlConn sqlx.SqlConn
MysqlConn *gorm.DB
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
MysqlConn: sqlx.NewMysql(c.SourceMysql),
MysqlConn: initalize.InitMysql(c.SourceMysql),
}
}

View File

@@ -1,19 +1,20 @@
package svc
import (
config2 "fusenapi/server/data-transfer/internal/config"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"fusenapi/initalize"
"fusenapi/server/data-transfer/internal/config"
"gorm.io/gorm"
)
type ServiceContext struct {
Config config2.Config
Config config.Config
MysqlConn sqlx.SqlConn
MysqlConn *gorm.DB
}
func NewServiceContext(c config2.Config) *ServiceContext {
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
MysqlConn: sqlx.NewMysql(c.SourceMysql),
MysqlConn: initalize.InitMysql(c.SourceMysql),
}
}

View File

@@ -1,18 +1,20 @@
package svc
import (
"fusenapi/initalize"
"fusenapi/server/product/internal/config"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"gorm.io/gorm"
)
type ServiceContext struct {
Config config.Config
MysqlConn sqlx.SqlConn
Config config.Config
MysqlConn *gorm.DB
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
MysqlConn: sqlx.NewMysql(c.DataSource),
MysqlConn: initalize.InitMysql(c.SourceMysql),
}
}