Skip to content

Commit

Permalink
fix: group api param id (#5224)
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 authored Nov 21, 2024
1 parent 9738150 commit f91a3ff
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions service/aiproxy/controller/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,28 @@ func GetGroupDashboard(c *gin.Context) {
}

type UpdateGroupQPMRequest struct {
ID string `json:"id"`
QPM int64 `json:"qpm"`
QPM int64 `json:"qpm"`
}

func UpdateGroupQPM(c *gin.Context) {
id := c.Param("id")
if id == "" {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
req := UpdateGroupQPMRequest{}
err := json.NewDecoder(c.Request.Body).Decode(&req)
if err != nil || req.ID == "" {
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
err = model.UpdateGroupQPM(req.ID, req.QPM)
err = model.UpdateGroupQPM(id, req.QPM)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
Expand All @@ -154,21 +161,28 @@ func UpdateGroupQPM(c *gin.Context) {
}

type UpdateGroupStatusRequest struct {
ID string `json:"id"`
Status int `json:"status"`
Status int `json:"status"`
}

func UpdateGroupStatus(c *gin.Context) {
id := c.Param("id")
if id == "" {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
req := UpdateGroupStatusRequest{}
err := json.NewDecoder(c.Request.Body).Decode(&req)
if err != nil || req.ID == "" {
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "invalid parameter",
})
return
}
err = model.UpdateGroupStatus(req.ID, req.Status)
err = model.UpdateGroupStatus(id, req.Status)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
Expand Down

0 comments on commit f91a3ff

Please sign in to comment.