package routers import ( "tmr-watch/comm" "tmr-watch/conf/setting" "tmr-watch/http/handle/api" "tmr-watch/http/handle/group" "tmr-watch/http/handle/sap" "tmr-watch/http/handle/zc" "tmr-watch/middleware/jwt" "github.com/gin-gonic/gin" ginSwagger "github.com/swaggo/gin-swagger" "github.com/swaggo/gin-swagger/swaggerFiles" ) func AppAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) { return func(s *gin.Engine) { for _, opt := range opts { opt(s) } s.POST("/pasture/account/distribute", group.DistributeAccount) // 账号下发 s.Static("/static", setting.CurrentPath+"/dist/static") // 添加资源路径 s.StaticFile("/", setting.CurrentPath+"/dist/index.html") //前端接口 s.StaticFile("/favicon.ico", setting.CurrentPath+"/dist/favicon.ico") //前端接口 s.Static("/file", setting.CurrentPath+"/uploads/file") s.Static("/uploads", setting.CurrentPath+"/uploads") s.POST("/auth", api.Auth) // 获取登录token s.POST("/authlogin", api.AuthLogin) // 获取登录token s.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) // API 注释 if setting.CommSetting.PortName != "" { s.GET("/comm/:id/:x/:y/", comm.ProcessHttp) s.GET("/cps/:id/:limit", comm.ProcessHttpCPS) s.POST("/comm/:id/:x/:y/", comm.ProcessHttp) s.POST("/cps/:id/:limit", comm.ProcessHttpCPS) } eqm := s.Group("/manage/api") eqm.POST("/login", api.Auth) eqm.POST("/login/imei", api.AuthImei) s.GET("/getData", api.GetWxCode) s.GET("/getData/yq", api.GetYqWxCode) s.POST("/language/edit", api.EditLanguage) s.POST("/userwxopenid/binding", api.UserWXOpenIDBinding) apiV1 := s.Group("/authdata") apiV1.Use(jwt.JWT()) // token 验证 { apiV1.POST("/rolemenus", api.GetRecuDataByName) apiV1.GET("/userinfo", api.GetUserinfo) apiV1.POST("/logout", api.UserLogout) apiV1.POST("/GetRecuDataByName", api.GetRecuDataByName) //// apiV1.POST("/GetDataByName", api.GetDataByName) apiV1.POST("/GetDataBySqlIN", api.GetDataBySqlIN) apiV1.POST("/GetDataByNames", api.GetDataByNames) apiV1.POST("/PostDataByName", api.PostDataByName) apiV1.POST("/PostDataByNames", api.PostDataByNames) apiV1.POST("/UpdateDataRelation", api.UpdateDataRelation) //log.error apiV1.POST("/GetDataByNameForm", api.GetDataByNameForm) apiV1.POST("/PostDataByNameForm", api.PostDataByNameForm) apiV1.POST("/GetUpkeepPlan", api.GetUpkeepPlan) apiV1.POST("/GetReportform", api.GetReportform) apiV1.POST("/GetArrList", api.GetArrList) apiV1.POST("/GETNurJudge", api.GETNurJudge) apiV1.POST("/GETNurJudgeRport", api.GETNurJudgeRport) apiV1.POST("/ExecDataByConfig", api.ExecDataByConfig) apiV1.POST("/ImportExcel", api.ImportExcel) apiV1.POST("/upload/:id/:name", api.UploadFile) apiV1.POST("/uploads", api.UploadFiles) apiV1.POST("/uploaderimage", api.UploaderImage) apiV1.POST("/uploaderTmrImage", api.UploaderTmrImage) apiV1.POST("/removeimage", api.RemovePicByName) apiV1.GET("/getthumbnailimage/:filename", api.GetThumbnailImage) apiV1.POST("/getoriginimage/:filename", api.GetOriginImage) apiV1.GET("/getfileraw/:filename", api.GetFileRaw) apiV1.GET("/downloadfile/:filename", api.DownloadFile) apiV1.POST("/removefile/:id", api.RemoveFileByName) apiV1.POST("/testdata", api.TestData) apiV1.POST("/Testpartitions", api.Testpartitions) //自定义报表 apiV1.POST("/Createchart", api.Createchart) apiV1.POST("/Updatechart", api.Createchart) apiV1.POST("/exesql", api.ExecSQL) apiV1.POST("/Createdashboard", api.Updatedashboard) apiV1.POST("/Updatedashboard", api.Updatedashboard) apiV1.POST("/Dashboards", api.Dashboards) // 格润富德 API 数据获取 apiV1.POST("/getDorm", api.GetDorm) // 牛舍信息 apiV1.POST("/GetRJSBData", api.GetRJSBData) apiV1.POST("/PostRJSBData", api.PostRJSBData) apiV1.POST("/PostRJSBDatas", api.PostRJSBDatas) apiV1.POST("/autogeneration", api.Autogeneration) apiV1.POST("/spillage", api.GetSpillage) apiV1.POST("/trains", api.UpdateTrains) apiV1.POST("/lpplan/edit", api.UpdateLpplan) apiV1.POST("/lpplan/add", api.AddLpplan) apiV1.POST("/lpplandtl", api.GetLpplandtl) apiV1.POST("/lpplandtl/restore", api.RestoreLpplandtl) apiV1.POST("/lpplandtl/del", api.DelLpplandtl) apiV1.POST("/spillage/day", api.GetSpillageDay) apiV1.POST("/trains/day", api.UpdateTrainsDay) apiV1.POST("/lpplandtl/restore/day", api.RestoreLpplandtlDay) apiV1.POST("/lpplandtl/del/day", api.DelLpplandtlDay) apiV1.POST("/lpplandtl/add/day", api.AddLpplanDay) apiV1.POST("/lpplandtl/day", api.GetLpplandtlDay) apiV1.POST("/chart/feedEffMR", api.GetFeedEffMR) apiV1.POST("/chart/feedEffSL", api.GetFeedEffSL) apiV1.POST("/chart/feedEffHL", api.GetFeedEffHL) apiV1.POST("/chart/feedEffZH", api.GetFeedEffZH) apiV1.POST("/chart/feedEffCBFT", api.GetFeedEffCBFT) apiV1.POST("/chart/accuracyAllFT", api.GetAccuracyAllFT) apiV1.POST("/chart/accuracyAllJH", api.GetAccuracyAllJH) apiV1.POST("/chart/accuracyAllNQ", api.GetAccuracyAllNQ) apiV1.POST("/chart/accuracyAllCC", api.GetAccuracyAllCC) apiV1.POST("/chart/accuracyAllHL", api.GetAccuracyAllHL) apiV1.POST("/chart/accuracyAllLS", api.GetAccuracyAllLS) apiV1.POST("/chart/accuracyAllQX", api.GetAccuracyAllQX) apiV1.POST("/summary", api.GetSummary) apiV1.POST("/ftdetail/edit", api.UpdateFTdetail) apiV1.POST("/fpdetail/edit", api.UpdateFpdetailBar) apiV1.POST("/fpdetail/batch/edit", api.FpdBatchEdit) apiV1.POST("/ftdetai/del", api.DeleteFTdetail) apiV1.POST("/lpplandtl/add", api.AddLpplandtl) apiV1.POST("/lpplandtl/edit/sort", api.UpdateLpplandtlSort) apiV1.POST("/lpplandtl/date/add", api.AddLpplandtlDate) apiV1.POST("/lpplandtl/edit/date/sort", api.UpdateLpplandtlDateSort) apiV1.POST("/processAnalysist", api.GetProcessAnalysis) apiV1.POST("/feedp/undistribute", api.GetFeedpUndistributed) apiV1.POST("/feedtemplet/enable", api.UpdateFeedtempletStatus) apiV1.POST("/ftdry/add", api.AddFtdry) apiV1.POST("/checkDates", api.CheckDates) //编辑数据同步勾选状态 apiV1.POST("/scheduled/status/edit", api.UpdateScheduledStatus) // 立即同步 apiV1.POST("/synchronizeNow", api.SynchronizeNow) apiV1.POST("/fpdimportexcel", api.FpdImportExcel) apiV1.POST("/barfeedremain/excel", api.GetBarfeedremainExcel) //删除当前班次撒料时记录 apiV1.POST("/spillageall/del", api.DeleteSpillageAll) apiV1.POST("/feedp/history", api.GetFeedpHistory) //查看撒料修改记录 apiV1.POST("/spillageall/history", api.GetSpillageallHistory) //查看撒料设备 apiV1.POST("/tmrListEnableTypeAll", api.GetTMRListEnableTypeAll) //查看提醒设置 apiV1.POST("/remind/list", api.GetRemind) apiV1.POST("/remind/edit", api.UpdateRemind) //配方模板修改记录 apiV1.POST("/recipetemplate/history", api.GetRecipeTemplateRecordHistory) //配方模板修改记录 apiV1.POST("/feedtemplet/history", api.GetFeedtempletHistory) //app取料接口 apiV1.POST("/downloadedplan", api.GetDownloadedplanMaterial1) apiV1.POST("/downloadedplan/list", api.GetDownloadedplanMaterialList) apiV1.POST("/subplan", api.GetSubPlan) apiV1.POST("/completeplan", api.CompletePlan) apiV1.POST("/realtimeweight", api.AddRealTimeWeight) //修改撒料计划tmr编号 apiV1.POST("/materialtmr/edit", api.UpdateMaterialTMR) apiV1.POST("/materialtmr/date/edit", api.UpdateMaterialTMRDate) //集团端配方下发 apiV1.POST("/formulaissued", api.AddFormulaIssued) //盘点单添加 apiV1.POST("/biginventory", api.AddBigInventory) //sap原料上传 apiV1.POST("/material/sap/upload", sap.MaterialOutbound) //sap剩料上传 apiV1.POST("/surplus/sap/upload", sap.SurplusOutbound) apiV1.POST("/downloadplandtl1/image/upload", api.UploadFile1) apiV1.POST("/syncSCJH", zc.SyncSCJH) //修改日执行计划 apiV1.POST("/dailydata/edit", api.UpdateDailyData) apiV1.POST("/formulastatistics", api.GetFormulaStatistics) apiV1.POST("/sap/feed", sap.SyncSapFeed) apiV1.POST("/sap/bar", sap.SyncSapBar) apiV1.POST("/sap/material", sap.MaterialOutbound) apiV1.POST("/feedbackup/check", api.CheckFeedTrgaddress) apiV1.POST("/ud/feedp/sync", api.UdFeedpSync) apiV1.POST("/tmrequipment/del", api.DelTmrEquipment) apiV1.POST("/tmrequipment/edit", api.AddTmrEquipment) apiV1.GET("/tmrequipment", api.GetTmrEquipment) //光明ud手动上传 apiV1.POST("/gm/udbar", api.UdBarSync) apiV1.POST("/gm/udfeed", api.UdFeedSync) apiV1.POST("/gm/udfeedtemplet/push", api.UdFeedtempletPush) apiV1.POST("/gm/udutir/push", api.UdUtirPush) apiV1.POST("/gm/udbarfeedremain/push", api.UdBarFeedRemainPush) apiV1.POST("/gm/udmaterialIssue/push", api.UdMaterialIssuePush) apiV1.POST("/feedtemplet/del", api.DelFeedTemplet) apiV1.POST("/plan/sort/edit", api.EditPlanSort) //日执行计划修改为完成 apiV1.POST("/plan/artificial/edit", api.EditDownloadedplanArtificial) apiV1.GET("/equipment/muster", api.GetTmrEquipmentMuster) // 修改混料实际重量 apiV1.POST("/planexec/edit", api.EditDownloadedplanExecWeight) // 修改撒料实际重量 apiV1.POST("/plan2/edit", api.EditDownloadplandtl2Weight) apiV1.POST("/surplus/add", api.AddSurplus) apiV1.POST("/surplus/del", api.DelSurplus) apiV1.GET("/surplus/list", api.GetelSurplus) // 云养牛搅拌上传 apiV1.POST("/stir/yyn/upload", api.LabourStirPush) // 云养牛撒料上传 apiV1.POST("/dusting/yyn/upload", api.LabourDustingPush) } //不需要登录验证的接口 s.POST("/getopenid/:code", api.GetOpenID) apiV3 := s.Group("/thi") // restful 接口 tablename 是 表名字 { apiV3.POST("/GetDataByName", api.GetDataByName) apiV3.POST("/PostDataByName", api.PostDataByName) apiV3.POST("/plandata", api.GetPlanData) apiV3.POST("/plandata/edit", api.PostPlanData) apiV3.POST("/plandata/batch/edit", api.PostPlanDatas) //推料接口 apiV3.GET("/pusher/list", api.GetPusherList) apiV3.POST("/pusher/edit", api.EditPusherGPS) //羊圈通过RFID 需要传输的值: apiV3.GET("/plan/rfid", api.GetPlanRFID) } apiV4 := s.Group("/customreport") // restful 接口 tablename 是 表名字 { apiV4.POST("/createchart", api.Createchart) apiV4.POST("/PostDataByName", api.PostDataByName) } } }