getlabelactionlogic.go 976 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 GetLabelActionLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewGetLabelActionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLabelActionLogic {
  16. return &GetLabelActionLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetLabelActionLogic) GetLabelAction(req *types.GetLabelAction) (resp *types.CommonRes, err error) {
  23. res, err0 := l.svcCtx.Bxcollection.GetLabelAction(l.ctx, &bxcol.GetLabelActionReq{
  24. UserId: req.UserId,
  25. })
  26. if err0 != nil {
  27. return &types.CommonRes{
  28. Err_code: -1,
  29. Err_msg: "错误",
  30. Data: nil,
  31. }, nil
  32. }
  33. return &types.CommonRes{
  34. Err_code: common.IntAll(res.ErrCode),
  35. Err_msg: res.ErrMsg,
  36. Data: res.Labels,
  37. }, nil
  38. }