@@ -0,0 +1,38 @@
|
||||
package health_check_ctrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/health_check_ser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/log"
|
||||
"91porn-server/common/stderr"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Ping doc
|
||||
// @Summary 查询服务健康检测记录
|
||||
// @Description 查询服务健康检测记录
|
||||
// @Tags 移动端-服务健康检测
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param q body health_check_ser.PingReq false "请求参数"
|
||||
// @Success 200 object health_check_ser.SystemStatus "成功"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/health/ping [post]
|
||||
func Ping(ctx *gin.Context) {
|
||||
p := &health_check_ser.PingReq{}
|
||||
if err := ctx.ShouldBind(&p); err != nil {
|
||||
log.Error(fmt.Sprintf("health ping param err:%v", err))
|
||||
common.ServeJSONNoEncrypt(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
list, err := p.Ping()
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("health ping err:%v", err))
|
||||
common.ServeJSONNoEncrypt(ctx, stderr.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSONNoEncrypt(ctx, stderr.Success, list)
|
||||
}
|
||||
Reference in New Issue
Block a user