From e70bde7bd45f447cded0074b87346dace2118c8e Mon Sep 17 00:00:00 2001 From: jiayuqi7813 <63686458+jiayuqi7813@users.noreply.github.com> Date: Thu, 14 Jul 2022 00:23:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/admin/challenge.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/api/admin/challenge.go b/api/admin/challenge.go index 7108198..13d2048 100644 --- a/api/admin/challenge.go +++ b/api/admin/challenge.go @@ -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