Documentation
¶
Overview ¶
Package request 寄件码/反向收件(P2):用户创建投递链接,访客凭链接上传, 文件以链接主人名义成为普通分享(复用分享过期/清理/通知机制)。
设计参照 Gokapi File Requests / Pingvin reverse share:
- token 32 hex(crypto/rand),链接 /#/request/<token>
- 约束:单次投递文件数/总大小上限、链接有效期(创建者设定)
- 访客投递不走 upload.open_upload 总闸(显式受邀上传,与 Gokapi 同策略)
Index ¶
- type CreateReq
- type NotifySender
- type PublicView
- type Service
- func (s *Service) Create(ctx context.Context, userID uint, req CreateReq) (*model.FileRequest, error)
- func (s *Service) Delete(ctx context.Context, userID uint, token string) (bool, error)
- func (s *Service) GetPublic(ctx context.Context, token string) (*PublicView, error)
- func (s *Service) ListForUser(ctx context.Context, userID uint) ([]*model.FileRequest, error)
- func (s *Service) Submit(ctx context.Context, token string, entries []storage.StoredFileEntry, ...) (*ShareResult, error)
- type ShareCreateRequest
- type ShareGateway
- type ShareResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateReq ¶
type CreateReq struct {
Title string
MaxFiles int
MaxBytes int64
ExpireValue int
ExpireStyle string // day/week/month/...;空 = 7 天
}
CreateReq 创建投递链接入参
type NotifySender ¶
type NotifySender interface {
CreateForUserSimple(ctx context.Context, userID uint, title, content, notifyType, level string) error
}
NotifySender 投递到件通知(notify service 实现)
type PublicView ¶
type PublicView struct {
Token string `json:"token"`
Title string `json:"title"`
MaxFiles int `json:"max_files"`
MaxBytes int64 `json:"max_bytes"`
ExpiredAt *time.Time `json:"expired_at"`
}
PublicView 访客侧链接信息
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service 寄件码服务
func NewService ¶
func NewService(gormDB *gorm.DB, shareSvc ShareGateway, notify NotifySender) *Service
NewService 构建服务。shareSvc 为分享创建网关(未注入时投递创建分享会失败)。
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, userID uint, req CreateReq) (*model.FileRequest, error)
Create 创建投递链接
func (*Service) ListForUser ¶
ListForUser 用户的投递链接列表
type ShareCreateRequest ¶
type ShareCreateRequest struct {
}
ShareCreateRequest 投递转分享的装配参数(网关实现适配为具体分享域的请求)。
type ShareGateway ¶
type ShareGateway interface {
}
ShareGateway 分享创建网关(消费侧接口;bootstrap 注入 share 域适配器, 本域不直接依赖 share 包——跨域依赖收口为单一装配点)。
Click to show internal directories.
Click to hide internal directories.