get_erp_city_tree_logic.go 856 B

1234567891011121314151617181920212223242526272829303132333435
  1. package base_organ
  2. import (
  3. "context"
  4. "git.i2edu.net/i2/i2-bill-erp/transform"
  5. "git.i2edu.net/i2/i2-bill-api/internal/svc"
  6. "git.i2edu.net/i2/i2-bill-api/internal/types"
  7. "git.i2edu.net/i2/go-zero/core/logx"
  8. )
  9. type GetErpCityTreeLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewGetErpCityTreeLogic(ctx context.Context, svcCtx *svc.ServiceContext) GetErpCityTreeLogic {
  15. return GetErpCityTreeLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *GetErpCityTreeLogic) GetErpCityTree() (*types.Response, error) {
  22. // todo: add your logic here and delete this line
  23. res, err := l.svcCtx.GetErpCity(l.ctx)
  24. if err != nil {
  25. logx.Error(err.Error())
  26. return &types.Response{500, err.Error(), nil}, nil
  27. }
  28. return &types.Response{200, "", transform.TreeNodes{Nodes: res}}, nil
  29. }