gin-vue-admin 2.0代码重构

This commit is contained in:
QM303176530
2020-04-04 21:39:07 +08:00
parent 5ed41ddd8c
commit 1b9adea284
202 changed files with 1240 additions and 1299 deletions
+16
View File
@@ -0,0 +1,16 @@
package global
import (
"gin-vue-admin/init"
"github.com/go-redis/redis"
"github.com/jinzhu/gorm"
"github.com/spf13/viper"
)
var (
GVA_DB *gorm.DB
GVA_REDIS *redis.Client
GVA_LOG init.Logger
GVA_CONFIG init.Config
GVA_VP *viper.Viper
)
+26
View File
@@ -0,0 +1,26 @@
package response
import (
"github.com/gin-gonic/gin"
"net/http"
)
type response struct {
code int
data interface{}
msg string
}
const (
ERROR = 7
SUCCESS = 0
)
func Result(code int, data interface{}, msg string, c *gin.Context) {
// 开始时间
c.JSON(http.StatusOK, response{
code,
data,
msg,
})
}