فهرست منبع

fix shorturl example code (#35)

Leonard Wang 4 سال پیش
والد
کامیت
1e85f74fd8
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 3 1
      example/shorturl/api/internal/logic/expandlogic.go
  2. 3 1
      example/shorturl/api/internal/logic/shortenlogic.go

+ 3 - 1
example/shorturl/api/internal/logic/expandlogic.go

@@ -10,12 +10,14 @@ import (
 )
 
 type ExpandLogic struct {
-	ctx context.Context
+	svcCtx *svc.ServiceContext
+	ctx    context.Context
 	logx.Logger
 }
 
 func NewExpandLogic(ctx context.Context, svcCtx *svc.ServiceContext) ExpandLogic {
 	return ExpandLogic{
+		svcCtx: svcCtx,
 		ctx:    ctx,
 		Logger: logx.WithContext(ctx),
 	}

+ 3 - 1
example/shorturl/api/internal/logic/shortenlogic.go

@@ -10,12 +10,14 @@ import (
 )
 
 type ShortenLogic struct {
-	ctx context.Context
+	svcCtx *svc.ServiceContext
+	ctx    context.Context
 	logx.Logger
 }
 
 func NewShortenLogic(ctx context.Context, svcCtx *svc.ServiceContext) ShortenLogic {
 	return ShortenLogic{
+		svcCtx: svcCtx,
 		ctx:    ctx,
 		Logger: logx.WithContext(ctx),
 	}