From 19d325fb77f57be417acee20f798ba304ba95aa8 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Mon, 19 Jun 2023 10:33:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E9=85=8D=E7=BD=AE=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goctl_template/api/etc.tpl | 2 +- server/home-user-auth/test/basic.go | 2 ++ server/product/etc/product.yaml | 2 +- server/product/internal/svc/servicecontext.go | 5 +++-- .../etc/shopping-cart-confirmation.yaml | 2 +- server/shopping-cart-confirmation/internal/config/config.go | 5 +++-- .../internal/svc/servicecontext.go | 5 +++-- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/goctl_template/api/etc.tpl b/goctl_template/api/etc.tpl index d2c383f3..c9ae2595 100644 --- a/goctl_template/api/etc.tpl +++ b/goctl_template/api/etc.tpl @@ -1,7 +1,7 @@ Name: {{.serviceName}} Host: {{.host}} Port: {{.port}} -SourceMysql: "" +DataSource: "" Auth: AccessSecret: fusen2023 AccessExpire: 604800 diff --git a/server/home-user-auth/test/basic.go b/server/home-user-auth/test/basic.go index 66adb71e..e23cb88b 100644 --- a/server/home-user-auth/test/basic.go +++ b/server/home-user-auth/test/basic.go @@ -5,6 +5,7 @@ import ( "fusenapi/server/home-user-auth/internal/config" "fusenapi/server/home-user-auth/internal/handler" "fusenapi/server/home-user-auth/internal/svc" + "log" "testing" "github.com/474420502/requests" @@ -17,6 +18,7 @@ var cnf config.Config var gserver *rest.Server func init() { + log.SetFlags(log.Llongfile) gserver = GetTestServer() } diff --git a/server/product/etc/product.yaml b/server/product/etc/product.yaml index 001d772b..8cf26b5d 100644 --- a/server/product/etc/product.yaml +++ b/server/product/etc/product.yaml @@ -1,7 +1,7 @@ Name: product Host: 0.0.0.0 Port: 8889 -DataSource: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest +SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 AccessExpire: 60 diff --git a/server/product/internal/svc/servicecontext.go b/server/product/internal/svc/servicecontext.go index 0a60e492..6705de1e 100644 --- a/server/product/internal/svc/servicecontext.go +++ b/server/product/internal/svc/servicecontext.go @@ -5,9 +5,10 @@ import ( "fmt" "fusenapi/initalize" "fusenapi/server/product/internal/config" + "net/http" + "github.com/golang-jwt/jwt" "gorm.io/gorm" - "net/http" ) type ServiceContext struct { @@ -20,7 +21,7 @@ func NewServiceContext(c config.Config) *ServiceContext { return &ServiceContext{ Config: c, - MysqlConn: initalize.InitMysql(c.DataSource), + MysqlConn: initalize.InitMysql(c.SourceMysql), } } diff --git a/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml b/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml index fe09df24..0203843c 100644 --- a/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml +++ b/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml @@ -1,7 +1,7 @@ Name: shopping-cart-confirmation Host: 0.0.0.0 Port: 8892 -DataSource: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest +SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 AccessExpire: 604800 diff --git a/server/shopping-cart-confirmation/internal/config/config.go b/server/shopping-cart-confirmation/internal/config/config.go index 29bf4b4f..6ddec5d8 100644 --- a/server/shopping-cart-confirmation/internal/config/config.go +++ b/server/shopping-cart-confirmation/internal/config/config.go @@ -2,11 +2,12 @@ package config import ( "fusenapi/server/shopping-cart-confirmation/internal/types" + "github.com/zeromicro/go-zero/rest" ) type Config struct { rest.RestConf - DataSource string - Auth types.Auth + SourceMysql string + Auth types.Auth } diff --git a/server/shopping-cart-confirmation/internal/svc/servicecontext.go b/server/shopping-cart-confirmation/internal/svc/servicecontext.go index 64e36894..4ea1a88a 100644 --- a/server/shopping-cart-confirmation/internal/svc/servicecontext.go +++ b/server/shopping-cart-confirmation/internal/svc/servicecontext.go @@ -5,9 +5,10 @@ import ( "fmt" "fusenapi/initalize" "fusenapi/server/shopping-cart-confirmation/internal/config" + "net/http" + "github.com/golang-jwt/jwt" "gorm.io/gorm" - "net/http" ) type ServiceContext struct { @@ -20,7 +21,7 @@ func NewServiceContext(c config.Config) *ServiceContext { return &ServiceContext{ Config: c, - MysqlConn: initalize.InitMysql(c.DataSource), + MysqlConn: initalize.InitMysql(c.SourceMysql), } }