tianyuan-api-server/apps/gateway/internal/logic/base/healthlogic.go

34 lines
626 B
Go
Raw Normal View History

2024-10-02 00:57:17 +08:00
package base
import (
"context"
"time"
"tianyuan-api/apps/gateway/internal/svc"
"tianyuan-api/apps/gateway/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type HealthLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewHealthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HealthLogic {
return &HealthLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *HealthLogic) Health() (resp *types.HealthResp, err error) {
nowTime := time.Now()
resp = &types.HealthResp{
Time: nowTime.Format("2006-01-02 15:04:05"),
}
return
}