业务层
您可以在 ./go/api
中编写业务。
# 使用方法
package api
import (
"net/http"
"github.com/wallace5303/ee-go/eapp"
"github.com/wallace5303/ee-go/ehelper"
"github.com/wallace5303/ee-go/ehttp/router"
"github.com/wallace5303/ee-go/elog"
"github.com/gin-gonic/gin"
)
// 使用 router Ctx
// Ctx将封装一些通用功能,如 日志(请求路径、接口耗时 ...) 等
func Hello(c *router.Ctx) {
ret := ehelper.GetJson()
defer c.JSON(ret)
ret.Data = "hello electron-egg"
elog.Logger.Info(" print Hello ")
}
// 使用 gin Context
func Info(gc *gin.Context) {
ret := ehelper.GetJson()
defer gc.JSON(http.StatusOK, ret)
elog.Logger.Info(" print info ")
}
func Exit(c *router.Ctx) {
ret := ehelper.GetJson()
defer c.JSON(ret)
eapp.Close()
}
上次更新: 2025/04/10, 03:07:49