mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 12:32:25 +00:00
gin-vue-admin 2.0代码重构
This commit is contained in:
@@ -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
|
||||
)
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user