fix
This commit is contained in:
		
							parent
							
								
									41386fca3b
								
							
						
					
					
						commit
						619ca1fde0
					
				| @ -3,10 +3,12 @@ package svc | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"fusenapi/initalize" |  | ||||||
| 	"fusenapi/server/canteen/internal/config" | 	"fusenapi/server/canteen/internal/config" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 
 | 
 | ||||||
|  | 	"fusenapi/initalize" | ||||||
|  | 	"fusenapi/model/gmodel" | ||||||
|  | 
 | ||||||
| 	"github.com/golang-jwt/jwt" | 	"github.com/golang-jwt/jwt" | ||||||
| 	"gorm.io/gorm" | 	"gorm.io/gorm" | ||||||
| ) | ) | ||||||
| @ -15,6 +17,7 @@ type ServiceContext struct { | |||||||
| 	Config config.Config | 	Config config.Config | ||||||
| 
 | 
 | ||||||
| 	MysqlConn *gorm.DB | 	MysqlConn *gorm.DB | ||||||
|  | 	AllModels *gmodel.AllModelsGen | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func NewServiceContext(c config.Config) *ServiceContext { | func NewServiceContext(c config.Config) *ServiceContext { | ||||||
| @ -22,6 +25,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | |||||||
| 	return &ServiceContext{ | 	return &ServiceContext{ | ||||||
| 		Config:    c, | 		Config:    c, | ||||||
| 		MysqlConn: initalize.InitMysql(c.SourceMysql), | 		MysqlConn: initalize.InitMysql(c.SourceMysql), | ||||||
|  | 		AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -37,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err | |||||||
| 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | ||||||
| 		} | 		} | ||||||
| 		// 返回用于验证签名的密钥 | 		// 返回用于验证签名的密钥 | ||||||
| 		return svcCtx.Config.Auth.AccessSecret, nil | 		return []byte(svcCtx.Config.Auth.AccessSecret), nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | ||||||
|  | |||||||
| @ -3,10 +3,12 @@ package svc | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"fusenapi/initalize" |  | ||||||
| 	"fusenapi/server/data-transfer/internal/config" | 	"fusenapi/server/data-transfer/internal/config" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 
 | 
 | ||||||
|  | 	"fusenapi/initalize" | ||||||
|  | 	"fusenapi/model/gmodel" | ||||||
|  | 
 | ||||||
| 	"github.com/golang-jwt/jwt" | 	"github.com/golang-jwt/jwt" | ||||||
| 	"gorm.io/gorm" | 	"gorm.io/gorm" | ||||||
| ) | ) | ||||||
| @ -15,6 +17,7 @@ type ServiceContext struct { | |||||||
| 	Config config.Config | 	Config config.Config | ||||||
| 
 | 
 | ||||||
| 	MysqlConn *gorm.DB | 	MysqlConn *gorm.DB | ||||||
|  | 	AllModels *gmodel.AllModelsGen | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func NewServiceContext(c config.Config) *ServiceContext { | func NewServiceContext(c config.Config) *ServiceContext { | ||||||
| @ -22,6 +25,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | |||||||
| 	return &ServiceContext{ | 	return &ServiceContext{ | ||||||
| 		Config:    c, | 		Config:    c, | ||||||
| 		MysqlConn: initalize.InitMysql(c.SourceMysql), | 		MysqlConn: initalize.InitMysql(c.SourceMysql), | ||||||
|  | 		AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -37,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err | |||||||
| 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | ||||||
| 		} | 		} | ||||||
| 		// 返回用于验证签名的密钥 | 		// 返回用于验证签名的密钥 | ||||||
| 		return svcCtx.Config.Auth.AccessSecret, nil | 		return []byte(svcCtx.Config.Auth.AccessSecret), nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | ||||||
|  | |||||||
| @ -3,10 +3,12 @@ package svc | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"fusenapi/initalize" |  | ||||||
| 	"fusenapi/server/map-library/internal/config" | 	"fusenapi/server/map-library/internal/config" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 
 | 
 | ||||||
|  | 	"fusenapi/initalize" | ||||||
|  | 	"fusenapi/model/gmodel" | ||||||
|  | 
 | ||||||
| 	"github.com/golang-jwt/jwt" | 	"github.com/golang-jwt/jwt" | ||||||
| 	"gorm.io/gorm" | 	"gorm.io/gorm" | ||||||
| ) | ) | ||||||
| @ -15,6 +17,7 @@ type ServiceContext struct { | |||||||
| 	Config config.Config | 	Config config.Config | ||||||
| 
 | 
 | ||||||
| 	MysqlConn *gorm.DB | 	MysqlConn *gorm.DB | ||||||
|  | 	AllModels *gmodel.AllModelsGen | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func NewServiceContext(c config.Config) *ServiceContext { | func NewServiceContext(c config.Config) *ServiceContext { | ||||||
| @ -22,6 +25,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | |||||||
| 	return &ServiceContext{ | 	return &ServiceContext{ | ||||||
| 		Config:    c, | 		Config:    c, | ||||||
| 		MysqlConn: initalize.InitMysql(c.SourceMysql), | 		MysqlConn: initalize.InitMysql(c.SourceMysql), | ||||||
|  | 		AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -37,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err | |||||||
| 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | ||||||
| 		} | 		} | ||||||
| 		// 返回用于验证签名的密钥 | 		// 返回用于验证签名的密钥 | ||||||
| 		return svcCtx.Config.Auth.AccessSecret, nil | 		return []byte(svcCtx.Config.Auth.AccessSecret), nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | ||||||
|  | |||||||
| @ -3,10 +3,12 @@ package svc | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"fusenapi/initalize" |  | ||||||
| 	"fusenapi/server/orders/internal/config" | 	"fusenapi/server/orders/internal/config" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 
 | 
 | ||||||
|  | 	"fusenapi/initalize" | ||||||
|  | 	"fusenapi/model/gmodel" | ||||||
|  | 
 | ||||||
| 	"github.com/golang-jwt/jwt" | 	"github.com/golang-jwt/jwt" | ||||||
| 	"gorm.io/gorm" | 	"gorm.io/gorm" | ||||||
| ) | ) | ||||||
| @ -15,6 +17,7 @@ type ServiceContext struct { | |||||||
| 	Config config.Config | 	Config config.Config | ||||||
| 
 | 
 | ||||||
| 	MysqlConn *gorm.DB | 	MysqlConn *gorm.DB | ||||||
|  | 	AllModels *gmodel.AllModelsGen | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func NewServiceContext(c config.Config) *ServiceContext { | func NewServiceContext(c config.Config) *ServiceContext { | ||||||
| @ -22,6 +25,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | |||||||
| 	return &ServiceContext{ | 	return &ServiceContext{ | ||||||
| 		Config:    c, | 		Config:    c, | ||||||
| 		MysqlConn: initalize.InitMysql(c.SourceMysql), | 		MysqlConn: initalize.InitMysql(c.SourceMysql), | ||||||
|  | 		AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -37,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err | |||||||
| 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | ||||||
| 		} | 		} | ||||||
| 		// 返回用于验证签名的密钥 | 		// 返回用于验证签名的密钥 | ||||||
| 		return svcCtx.Config.Auth.AccessSecret, nil | 		return []byte(svcCtx.Config.Auth.AccessSecret), nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | ||||||
|  | |||||||
| @ -3,10 +3,12 @@ package svc | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"fusenapi/initalize" |  | ||||||
| 	"fusenapi/server/product-templatev2/internal/config" | 	"fusenapi/server/product-templatev2/internal/config" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 
 | 
 | ||||||
|  | 	"fusenapi/initalize" | ||||||
|  | 	"fusenapi/model/gmodel" | ||||||
|  | 
 | ||||||
| 	"github.com/golang-jwt/jwt" | 	"github.com/golang-jwt/jwt" | ||||||
| 	"gorm.io/gorm" | 	"gorm.io/gorm" | ||||||
| ) | ) | ||||||
| @ -15,6 +17,7 @@ type ServiceContext struct { | |||||||
| 	Config config.Config | 	Config config.Config | ||||||
| 
 | 
 | ||||||
| 	MysqlConn *gorm.DB | 	MysqlConn *gorm.DB | ||||||
|  | 	AllModels *gmodel.AllModelsGen | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func NewServiceContext(c config.Config) *ServiceContext { | func NewServiceContext(c config.Config) *ServiceContext { | ||||||
| @ -22,6 +25,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | |||||||
| 	return &ServiceContext{ | 	return &ServiceContext{ | ||||||
| 		Config:    c, | 		Config:    c, | ||||||
| 		MysqlConn: initalize.InitMysql(c.SourceMysql), | 		MysqlConn: initalize.InitMysql(c.SourceMysql), | ||||||
|  | 		AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -37,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err | |||||||
| 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | ||||||
| 		} | 		} | ||||||
| 		// 返回用于验证签名的密钥 | 		// 返回用于验证签名的密钥 | ||||||
| 		return svcCtx.Config.Auth.AccessSecret, nil | 		return []byte(svcCtx.Config.Auth.AccessSecret), nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | ||||||
|  | |||||||
| @ -3,10 +3,12 @@ package svc | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"fusenapi/initalize" |  | ||||||
| 	"fusenapi/server/product/internal/config" | 	"fusenapi/server/product/internal/config" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 
 | 
 | ||||||
|  | 	"fusenapi/initalize" | ||||||
|  | 	"fusenapi/model/gmodel" | ||||||
|  | 
 | ||||||
| 	"github.com/golang-jwt/jwt" | 	"github.com/golang-jwt/jwt" | ||||||
| 	"gorm.io/gorm" | 	"gorm.io/gorm" | ||||||
| ) | ) | ||||||
| @ -15,6 +17,7 @@ type ServiceContext struct { | |||||||
| 	Config config.Config | 	Config config.Config | ||||||
| 
 | 
 | ||||||
| 	MysqlConn *gorm.DB | 	MysqlConn *gorm.DB | ||||||
|  | 	AllModels *gmodel.AllModelsGen | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func NewServiceContext(c config.Config) *ServiceContext { | func NewServiceContext(c config.Config) *ServiceContext { | ||||||
| @ -22,6 +25,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | |||||||
| 	return &ServiceContext{ | 	return &ServiceContext{ | ||||||
| 		Config:    c, | 		Config:    c, | ||||||
| 		MysqlConn: initalize.InitMysql(c.SourceMysql), | 		MysqlConn: initalize.InitMysql(c.SourceMysql), | ||||||
|  | 		AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -37,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err | |||||||
| 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | ||||||
| 		} | 		} | ||||||
| 		// 返回用于验证签名的密钥 | 		// 返回用于验证签名的密钥 | ||||||
| 		return svcCtx.Config.Auth.AccessSecret, nil | 		return []byte(svcCtx.Config.Auth.AccessSecret), nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | ||||||
|  | |||||||
| @ -3,10 +3,12 @@ package svc | |||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"fusenapi/initalize" |  | ||||||
| 	"fusenapi/server/shopping-cart-confirmation/internal/config" | 	"fusenapi/server/shopping-cart-confirmation/internal/config" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 
 | 
 | ||||||
|  | 	"fusenapi/initalize" | ||||||
|  | 	"fusenapi/model/gmodel" | ||||||
|  | 
 | ||||||
| 	"github.com/golang-jwt/jwt" | 	"github.com/golang-jwt/jwt" | ||||||
| 	"gorm.io/gorm" | 	"gorm.io/gorm" | ||||||
| ) | ) | ||||||
| @ -15,6 +17,7 @@ type ServiceContext struct { | |||||||
| 	Config config.Config | 	Config config.Config | ||||||
| 
 | 
 | ||||||
| 	MysqlConn *gorm.DB | 	MysqlConn *gorm.DB | ||||||
|  | 	AllModels *gmodel.AllModelsGen | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func NewServiceContext(c config.Config) *ServiceContext { | func NewServiceContext(c config.Config) *ServiceContext { | ||||||
| @ -22,6 +25,7 @@ func NewServiceContext(c config.Config) *ServiceContext { | |||||||
| 	return &ServiceContext{ | 	return &ServiceContext{ | ||||||
| 		Config:    c, | 		Config:    c, | ||||||
| 		MysqlConn: initalize.InitMysql(c.SourceMysql), | 		MysqlConn: initalize.InitMysql(c.SourceMysql), | ||||||
|  | 		AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)), | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -37,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err | |||||||
| 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | 			return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) | ||||||
| 		} | 		} | ||||||
| 		// 返回用于验证签名的密钥 | 		// 返回用于验证签名的密钥 | ||||||
| 		return svcCtx.Config.Auth.AccessSecret, nil | 		return []byte(svcCtx.Config.Auth.AccessSecret), nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | 		return nil, errors.New(fmt.Sprint("Error parsing token:", err)) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user