init
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"skeleton/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// ExampleController 示例控制器
|
||||
type ExampleController struct {
|
||||
service *ExampleService
|
||||
}
|
||||
|
||||
// NewExampleController 创建示例控制器
|
||||
func NewExampleController() *ExampleController {
|
||||
return &ExampleController{
|
||||
service: NewExampleService(),
|
||||
}
|
||||
}
|
||||
|
||||
// Hello 示例接口
|
||||
func (c *ExampleController) Hello(ctx *gin.Context) {
|
||||
ctx.JSON(http.StatusOK, utils.Success(c.service.Hello()))
|
||||
}
|
||||
Reference in New Issue
Block a user