refactor: reorganize modules and add Linux build tooling
This commit is contained in:
31
module/base/cms/internal/logic/post/desc_post_unlike.go
Normal file
31
module/base/cms/internal/logic/post/desc_post_unlike.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package post
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"bsm/full/module/base/cms/internal/models"
|
||||
pb "bsm/full/module/base/cms/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
)
|
||||
|
||||
// DescPostUnlike 处理用户取消点赞帖子的操作
|
||||
func DescPostUnlike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
_, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if in.GetOpIdentity() == "" || in.GetPostIdentity() == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
err = models.IncrOrDescPostField(in.PostIdentity, "unlike_hits", true)
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user