labelactionlogic.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "context"
  5. "jyBXBase/rpc/bxcollection/bxcol"
  6. "jyBXBase/api/internal/svc"
  7. "jyBXBase/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type LabelActionLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewLabelActionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LabelActionLogic {
  16. return &LabelActionLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *LabelActionLogic) LabelAction(req *types.LabelAction) (resp *types.CommonRes, err error) {
  23. res, err0 := l.svcCtx.Bxcollection.LabelAction(l.ctx, &bxcol.LabelActionReq{
  24. UserId: req.UserId,
  25. Laction: req.Laction,
  26. Binfo: req.Binfo,
  27. Lids: req.Lids,
  28. Lname: req.Lname,
  29. })
  30. if err0 != nil {
  31. return &types.CommonRes{
  32. Err_code: -1,
  33. Err_msg: "错误",
  34. Data: nil,
  35. }, nil
  36. }
  37. return &types.CommonRes{
  38. Err_code: common.IntAll(res.ErrCode),
  39. Err_msg: res.ErrMsg,
  40. Data: res.Status,
  41. }, nil
  42. }