修复put

This commit is contained in:
jiayuqi7813
2022-07-14 00:23:48 +08:00
parent f383eab282
commit e70bde7bd4

View File

@@ -139,19 +139,20 @@ func EditChallenge(c *gin.Context) {
c.JSON(400, gin.H{"code": 400, "msg": "Request format wrong!"})
return
}
challenge := &Challenge{
ID: cid,
attachmentString := strings.Join(request.Attachment, ",")
hintString := strings.Join(request.Hints, ",")
challenge := &CrDb{
Name: request.Name,
Score: request.Score,
Flag: request.Flag,
Description: request.Description,
Attachment: request.Attachment,
Attachment: attachmentString,
Category: request.Category,
Tags: request.Tags,
Hints: request.Hints,
Hints: hintString,
Visible: request.Visible,
}
err := DB.Table("challenge").Where("id = ?", cid).Updates(challenge).Error
err := DB.Debug().Table("challenge").Where("id = ?", cid).Updates(challenge).Error
if err != nil {
c.JSON(400, gin.H{"code": 400, "msg": "Update challenge failure!"})
return