34 lines
626 B
Go
34 lines
626 B
Go
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
|
|
}
|