直接完成

此提交包含在:
2022-11-23 20:56:28 +08:00
當前提交 b924e94c63
共有 21 個檔案被更改,包括 829 行新增0 行删除

35
main.go 一般檔案
查看文件

@@ -0,0 +1,35 @@
package main
import (
"fmt"
nice "github.com/ekyoung/gin-nice-recovery"
"github.com/gin-gonic/gin"
"integrity-checkin/dao"
"integrity-checkin/pkg/app"
"integrity-checkin/pkg/httpclient"
"integrity-checkin/router"
"integrity-checkin/service"
"math/rand"
"time"
)
func main() {
Setup()
httpclient.Setup()
engine := gin.New()
engine.Use(gin.Logger(),
nice.Recovery(func(c *gin.Context, err interface{}) {
aw := app.NewWrapper(c)
aw.Error("内部错误,请重试:" + fmt.Sprintf("%v", err)).SendJSON()
}))
dao.Setup()
service.Setup()
router.Setup(engine)
err := engine.Run(fmt.Sprintf(":%v", "8964"))
if err != nil {
panic(err)
}
}
func Setup() {
rand.Seed(time.Now().UnixNano())
}