12345678910111213141516171819202122232425262728293031323334353637383940 |
- package controllers
- import (
- "eta/eta_data_init/models"
- "eta/eta_data_init/services"
- "fmt"
- beego "github.com/beego/beego/v2/server/web"
- )
- // DataInitController
- // Operations about Users
- type AdminInitController struct {
- beego.Controller
- }
- // Base
- // @Title 初始化系统用户
- // @Description 初始化系统用户
- // @Param FileName query string true "文件名称"
- // @Success Ret=200
- // @router /base [get]
- func (this *AdminInitController) Base() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- fileName := this.GetString("FileName")
- if fileName == "" {
- br.Msg = "文件名称不能为空"
- return
- }
- filePath := "/docs/" + fileName
- fmt.Println("filePath:" + filePath)
- services.InitAdmin(filePath)
- br.Ret = 200
- br.Msg = "初始化成功"
- }
|