From d959f742615f43212847f0521d1608167d649c4f Mon Sep 17 00:00:00 2001 From: "vilet.yy" Date: Thu, 10 Jun 2021 16:01:23 +0800 Subject: [PATCH] fix --- initialize/gorm.go | 8 ++++---- initialize/server.go | 7 ++++--- initialize/zap.go | 6 +++--- pkg/paginator.go | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/initialize/gorm.go b/initialize/gorm.go index 94fcd14..face8c3 100644 --- a/initialize/gorm.go +++ b/initialize/gorm.go @@ -1,7 +1,7 @@ /* * @Date: 2021-03-22 10:12:38 * @LastEditors: viletyy - * @LastEditTime: 2021-06-10 10:54:40 + * @LastEditTime: 2021-06-10 15:43:12 * @FilePath: /potato/initialize/gorm.go */ package initialize @@ -13,8 +13,8 @@ import ( _ "github.com/jinzhu/gorm/dialects/mysql" _ "github.com/jinzhu/gorm/dialects/postgres" "github.com/viletyy/potato/global" - "github.com/viletyy/potato/models" - "github.com/viletyy/potato/models/basic" + "github.com/viletyy/potato/internal/model" + "github.com/viletyy/potato/internal/model/basic" ) func Gorm() *gorm.DB { @@ -62,7 +62,7 @@ func GormSet(db *gorm.DB) { basic.Vendor{}, basic.Business{}, basic.MetaDatabase{}, - models.User{}, + model.User{}, ) // 设置空闲连接池中的最大连接数 diff --git a/initialize/server.go b/initialize/server.go index 48e3f07..9177402 100644 --- a/initialize/server.go +++ b/initialize/server.go @@ -1,7 +1,7 @@ /* * @Date: 2021-03-22 17:03:27 * @LastEditors: viletyy - * @LastEditTime: 2021-04-06 17:47:11 + * @LastEditTime: 2021-06-10 15:43:37 * @FilePath: /potato/initialize/server.go */ package initialize @@ -15,11 +15,12 @@ import ( "time" "github.com/viletyy/potato/global" - "github.com/viletyy/potato/routers" + "github.com/viletyy/potato/internal/routers" + "github.com/viletyy/potato/pkg" ) func RunServer() { - if err := utils.InitTrans("zh"); err != nil { + if err := pkg.InitTrans("zh"); err != nil { fmt.Printf("init trans failed, err:%v\n", err) return } diff --git a/initialize/zap.go b/initialize/zap.go index 181abc4..a997576 100644 --- a/initialize/zap.go +++ b/initialize/zap.go @@ -1,7 +1,7 @@ /* * @Date: 2021-03-22 10:13:04 * @LastEditors: viletyy - * @LastEditTime: 2021-06-10 15:01:09 + * @LastEditTime: 2021-06-10 15:44:06 * @FilePath: /potato/initialize/zap.go */ package initialize @@ -11,7 +11,7 @@ import ( "time" "github.com/viletyy/potato/global" - "github.com/viletyy/potato/utils" + "github.com/viletyy/potato/pkg" "github.com/viletyy/yolk/directory" "go.uber.org/zap" "go.uber.org/zap/zapcore" @@ -56,7 +56,7 @@ func Zap() (logger *zap.Logger) { } func getEncoderCore() (core zapcore.Core) { - writer, err := utils.GetWriteSyncer() // 使用file-rotatelogs进行日志分割 + writer, err := pkg.GetWriteSyncer() // 使用file-rotatelogs进行日志分割 if err != nil { fmt.Printf("Get Write Syncer Failed err: %v", err.Error()) return diff --git a/pkg/paginator.go b/pkg/paginator.go index 112335c..625b8e9 100644 --- a/pkg/paginator.go +++ b/pkg/paginator.go @@ -1,7 +1,7 @@ /* * @Date: 2021-06-10 15:27:36 * @LastEditors: viletyy - * @LastEditTime: 2021-06-10 15:30:56 + * @LastEditTime: 2021-06-10 15:52:48 * @FilePath: /potato/pkg/paginator.go */ package pkg @@ -12,7 +12,7 @@ import ( ) func GetPageInfo(c *gin.Context) (page, pageSize int) { - page = convert.ToString(c.DefaultQuery("page", "1")).Int() - pageSize = convert.ToString(c.DefaultQuery("page_size", "10")).Int() + page, _ = convert.StrTo(c.DefaultQuery("page", "1")).Int() + pageSize, _ = convert.StrTo(c.DefaultQuery("page_size", "10")).Int() return }