修复跨域问题,修改一些问题
This commit is contained in:
@@ -134,11 +134,12 @@ func EditChallenge(c *gin.Context) {
|
||||
DB := db.DBsnctf
|
||||
id := c.Param("id")
|
||||
cid, _ := strconv.Atoi(id)
|
||||
var request ChallengeRequest
|
||||
var request ChallengeRequeststrings
|
||||
if err := c.ShouldBindJSON(&request); err != nil {
|
||||
c.JSON(400, gin.H{"code": 400, "msg": "Request format wrong!"})
|
||||
return
|
||||
}
|
||||
visable, _ := strconv.Atoi(request.Visible)
|
||||
attachmentString := strings.Join(request.Attachment, ",")
|
||||
hintString := strings.Join(request.Hints, ",")
|
||||
challenge := &CrDb{
|
||||
@@ -150,7 +151,7 @@ func EditChallenge(c *gin.Context) {
|
||||
Category: request.Category,
|
||||
Tags: request.Tags,
|
||||
Hints: hintString,
|
||||
Visible: request.Visible,
|
||||
Visible: visable,
|
||||
}
|
||||
err := DB.Debug().Table("challenge").Where("id = ?", cid).Updates(challenge).Error
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user