|
|
package tool
|
|
|
package comment
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
...
|
...
|
@@ -11,31 +9,22 @@ import ( |
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
|
|
|
|
|
type MiniHealthLogic struct {
|
|
|
type MiniCommentLogic struct {
|
|
|
logx.Logger
|
|
|
ctx context.Context
|
|
|
svcCtx *svc.ServiceContext
|
|
|
}
|
|
|
|
|
|
func NewMiniHealthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniHealthLogic {
|
|
|
return &MiniHealthLogic{
|
|
|
func NewMiniCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCommentLogic {
|
|
|
return &MiniCommentLogic{
|
|
|
Logger: logx.WithContext(ctx),
|
|
|
ctx: ctx,
|
|
|
svcCtx: svcCtx,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (l *MiniHealthLogic) MiniHealth(req *types.MiniHealthRequest) (resp *types.MiniHealthResposne, err error) {
|
|
|
// 普通查询
|
|
|
var conn = l.svcCtx.DefaultDBConn()
|
|
|
l.svcCtx.CommentRepository.FindOne(l.ctx, conn, 0)
|
|
|
func (l *MiniCommentLogic) MiniComment(req *types.CommentRequest) (resp *types.CommentResposne, err error) {
|
|
|
// todo: add your logic here and delete this line
|
|
|
|
|
|
// 事务查询
|
|
|
if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error {
|
|
|
l.svcCtx.CommentRepository.FindOne(ctx, l.svcCtx.DefaultDBConn(), 0)
|
|
|
return nil
|
|
|
}, true); err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("健康检查失败", err)
|
|
|
}
|
|
|
return
|
|
|
} |
...
|
...
|
|