diff --git a/main.go b/main.go index 3b5cd1c1..e19942bd 100755 --- a/main.go +++ b/main.go @@ -3,9 +3,9 @@ package main import ( "fmt" "log" - "syscall" "net/http" "runtime" + "syscall" "github.com/fvbock/endless" diff --git a/models/tag.go b/models/tag.go index 0a148699..b0589d7d 100755 --- a/models/tag.go +++ b/models/tag.go @@ -42,7 +42,7 @@ func AddTag(name string, state int, createdBy string) error { func GetTags(pageNum int, pageSize int, maps interface{}) ([]Tag, error) { var tags []Tag - if pageSize > 0 && pageNum > 0{ + if pageSize > 0 && pageNum > 0 { db = db.Offset(pageNum).Limit(pageSize) } diff --git a/pkg/app/response.go b/pkg/app/response.go index 737e9ea6..84da3f4c 100644 --- a/pkg/app/response.go +++ b/pkg/app/response.go @@ -1,9 +1,9 @@ package app import ( -"github.com/gin-gonic/gin" + "github.com/gin-gonic/gin" -"github.com/EDDYCJY/go-gin-example/pkg/e" + "github.com/EDDYCJY/go-gin-example/pkg/e" ) type Gin struct { diff --git a/pkg/e/msg.go b/pkg/e/msg.go index afe7894c..073cefbe 100755 --- a/pkg/e/msg.go +++ b/pkg/e/msg.go @@ -12,8 +12,8 @@ var MsgFlags = map[int]string{ ERROR_ADD_TAG_FAIL: "新增标签失败", ERROR_EDIT_TAG_FAIL: "修改标签失败", ERROR_DELETE_TAG_FAIL: "删除标签失败", - ERROR_EXPORT_TAG_FAIL: "导出标签失败", - ERROR_IMPORT_TAG_FAIL: "导入标签失败", + ERROR_EXPORT_TAG_FAIL: "导出标签失败", + ERROR_IMPORT_TAG_FAIL: "导入标签失败", ERROR_NOT_EXIST_ARTICLE: "该文章不存在", ERROR_ADD_ARTICLE_FAIL: "新增文章失败", ERROR_DELETE_ARTICLE_FAIL: "删除文章失败", diff --git a/pkg/export/excel.go b/pkg/export/excel.go index ca6d4f29..3b3030b9 100644 --- a/pkg/export/excel.go +++ b/pkg/export/excel.go @@ -12,4 +12,4 @@ func GetExcelPath() string { func GetExcelFullPath() string { return setting.AppSetting.RuntimeRootPath + GetExcelPath() -} \ No newline at end of file +} diff --git a/routers/api/v1/tag.go b/routers/api/v1/tag.go index 4f4dde45..7db109db 100755 --- a/routers/api/v1/tag.go +++ b/routers/api/v1/tag.go @@ -9,11 +9,11 @@ import ( "github.com/EDDYCJY/go-gin-example/pkg/app" "github.com/EDDYCJY/go-gin-example/pkg/e" + "github.com/EDDYCJY/go-gin-example/pkg/export" + "github.com/EDDYCJY/go-gin-example/pkg/logging" "github.com/EDDYCJY/go-gin-example/pkg/setting" "github.com/EDDYCJY/go-gin-example/pkg/util" "github.com/EDDYCJY/go-gin-example/service/tag_service" - "github.com/EDDYCJY/go-gin-example/pkg/export" - "github.com/EDDYCJY/go-gin-example/pkg/logging" ) // @Summary 获取多个文章标签 @@ -216,7 +216,7 @@ func ExportTag(c *gin.Context) { } tagService := tag_service.Tag{ - Name: name, + Name: name, State: state, } @@ -256,4 +256,4 @@ func ImportTag(c *gin.Context) { } appG.Response(http.StatusOK, e.SUCCESS, nil) -} \ No newline at end of file +} diff --git a/routers/router.go b/routers/router.go index 958b1a6a..4ae196f7 100755 --- a/routers/router.go +++ b/routers/router.go @@ -10,11 +10,11 @@ import ( "github.com/swaggo/gin-swagger/swaggerFiles" "github.com/EDDYCJY/go-gin-example/middleware/jwt" + "github.com/EDDYCJY/go-gin-example/pkg/export" "github.com/EDDYCJY/go-gin-example/pkg/setting" "github.com/EDDYCJY/go-gin-example/pkg/upload" "github.com/EDDYCJY/go-gin-example/routers/api" "github.com/EDDYCJY/go-gin-example/routers/api/v1" - "github.com/EDDYCJY/go-gin-example/pkg/export" ) func InitRouter() *gin.Engine { diff --git a/service/tag_service/tag.go b/service/tag_service/tag.go index 421f737b..c410afbf 100644 --- a/service/tag_service/tag.go +++ b/service/tag_service/tag.go @@ -4,16 +4,16 @@ import ( "encoding/json" "strconv" "time" + "io" "github.com/tealeg/xlsx" + "github.com/360EntSecGroup-Skylar/excelize" "github.com/EDDYCJY/go-gin-example/models" "github.com/EDDYCJY/go-gin-example/pkg/export" "github.com/EDDYCJY/go-gin-example/pkg/gredis" "github.com/EDDYCJY/go-gin-example/pkg/logging" "github.com/EDDYCJY/go-gin-example/service/cache_service" - "io" - "github.com/360EntSecGroup-Skylar/excelize" ) type Tag struct {