命令添加form获取,修改解析请求参数
This commit is contained in:
parent
793d306238
commit
1bed10c5e5
|
|
@ -45,7 +45,7 @@ func (s *ShellHandler) CreateShell(c *gin.Context) {
|
|||
user_id, _ := c.Get("id")
|
||||
uid := int(user_id.(float64))
|
||||
var req CreateShellReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
c.JSON(200, gin.H{"code": proto.ShellCreateFailed, "message": "参数错误", "data": err.Error()})
|
||||
} else {
|
||||
id := service.CreateShell(req.ShellName, req.ShellContent, req.Server, uid)
|
||||
|
|
@ -68,7 +68,7 @@ func (s *ShellHandler) UpdateShell(c *gin.Context) {
|
|||
var req UpdateShellReqV2
|
||||
userId, _ := c.Get("id")
|
||||
id := int(userId.(float64))
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
c.JSON(200, gin.H{"code": proto.ShellUpdateFailed, "message": "参数错误", "data": err.Error()})
|
||||
} else {
|
||||
var resp []UpdateShellResp
|
||||
|
|
@ -91,7 +91,7 @@ func (s *ShellHandler) ServerWillRun(c *gin.Context) {
|
|||
userId, _ := c.Get("id")
|
||||
id := int(userId.(float64))
|
||||
var req ServerWillRunReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
c.JSON(200, gin.H{"code": proto.ShellUpdateFailed, "message": "参数错误", "data": err.Error()})
|
||||
} else {
|
||||
willRunShells, err2 := service.FindShellWillRunByServer(req.Server, id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue