Browse Source

Merge branch 'master' into feature_rzs

pull/52/head
JeshuaRen 6 months ago
parent
commit
044c8577ba
2 changed files with 28 additions and 0 deletions
  1. +22
    -0
      sdks/storage/cdsapi/user.go
  2. +6
    -0
      sdks/storage/models.go

+ 22
- 0
sdks/storage/cdsapi/user.go View File

@@ -48,3 +48,25 @@ func (r *UserDeleteResp) ParseResponse(resp *http.Response) error {
func (c *Client) UserDelete(req *UserDelete) error {
return JSONAPINoData(c.cfg, http.DefaultClient, req)
}

const UserBatchGetStatsPath = "/v1/user/batchGetStats"

type UserBatchGetStats struct {
UserIDs []cdssdk.UserID `json:"userIDs" binding:"required"`
}

func (r *UserBatchGetStats) MakeParam() *sdks.RequestParam {
return sdks.MakeJSONParam(http.MethodPost, UserBatchGetStatsPath, r)
}

type UserBatchGetStatsResp struct {
Stats []*cdssdk.UserStats `json:"stats"`
}

func (r *UserBatchGetStatsResp) ParseResponse(resp *http.Response) error {
return sdks.ParseCodeDataJSONResponse(resp, r)
}

func (c *Client) UserBatchGetStats(req *UserBatchGetStats) (*UserBatchGetStatsResp, error) {
return JSONAPI(c.cfg, http.DefaultClient, req, &UserBatchGetStatsResp{})
}

+ 6
- 0
sdks/storage/models.go View File

@@ -390,3 +390,9 @@ type PackageHash struct {
// 16进制字符串格式的sha256哈希值
Hash string `json:"hash"`
}

type UserStats struct {
UserID UserID `json:"userID" gorm:"column:UserID"`
FileCount int64 `json:"fileCount" gorm:"column:FileCount"`
TotalSize int64 `json:"totalSize" gorm:"column:TotalSize"`
}

Loading…
Cancel
Save