get_erp_optionset_logic.go 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package sys_optionset
  2. import (
  3. "context"
  4. "errors"
  5. "git.i2edu.net/i2/i2-bill-erp/transform"
  6. "git.i2edu.net/i2/i2-bill-api/internal/svc"
  7. "git.i2edu.net/i2/i2-bill-api/internal/types"
  8. "git.i2edu.net/i2/go-zero/core/logx"
  9. )
  10. type GetErpOptionsetLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewGetErpOptionsetLogic(ctx context.Context, svcCtx *svc.ServiceContext) GetErpOptionsetLogic {
  16. return GetErpOptionsetLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetErpOptionsetLogic) GetErpOptionset(req string) (*types.Response, error) {
  23. // todo: add your logic here and delete this line
  24. if req == "" {
  25. return nil, errors.New("请输入字典编码")
  26. }
  27. res, err := l.svcCtx.Transformer.GetErpOptionset(l.ctx, &transform.OptionCode{Code: req})
  28. var msg string
  29. var code = 200
  30. var data = res
  31. if err != nil {
  32. code = 500
  33. msg = err.Error()
  34. data = nil
  35. }
  36. return &types.Response{Code: code, Msg: msg, Data: data}, nil
  37. }