updatedomainmetalogic.go 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package logic
  2. import (
  3. "context"
  4. "errors"
  5. "strings"
  6. "app.yhyue.com/moapp/jyfs/rpc/internal/redis"
  7. "app.yhyue.com/moapp/jyfs/rpc/filesystem"
  8. "app.yhyue.com/moapp/jyfs/rpc/internal/svc"
  9. "github.com/tal-tech/go-zero/core/logx"
  10. )
  11. type UpdateDomainMetaLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewUpdateDomainMetaLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateDomainMetaLogic {
  17. return &UpdateDomainMetaLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. // 更新域
  24. func (l *UpdateDomainMetaLogic) UpdateDomainMeta(in *filesystem.DomainReq) (*filesystem.DomainResp, error) {
  25. // todo: add your logic here and delete this line
  26. meta := redis.GetStr("jyfs", "jyfs_"+in.Name)
  27. if meta != "" {
  28. redis.Put("jyfs", "jyfs_"+in.Name, strings.Join(in.MetaFields, ","), -1)
  29. } else {
  30. return &filesystem.DomainResp{State: false}, errors.New("域元信息为空")
  31. }
  32. return &filesystem.DomainResp{State: true}, nil
  33. }