app_api.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. package routers
  2. import (
  3. "tmr-watch/comm"
  4. "tmr-watch/conf/setting"
  5. "tmr-watch/http/handle/api"
  6. "tmr-watch/http/handle/group"
  7. "tmr-watch/http/handle/sap"
  8. "tmr-watch/http/handle/zc"
  9. "tmr-watch/middleware/jwt"
  10. "github.com/gin-gonic/gin"
  11. ginSwagger "github.com/swaggo/gin-swagger"
  12. "github.com/swaggo/gin-swagger/swaggerFiles"
  13. )
  14. func AppAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
  15. return func(s *gin.Engine) {
  16. for _, opt := range opts {
  17. opt(s)
  18. }
  19. s.POST("/pasture/account/distribute", group.DistributeAccount) // 账号下发
  20. s.Static("/static", setting.CurrentPath+"/dist/static") // 添加资源路径
  21. s.StaticFile("/", setting.CurrentPath+"/dist/index.html") //前端接口
  22. s.StaticFile("/favicon.ico", setting.CurrentPath+"/dist/favicon.ico") //前端接口
  23. s.Static("/file", setting.CurrentPath+"/uploads/file")
  24. s.Static("/uploads", setting.CurrentPath+"/uploads")
  25. s.POST("/auth", api.Auth) // 获取登录token
  26. s.POST("/authlogin", api.AuthLogin) // 获取登录token
  27. s.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) // API 注释
  28. if setting.CommSetting.PortName != "" {
  29. s.GET("/comm/:id/:x/:y/", comm.ProcessHttp)
  30. s.GET("/cps/:id/:limit", comm.ProcessHttpCPS)
  31. s.POST("/comm/:id/:x/:y/", comm.ProcessHttp)
  32. s.POST("/cps/:id/:limit", comm.ProcessHttpCPS)
  33. }
  34. eqm := s.Group("/manage/api")
  35. eqm.POST("/login", api.Auth)
  36. eqm.POST("/login/imei", api.AuthImei)
  37. s.GET("/getData", api.GetWxCode)
  38. s.POST("/userwxopenid/binding", api.UserWXOpenIDBinding)
  39. apiV1 := s.Group("/authdata")
  40. apiV1.Use(jwt.JWT()) // token 验证
  41. {
  42. apiV1.POST("/rolemenus", api.GetRecuDataByName)
  43. apiV1.GET("/userinfo", api.GetUserinfo)
  44. apiV1.POST("/logout", api.UserLogout)
  45. apiV1.POST("/GetRecuDataByName", api.GetRecuDataByName) ////
  46. apiV1.POST("/GetDataByName", api.GetDataByName)
  47. apiV1.POST("/GetDataBySqlIN", api.GetDataBySqlIN)
  48. apiV1.POST("/GetDataByNames", api.GetDataByNames)
  49. apiV1.POST("/PostDataByName", api.PostDataByName)
  50. apiV1.POST("/PostDataByNames", api.PostDataByNames)
  51. apiV1.POST("/UpdateDataRelation", api.UpdateDataRelation) //log.error
  52. apiV1.POST("/GetDataByNameForm", api.GetDataByNameForm)
  53. apiV1.POST("/PostDataByNameForm", api.PostDataByNameForm)
  54. apiV1.POST("/GetUpkeepPlan", api.GetUpkeepPlan)
  55. apiV1.POST("/GetReportform", api.GetReportform)
  56. apiV1.POST("/GetArrList", api.GetArrList)
  57. apiV1.POST("/GETNurJudge", api.GETNurJudge)
  58. apiV1.POST("/GETNurJudgeRport", api.GETNurJudgeRport)
  59. apiV1.POST("/ExecDataByConfig", api.ExecDataByConfig)
  60. apiV1.POST("/ImportExcel", api.ImportExcel)
  61. apiV1.POST("/upload/:id/:name", api.UploadFile)
  62. apiV1.POST("/uploads", api.UploadFiles)
  63. apiV1.POST("/uploaderimage", api.UploaderImage)
  64. apiV1.POST("/uploaderTmrImage", api.UploaderTmrImage)
  65. apiV1.POST("/removeimage", api.RemovePicByName)
  66. apiV1.GET("/getthumbnailimage/:filename", api.GetThumbnailImage)
  67. apiV1.POST("/getoriginimage/:filename", api.GetOriginImage)
  68. apiV1.GET("/getfileraw/:filename", api.GetFileRaw)
  69. apiV1.GET("/downloadfile/:filename", api.DownloadFile)
  70. apiV1.POST("/removefile/:id", api.RemoveFileByName)
  71. apiV1.POST("/testdata", api.TestData)
  72. apiV1.POST("/Testpartitions", api.Testpartitions)
  73. //自定义报表
  74. apiV1.POST("/Createchart", api.Createchart)
  75. apiV1.POST("/Updatechart", api.Createchart)
  76. apiV1.POST("/exesql", api.ExecSQL)
  77. apiV1.POST("/Createdashboard", api.Updatedashboard)
  78. apiV1.POST("/Updatedashboard", api.Updatedashboard)
  79. apiV1.POST("/Dashboards", api.Dashboards)
  80. // 格润富德 API 数据获取
  81. apiV1.POST("/getDorm", api.GetDorm) // 牛舍信息
  82. apiV1.POST("/GetRJSBData", api.GetRJSBData)
  83. apiV1.POST("/PostRJSBData", api.PostRJSBData)
  84. apiV1.POST("/PostRJSBDatas", api.PostRJSBDatas)
  85. apiV1.POST("/autogeneration", api.Autogeneration)
  86. apiV1.POST("/spillage", api.GetSpillage)
  87. apiV1.POST("/trains", api.UpdateTrains)
  88. apiV1.POST("/lpplan/edit", api.UpdateLpplan)
  89. apiV1.POST("/lpplan/add", api.AddLpplan)
  90. apiV1.POST("/lpplandtl", api.GetLpplandtl)
  91. apiV1.POST("/lpplandtl/restore", api.RestoreLpplandtl)
  92. apiV1.POST("/lpplandtl/del", api.DelLpplandtl)
  93. apiV1.POST("/spillage/day", api.GetSpillageDay)
  94. apiV1.POST("/trains/day", api.UpdateTrainsDay)
  95. apiV1.POST("/lpplandtl/restore/day", api.RestoreLpplandtlDay)
  96. apiV1.POST("/lpplandtl/del/day", api.DelLpplandtlDay)
  97. apiV1.POST("/lpplandtl/add/day", api.AddLpplanDay)
  98. apiV1.POST("/lpplandtl/day", api.GetLpplandtlDay)
  99. apiV1.POST("/chart/feedEffMR", api.GetFeedEffMR)
  100. apiV1.POST("/chart/feedEffSL", api.GetFeedEffSL)
  101. apiV1.POST("/chart/feedEffHL", api.GetFeedEffHL)
  102. apiV1.POST("/chart/feedEffZH", api.GetFeedEffZH)
  103. apiV1.POST("/chart/feedEffCBFT", api.GetFeedEffCBFT)
  104. apiV1.POST("/chart/accuracyAllFT", api.GetAccuracyAllFT)
  105. apiV1.POST("/chart/accuracyAllJH", api.GetAccuracyAllJH)
  106. apiV1.POST("/chart/accuracyAllNQ", api.GetAccuracyAllNQ)
  107. apiV1.POST("/chart/accuracyAllCC", api.GetAccuracyAllCC)
  108. apiV1.POST("/chart/accuracyAllHL", api.GetAccuracyAllHL)
  109. apiV1.POST("/chart/accuracyAllLS", api.GetAccuracyAllLS)
  110. apiV1.POST("/chart/accuracyAllQX", api.GetAccuracyAllQX)
  111. apiV1.POST("/summary", api.GetSummary)
  112. apiV1.POST("/ftdetail/edit", api.UpdateFTdetail)
  113. apiV1.POST("/fpdetail/edit", api.UpdateFpdetailBar)
  114. apiV1.POST("/ftdetai/del", api.DeleteFTdetail)
  115. apiV1.POST("/lpplandtl/add", api.AddLpplandtl)
  116. apiV1.POST("/lpplandtl/edit/sort", api.UpdateLpplandtlSort)
  117. apiV1.POST("/lpplandtl/date/add", api.AddLpplandtlDate)
  118. apiV1.POST("/lpplandtl/edit/date/sort", api.UpdateLpplandtlDateSort)
  119. apiV1.POST("/processAnalysist", api.GetProcessAnalysis)
  120. apiV1.POST("/feedp/undistribute", api.GetFeedpUndistributed)
  121. apiV1.POST("/feedtemplet/enable", api.UpdateFeedtempletStatus)
  122. apiV1.POST("/ftdry/add", api.AddFtdry)
  123. apiV1.POST("/checkDates", api.CheckDates)
  124. //编辑数据同步勾选状态
  125. apiV1.POST("/scheduled/status/edit", api.UpdateScheduledStatus)
  126. // 立即同步
  127. apiV1.POST("/synchronizeNow", api.SynchronizeNow)
  128. apiV1.POST("/fpdimportexcel", api.FpdImportExcel)
  129. apiV1.POST("/barfeedremain/excel", api.GetBarfeedremainExcel)
  130. //删除当前班次撒料时记录
  131. apiV1.POST("/spillageall/del", api.DeleteSpillageAll)
  132. apiV1.POST("/feedp/history", api.GetFeedpHistory)
  133. //查看撒料修改记录
  134. apiV1.POST("/spillageall/history", api.GetSpillageallHistory)
  135. //查看撒料设备
  136. apiV1.POST("/tmrListEnableTypeAll", api.GetTMRListEnableTypeAll)
  137. //查看提醒设置
  138. apiV1.POST("/remind/list", api.GetRemind)
  139. apiV1.POST("/remind/edit", api.UpdateRemind)
  140. //配方模板修改记录
  141. apiV1.POST("/recipetemplate/history", api.GetRecipeTemplateRecordHistory)
  142. //配方模板修改记录
  143. apiV1.POST("/feedtemplet/history", api.GetFeedtempletHistory)
  144. //app取料接口
  145. apiV1.POST("/downloadedplan", api.GetDownloadedplanMaterial1)
  146. apiV1.POST("/downloadedplan/list", api.GetDownloadedplanMaterialList)
  147. apiV1.POST("/subplan", api.GetSubPlan)
  148. apiV1.POST("/completeplan", api.CompletePlan)
  149. apiV1.POST("/realtimeweight", api.AddRealTimeWeight)
  150. //修改撒料计划tmr编号
  151. apiV1.POST("/materialtmr/edit", api.UpdateMaterialTMR)
  152. apiV1.POST("/materialtmr/date/edit", api.UpdateMaterialTMRDate)
  153. //集团端配方下发
  154. apiV1.POST("/formulaissued", api.AddFormulaIssued)
  155. //盘点单添加
  156. apiV1.POST("/biginventory", api.AddBigInventory)
  157. //sap原料上传
  158. apiV1.POST("/material/sap/upload", sap.MaterialOutbound)
  159. apiV1.POST("/downloadplandtl1/image/upload", api.UploadFile1)
  160. apiV1.POST("/syncSCJH", zc.SyncSCJH)
  161. //修改日执行计划
  162. apiV1.POST("/dailydata/edit", api.UpdateDailyData)
  163. apiV1.POST("/formulastatistics", api.GetFormulaStatistics)
  164. }
  165. //不需要登录验证的接口
  166. s.POST("/getopenid/:code", api.GetOpenID)
  167. apiV3 := s.Group("/thi") // restful 接口 tablename 是 表名字
  168. {
  169. apiV3.POST("/GetDataByName", api.GetDataByName)
  170. apiV3.POST("/PostDataByName", api.PostDataByName)
  171. }
  172. apiV4 := s.Group("/customreport") // restful 接口 tablename 是 表名字
  173. {
  174. apiV4.POST("/createchart", api.Createchart)
  175. apiV4.POST("/PostDataByName", api.PostDataByName)
  176. }
  177. }
  178. }