2022-05-13 12:23:24 +08:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
2022-05-13 23:10:55 +08:00
|
|
|
"context"
|
2022-05-13 12:23:24 +08:00
|
|
|
|
2022-05-13 23:10:55 +08:00
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
2022-06-26 22:37:15 +08:00
|
|
|
|
|
|
|
"{{.svcPkg}}"
|
|
|
|
"{{.typesPkg}}"{{if .callRPC}}
|
|
|
|
"{{.rpcClientPkg}}"{{end}}
|
2022-05-13 12:23:24 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type PingLogic struct {
|
2022-05-13 23:10:55 +08:00
|
|
|
logx.Logger
|
|
|
|
ctx context.Context
|
|
|
|
svcCtx *svc.ServiceContext
|
2022-05-13 12:23:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
|
2022-05-13 23:10:55 +08:00
|
|
|
return &PingLogic{
|
|
|
|
Logger: logx.WithContext(ctx),
|
|
|
|
ctx: ctx,
|
|
|
|
svcCtx: svcCtx,
|
|
|
|
}
|
2022-05-13 12:23:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *PingLogic) Ping() (resp *types.Resp, err error) {
|
2022-05-13 23:10:55 +08:00
|
|
|
{{if .callRPC}}if _, err = l.svcCtx.GreetRpc.Ping(l.ctx, new(greet.Placeholder)); err != nil {
|
|
|
|
return
|
|
|
|
}
|
2022-05-13 12:23:24 +08:00
|
|
|
|
2022-05-13 23:10:55 +08:00
|
|
|
{{end}}resp = new(types.Resp)
|
|
|
|
resp.Msg = "pong"
|
|
|
|
|
|
|
|
return
|
2022-05-13 12:23:24 +08:00
|
|
|
}
|