1 Star 0 Fork 0

ichub/gotestframe

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
HealthFuncService.go 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
leijmdas 提交于 2024-09-01 18:41 . add
package public
import (
"gitee.com/ichub/goconfig/common/base/basedto"
"gitee.com/ichub/goweb/common/webserver/funchandler"
"github.com/gin-gonic/gin"
"net/http"
)
type HealthFuncService struct {
funchandler.FuncService
}
func NewHealthFuncService() *HealthFuncService {
return new(HealthFuncService).init()
}
func (this *HealthFuncService) init() *HealthFuncService {
//单接口
// this.WebBasePath = "public" this.InitRoute(this, http.MethodGet, "public")
//多接口
this.InitRouter(this, "public")
this.RegisterRouter(http.MethodGet, "health", this.Execute)
this.RegisterRouter(http.MethodGet, "helloworld", this.helloworld)
return this
}
// @Summary 健康检查
// @Tags 公共服务
// @Produce json
// @Success 200 {object} basedto.IchubResult "成功"
// @Failure 400 {object} string "请求错误"
// @Failure 500 {object} string "内部错误"
// @Router /public/health [get]
func (this *HealthFuncService) Execute(c *gin.Context) {
c.IndentedJSON(http.StatusOK, basedto.ResultSuccessData("ok"))
}
// @Summary Hello
// @Tags 公共服务
// @Produce json
// @Success 200 {object} basedto.IchubResult "成功"
// @Failure 400 {object} string "请求错误"
// @Failure 500 {object} string "内部错误"
// @Router /public/helloworld [get]
func (this *HealthFuncService) helloworld(c *gin.Context) {
c.IndentedJSON(http.StatusOK, basedto.ResultSuccessData("Hello World"))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ichub/gotestframe.git
git@gitee.com:ichub/gotestframe.git
ichub
gotestframe
gotestframe
23f7283181f7

搜索帮助