|
|
package comment
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
|
|
|
|
|
type SystemEditAticleCommentLoveLogic struct {
|
|
|
logx.Logger
|
|
|
ctx context.Context
|
|
|
svcCtx *svc.ServiceContext
|
|
|
}
|
|
|
|
|
|
func NewSystemEditAticleCommentLoveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemEditAticleCommentLoveLogic {
|
|
|
return &SystemEditAticleCommentLoveLogic{
|
|
|
Logger: logx.WithContext(ctx),
|
|
|
ctx: ctx,
|
|
|
svcCtx: svcCtx,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *types.SystemEditCommentLoveRequest) (resp *types.SystemEditCommentLoveResponse, err error) {
|
|
|
var conn = l.svcCtx.DefaultDBConn()
|
|
|
if req.CountAdminLove < 0 {
|
|
|
return nil, xerr.NewErrMsg("运营点赞数不能小于0")
|
|
|
}
|
|
|
commetInfo, err := l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, req.Id)
|
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("编辑评论信息失败", err)
|
|
|
}
|
|
|
if commetInfo.CompanyId != req.CompanyId {
|
|
|
return nil, xerr.NewErrMsg("没有操作权限")
|
|
|
}
|
|
|
|
|
|
commetInfo.CountAdminLove = req.CountAdminLove
|
|
|
_, err = l.svcCtx.ArticleCommentRepository.Update(l.ctx, conn, commetInfo)
|
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("编辑评论信息失败", err)
|
|
|
}
|
|
|
resp = &types.SystemEditCommentLoveResponse{
|
|
|
Id: commetInfo.Id,
|
|
|
}
|
|
|
return
|
|
|
} |
...
|
...
|
|