service/api/proto/media/proto/proto.go

107 lines
2.2 KiB
Go

package proto
import (
"service/api/base"
"service/dbstruct"
)
const (
MediaTypeImg = 1 // 图片
MediaTypeVideo = 2 // 视频
)
// 获取上传所需材料
type MediaAuthReq struct {
base.BaseRequest
Mtype int32 `json:"mtype"` // 媒体类型,见: MediaType*
}
type MediaAuthData struct {
PolicyToken *PolicyToken `json:"policy_token"`
}
type MediaAuthResp struct {
base.BaseResponse
Data *MediaAuthData `json:"data"`
}
type PolicyToken struct {
AccessKeyId string `json:"access_key_id"`
Host string `json:"host"`
Expire int64 `json:"expire"`
Signature string `json:"signature"`
Directory string `json:"directory"`
Policy string `json:"policy"`
Callback string `json:"callback"`
Filename string `json:"filename"`
}
// 上传媒体
type CUploadReq struct {
base.BaseRequest
Mtype int32 `json:"mtype"`
Item interface{} `json:"item"`
}
type CUploadData struct {
RetItem interface{} `json:"ret_item"`
}
type CUploadResp struct {
base.BaseResponse
Data *CUploadData `json:"data"`
}
// 查询
type ImageListReq struct {
base.BaseRequest
Ids []int64 `json:"ids"`
}
type ImageListData struct {
}
type ImageListResp struct {
base.BaseResponse
Data *ImageListData `json:"data"`
}
type VideoListReq struct {
base.BaseRequest
Ids []int64 `json:"ids"`
}
type VideoListData struct {
}
type VideoListResp struct {
base.BaseResponse
Data *VideoListData `json:"data"`
}
// op
type OpGetVideosByStatusReq struct {
Ids []int64 `json:"ids"`
Status int `json:"status"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type OpGetVideosByStatusData struct {
List []*dbstruct.Video `json:"video"`
}
// 更新压缩后的视频
type OpUpdateVideoCompressReq struct {
Id int64 `json:"id"`
SizeSrc int64 `json:"size_src"` // 原视频大小
SrcId720 string `json:"src_id_720"` // 720P视频
Size720 int64 `json:"size_720"` // 720P视频大小
SrcIdH264 string `json:"src_id_h264"` // 原视频h264 mp4
SizeH264 int64 `json:"size_h264"` // 原视频h264 mp4大小
Status int `json:"status"` // 状态
ResizeT int64 `json:"resize_t"` // 压缩时间
}
type OpUpdateVideoCompressData struct{}