refactor: database init module

This commit is contained in:
zchengo
2023-01-28 21:17:31 +08:00
parent 4ca72dd774
commit 215d4e4164
7 changed files with 99 additions and 61 deletions
+14 -4
View File
@@ -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)
}