init_database_handler.go 662 B

12345678910111213141516171819202122232425262728293031
  1. package base
  2. import (
  3. "net/http"
  4. "github.com/zeromicro/go-zero/rest/httpx"
  5. "wechat-api/internal/logic/base"
  6. "wechat-api/internal/svc"
  7. )
  8. // swagger:route get /init/database base InitDatabase
  9. //
  10. // Initialize database | 初始化数据库
  11. //
  12. // Initialize database | 初始化数据库
  13. //
  14. // Responses:
  15. // 200: BaseMsgResp
  16. func InitDatabaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  17. return func(w http.ResponseWriter, r *http.Request) {
  18. l := base.NewInitDatabaseLogic(r.Context(), svcCtx)
  19. resp, err := l.InitDatabase()
  20. if err != nil {
  21. httpx.ErrorCtx(r.Context(), w, err)
  22. } else {
  23. httpx.OkJsonCtx(r.Context(), w, resp)
  24. }
  25. }
  26. }