12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- package test
- import (
- // "flag"
- "flag"
- "github.com/gin-gonic/gin"
- log "github.com/sirupsen/logrus"
- "kpt.xdmy/apiserver/config"
- "kpt.xdmy/apiserver/dao"
- "kpt.xdmy/apiserver/routers"
- "kpt.xdmy/apiserver/routers/api"
- "kpt.xdmy/apiserver/service"
- "kpt.xdmy/pkg/logging"
- "kpt.xdmy/pkg/setting"
- )
- var s *service.Service
- func Test() {
- // TestJob()
- // TestSap()
- // logInit()
- DataBatch()
- // DataUpdate()
- // RepertoryUpdate()
- // Sqlx()
- // Xorm()
- }
- func TestJob() {
- service.SapJobInit()
- }
- func Init() {
- var path string
- // path = "/Users/desire/kptdev/xdmy_mod/cmd/"
- flag.Parse()
- setting.Setup(path)
- dao.Setup()
- logging.Setup()
- // util.InitWebS(setting.ServerSetting.EasName, setting.ServerSetting.EasPassword, setting.ServerSetting.EasUrl)
- logInit()
- config.Init(path)
- s = service.New(config.Conf)
- // RouterInit()
- // api.ApiInit(svc)
- // routers.Init(svc)
- }
- func logInit() {
- log.SetFormatter(&log.TextFormatter{
- DisableColors: true,
- // FullTimestamp: true,
- })
- log.SetLevel(log.DebugLevel)
- // log.SetReportCaller(true)
- // log.SetOutput(os.Stdout)
- // p := new(service.Service)
- // log.Warnf("log :%v", p)
- }
- func RouterInit() {
- r := gin.New()
- r.Use(gin.Recovery())
- r.POST("/auth", api.Auth) // 获取登录token
- // apiV1 := r.Group("/authdata")
- apiV2 := r.Group("/data")
- // apiV1.Use(jwt.JWT()) // token 验证
- apiV2.POST("/mcs/record", routers.McsControl)
- apiV2.GET("/mcs/accounts", routers.McsAccounts)
- apiV2.POST("/ExecDataByConfig", api.ExecDataByConfig)
- apiV2.POST("/UpdateDataRelation", api.UpdateDataRelation)
- apiV2.POST("/PostDataByName", api.PostDataByName)
- apiV2.POST("/GetDataByName", api.GetDataByName)
- r.Run(":8082")
- }
|