feat: add "/api/status/test"

This commit is contained in:
1808837298@qq.com
2024-03-04 19:32:59 +08:00
parent 912f46fcd2
commit fe7f42fc2e
3 changed files with 49 additions and 0 deletions

View File

@@ -11,6 +11,22 @@ import (
"github.com/gin-gonic/gin"
)
func TestStatus(c *gin.Context) {
err := model.PingDB()
if err != nil {
c.JSON(http.StatusServiceUnavailable, gin.H{
"success": false,
"message": "数据库连接失败",
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "Server is running",
})
return
}
func GetStatus(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"success": true,