You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

getdictlogic.go 937 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dictionary
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type GetDictLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewGetDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDictLogic {
  16. return &GetDictLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetDictLogic) GetDict(req *types.CId) (resp *types.DictResp, err error) {
  23. resp = &types.DictResp{}
  24. dict := &types.DictInfo{}
  25. db := l.svcCtx.DbEngin.Table("t_dict").Where("id = ?", req.Id).First(&dict)
  26. if db.Error != nil {
  27. logx.Errorf("err %v", db.Error.Error())
  28. return nil, errors.New("Dictionary does not exist")
  29. }
  30. tool.Convert(dict, &resp)
  31. return
  32. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.