12345678910111213141516171819202122232425262728293031323334353637 |
- package logic
- import (
- "context"
- "strings"
- "app.yhyue.com/moapp/jyfs/rpc/filesystem"
- "app.yhyue.com/moapp/jyfs/rpc/internal/redis"
- "app.yhyue.com/moapp/jyfs/rpc/internal/svc"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type CreateDomainLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewCreateDomainLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateDomainLogic {
- return &CreateDomainLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- // 创建域
- func (l *CreateDomainLogic) CreateDomain(in *filesystem.DomainReq) (*filesystem.DomainResp, error) {
- err := l.svcCtx.OssClient.CreateBucket(in.Name)
- // todo: 本地存储bucket和meta的对应关系
- if err != nil {
- return &filesystem.DomainResp{State: false}, err
- } else {
- redis.Put("jyfs", "jyfs_"+in.Name, strings.Join(in.MetaFields, ","), -1)
- return &filesystem.DomainResp{State: true}, nil
- }
- }
|