MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetUserQuotaDates

Function GetUserQuotaDates

controller/usedata.go:29–52  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

27}
28
29func GetUserQuotaDates(c *gin.Context) {
30 userId := c.GetInt("id")
31 startTimestamp, _ := strconv.ParseInt(c.Query("start_timestamp"), 10, 64)
32 endTimestamp, _ := strconv.ParseInt(c.Query("end_timestamp"), 10, 64)
33 // 判断时间跨度是否超过 1 个月
34 if endTimestamp-startTimestamp > 2592000 {
35 c.JSON(http.StatusOK, gin.H{
36 "success": false,
37 "message": "时间跨度不能超过 1 个月",
38 })
39 return
40 }
41 dates, err := model.GetQuotaDataByUserId(userId, startTimestamp, endTimestamp)
42 if err != nil {
43 common.ApiError(c, err)
44 return
45 }
46 c.JSON(http.StatusOK, gin.H{
47 "success": true,
48 "message": "",
49 "data": dates,
50 })
51 return
52}

Callers

nothing calls this directly

Calls 2

GetQuotaDataByUserIdFunction · 0.92
ApiErrorFunction · 0.92

Tested by

no test coverage detected