refactor: database init module
This commit is contained in:
+14
-4
@@ -7,8 +7,18 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 初始化数据
|
||||
func InitData(c *gin.Context) {
|
||||
errCode := service.InitData()
|
||||
response.Result(errCode, nil, c)
|
||||
type CommonApi struct {
|
||||
commonService *service.CommonService
|
||||
}
|
||||
|
||||
func NewCommonApi() *CommonApi {
|
||||
return &CommonApi{
|
||||
commonService: service.NewCommonService(),
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化数据库
|
||||
func (c *CommonApi) InitDatabase(context *gin.Context) {
|
||||
errCode := c.commonService.InitDatabase()
|
||||
response.Result(errCode, nil, context)
|
||||
}
|
||||
Reference in New Issue
Block a user