addlabellogic.go 970 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package logic
  2. import (
  3. "context"
  4. "jyMicroservices/jyBXAdditional/rpc/bxcollection/bxcol"
  5. "jyMicroservices/jyBXAdditional/api/internal/svc"
  6. "jyMicroservices/jyBXAdditional/api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type AddLabelLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewAddLabelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddLabelLogic {
  15. return &AddLabelLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *AddLabelLogic) AddLabel(req *types.AddLabel) (resp *types.CommonRes, err error) {
  22. res, err0 := l.svcCtx.Bxcollection.Addlabel(l.ctx, &bxcol.AddlabelReq{
  23. UserId: req.UserId,
  24. Name: req.Name,
  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.Labid,
  37. }, nil
  38. }