diff --git a/home-user-auth/etc/home-user-auth.yaml b/home-user-auth/etc/home-user-auth.yaml index 09fb6348..a3fb88c3 100644 --- a/home-user-auth/etc/home-user-auth.yaml +++ b/home-user-auth/etc/home-user-auth.yaml @@ -1,3 +1,4 @@ Name: home-user-auth Host: 0.0.0.0 Port: 8888 +DataSource: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest diff --git a/home-user-auth/internal/config/config.go b/home-user-auth/internal/config/config.go index 8da153d0..0e4c60b5 100644 --- a/home-user-auth/internal/config/config.go +++ b/home-user-auth/internal/config/config.go @@ -4,4 +4,5 @@ import "github.com/zeromicro/go-zero/rest" type Config struct { rest.RestConf + DataSource string } diff --git a/home-user-auth/internal/logic/userfontslogic.go b/home-user-auth/internal/logic/userfontslogic.go index 42fa2e7f..22bb6eb5 100644 --- a/home-user-auth/internal/logic/userfontslogic.go +++ b/home-user-auth/internal/logic/userfontslogic.go @@ -25,6 +25,15 @@ func NewUserFontsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserFon func (l *UserFontsLogic) UserFonts(req *types.Request) (resp *types.Response, err error) { // todo: add your logic here and delete this line - + f, err := l.svcCtx.FsFontModel.FindOne(context.TODO(), 10) + if err != nil { + // panic(err) + logx.Error(err) + return + } + logx.Info(f) + resp = &types.Response{ + Data: f, + } return } diff --git a/home-user-auth/internal/svc/servicecontext.go b/home-user-auth/internal/svc/servicecontext.go index 1959a14d..0fc08171 100644 --- a/home-user-auth/internal/svc/servicecontext.go +++ b/home-user-auth/internal/svc/servicecontext.go @@ -15,6 +15,6 @@ type ServiceContext struct { func NewServiceContext(c config.Config) *ServiceContext { return &ServiceContext{ Config: c, - FsFontModel: model.NewFsFontModel(sqlx.NewMysql("")), + FsFontModel: model.NewFsFontModel(sqlx.NewMysql(c.DataSource)), } }