From a28bd0bd975ce07dc38581135dbfbd00eaad8531 Mon Sep 17 00:00:00 2001 From: Sydonian <794346190@qq.com> Date: Fri, 25 Apr 2025 15:46:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=9F=E8=AE=A1=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdks/storage/cdsapi/user.go | 22 ++++++++++++++++++++++ sdks/storage/models.go | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/sdks/storage/cdsapi/user.go b/sdks/storage/cdsapi/user.go index 2230451..01c8870 100644 --- a/sdks/storage/cdsapi/user.go +++ b/sdks/storage/cdsapi/user.go @@ -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{}) +} diff --git a/sdks/storage/models.go b/sdks/storage/models.go index 9a53072..e1c622f 100644 --- a/sdks/storage/models.go +++ b/sdks/storage/models.go @@ -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"` +}