You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
414 B
22 lines
414 B
package middleware
|
|
|
|
import (
|
|
"gin-vue-admin/global"
|
|
"gin-vue-admin/model/common/response"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// 处理跨域请求,支持options访问
|
|
func NeedInit() gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
if global.GVA_DB == nil {
|
|
response.OkWithDetailed(gin.H{
|
|
"needInit": true,
|
|
}, "前往初始化数据库", c)
|
|
c.Abort()
|
|
} else {
|
|
c.Next()
|
|
}
|
|
// 处理请求
|
|
}
|
|
}
|