Skip to content

Commit

Permalink
fix: 修正脚本异常
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Dec 26, 2023
1 parent 5b9e056 commit 95919f5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions api/script/controller.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package script

import (
"strings"

"github.com/gin-gonic/gin"

"tdp-cloud/model/script"
Expand Down Expand Up @@ -67,6 +69,7 @@ func (*Controller) create(c *gin.Context) {
}

rq.UserId = c.GetUint("UserId")
rq.Content = strings.TrimSpace(rq.Content)

if id, err := script.Create(rq); err == nil {
c.Set("Payload", gin.H{"Id": id})
Expand Down Expand Up @@ -94,6 +97,7 @@ func (*Controller) update(c *gin.Context) {
}

rq.UserId = c.GetUint("UserId")
rq.Content = strings.TrimSpace(rq.Content)

if err := script.Update(rq); err == nil {
c.Set("Message", "更新成功")
Expand Down
4 changes: 2 additions & 2 deletions api/tencent/controller.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tencent

import (
"io/ioutil"
"io"
"net/http"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -66,7 +66,7 @@ func (*Controller) vncProxy(c *gin.Context) {
return
}

if res, err := ioutil.ReadAll(resp.Body); err == nil {
if res, err := io.ReadAll(resp.Body); err == nil {
c.Set("HTML", string(res))
} else {
c.Set("Error", err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/knadh/koanf/providers/file v0.1.0
github.com/knadh/koanf/v2 v2.0.1
// 辅助类库
github.com/opentdp/go-helper v0.5.3
github.com/opentdp/go-helper v0.5.4
// 计划任务
github.com/robfig/cron/v3 v3.0.1
// Go 官方模块
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/opentdp/go-helper v0.5.3 h1:J4mLgNY/g5yBk1vv1yQ0FgT/OZioDflKQ/Kdh1NymiQ=
github.com/opentdp/go-helper v0.5.3/go.mod h1:9m+t/2x1CmjZ9YQP37+xECCO84eqMnsxnRE/7y37GjE=
github.com/opentdp/go-helper v0.5.4 h1:OA+CcXpqMokVdjPsZwNAhQfG6SjLqNdds72A3DXy9qc=
github.com/opentdp/go-helper v0.5.4/go.mod h1:9m+t/2x1CmjZ9YQP37+xECCO84eqMnsxnRE/7y37GjE=
github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI=
github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down

0 comments on commit 95919f5

Please sign in to comment.