addlabellogic.go 944 B

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