附近小店
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

router.go 6.9 KiB

há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 9 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 9 meses
há 10 meses
há 10 meses
há 10 meses
há 9 meses
há 10 meses
há 9 meses
há 10 meses
há 10 meses
há 10 meses
há 9 meses
há 10 meses
há 10 meses
há 9 meses
há 9 meses
há 10 meses
há 10 meses
há 9 meses
há 10 meses
há 9 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 10 meses
há 9 meses
há 9 meses
há 10 meses
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. package router
  2. import (
  3. agentHdl "applet/app/agent/hdl"
  4. "applet/app/cfg"
  5. "applet/app/hdl"
  6. "applet/app/mw"
  7. storeHdl "applet/app/store/hdl"
  8. _ "applet/docs"
  9. "github.com/gin-gonic/gin"
  10. swaggerFiles "github.com/swaggo/files"
  11. ginSwagger "github.com/swaggo/gin-swagger"
  12. )
  13. // 初始化路由
  14. // 1
  15. func Init() *gin.Engine {
  16. // debug, release, test 项目阶段
  17. mode := "release"
  18. if cfg.Debug {
  19. mode = "debug"
  20. }
  21. gin.SetMode(mode)
  22. //创建一个新的启动器
  23. r := gin.New()
  24. r.GET("/api/swagger/*any", func(c *gin.Context) {
  25. //r.Use(mw.SwagAuth())
  26. ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "SWAGGER")(c)
  27. })
  28. r.Use(mw.ChangeHeader)
  29. // 是否打印访问日志, 在非正式环境都打印
  30. if mode != "release" {
  31. r.Use(gin.Logger())
  32. }
  33. r.Use(gin.Recovery())
  34. r.GET("/favicon.ico", func(c *gin.Context) {
  35. c.Status(204)
  36. })
  37. r.NoRoute(func(c *gin.Context) {
  38. c.JSON(404, gin.H{"code": 404, "msg": "page not found", "data": []struct{}{}})
  39. })
  40. r.NoMethod(func(c *gin.Context) {
  41. c.JSON(405, gin.H{"code": 405, "msg": "method not allowed", "data": []struct{}{}})
  42. })
  43. r.Use(mw.Cors)
  44. routeCommunityTeamAgent(r.Group("/api/v1/communityTeam/agent"))
  45. routeCommunityTeamOwnStore(r.Group("/api/v1/communityTeam/ownStore"))
  46. routeCommunityTeam(r.Group("/api/v1/communityTeam"))
  47. return r
  48. }
  49. func routeCommunityTeamAgent(r *gin.RouterGroup) {
  50. // 文件上传确认回调, 不校验设备等头部信息
  51. r.POST("/file/img/callback", agentHdl.FileImgCallback)
  52. r.Use(mw.DB) // 下面接口再根据mid 获取数据库名
  53. r.POST("/login", agentHdl.Login)
  54. r.Use(mw.AuthJWT)
  55. // 文件上传
  56. r.POST("/img/upload", agentHdl.ImgReqUpload)
  57. r.GET("/user", agentHdl.User)
  58. r.POST("/service/file/upload", agentHdl.ServiceFileUpload)
  59. r.GET("/wechat/base", agentHdl.WechatBase)
  60. r.POST("/wechat/base/set", agentHdl.WechatBaseSet)
  61. r.GET("/alipay/base", agentHdl.AlipayBase)
  62. r.POST("/alipay/base/set", agentHdl.AlipayBaseSet)
  63. r.POST("/store/list", agentHdl.UserStoreList)
  64. r.POST("/store/save", agentHdl.UserStoreSave)
  65. r.POST("/store/order", agentHdl.UserStoreOrder)
  66. r.POST("/store/order/pay", agentHdl.UserStoreOrderPay)
  67. r.POST("/store/order/detail", agentHdl.UserStoreOrderDetail)
  68. r.POST("/store/total", agentHdl.UserStoreTotal)
  69. r.POST("/goods/list", agentHdl.Goods)
  70. r.POST("/goods/save", agentHdl.GoodsSave)
  71. r.POST("/goods/detail", agentHdl.GoodsDetail)
  72. r.POST("/goods/del", agentHdl.GoodsDel)
  73. r.POST("/goods/cate/list", agentHdl.GoodsCate)
  74. r.POST("/goods/cate/save", agentHdl.GoodsCateSave)
  75. r.POST("/goods/cate/show", agentHdl.GoodsCateShow)
  76. r.POST("/goods/cate/del", agentHdl.GoodsCateDel)
  77. r.POST("/store/withdraw/flow", agentHdl.StoreWithdrawFlow)
  78. r.POST("/store/withdraw/total", agentHdl.StoreWithdrawTotal)
  79. r.POST("/store/withdraw/audit", agentHdl.StoreWithdrawAudit)
  80. r.POST("/store/withdraw/all/audit", agentHdl.StoreWithdrawAuditAll)
  81. r.POST("/store/withdraw/output", agentHdl.StoreWithdrawOutPut)
  82. }
  83. func routeCommunityTeamOwnStore(r *gin.RouterGroup) {
  84. r.POST("/file/img/callback", storeHdl.FileImgCallback)
  85. r.Use(mw.DB) // 下面接口再根据mid 获取数据库名
  86. r.POST("/login", storeHdl.Login)
  87. r.POST("/login/send_sms", storeHdl.LoginSendSms)
  88. r.POST("/login/fast_in", storeHdl.LoginFastIn)
  89. r.GET("/gd/key", storeHdl.GdKey)
  90. r.Use(mw.AuthJWT)
  91. r.GET("/sub_region_list", storeHdl.GetRegionChildNode)
  92. r.POST("/sms", storeHdl.Sms)
  93. r.POST("/img/upload", storeHdl.ImgReqUpload)
  94. r.GET("/user", storeHdl.User)
  95. r.GET("/base", storeHdl.Base)
  96. r.POST("/base/set", storeHdl.BaseSet)
  97. r.GET("/info", storeHdl.UserStoreInfo)
  98. r.POST("/info/set", storeHdl.UserStoreInfoSet)
  99. r.POST("/banner/save", storeHdl.UserStoreBannerSave)
  100. r.POST("/banner/del", storeHdl.UserStoreBannerDel)
  101. r.POST("/banner/detail", storeHdl.UserStoreBannerDetail)
  102. r.POST("/banner", storeHdl.UserStoreBanner)
  103. r.GET("/audit/info", storeHdl.AuditInfo)
  104. r.POST("/audit/doing", storeHdl.AuditDoing)
  105. r.POST("/store/order", storeHdl.UserStoreOrder)
  106. r.POST("/store/order/pay", storeHdl.UserStoreOrderPay)
  107. r.POST("/store/order/detail", storeHdl.UserStoreOrderDetail)
  108. r.POST("/store/order/confirm", storeHdl.StoreOrderConfirm)
  109. r.GET("/store/amount/base", storeHdl.StoreAmountBase)
  110. r.POST("/store/amount/flow", storeHdl.StoreAmountFlow)
  111. r.POST("/store/withdraw/flow", storeHdl.StoreWithdrawFlow)
  112. r.POST("/store/withdraw/doing", storeHdl.StoreWithdrawDoing)
  113. r.POST("/store/withdraw/bind/alipay", storeHdl.StoreWithdrawBindAlipay)
  114. r.POST("/goods/list", storeHdl.Goods)
  115. r.POST("/goods/save", storeHdl.GoodsSave)
  116. r.POST("/goods/detail", storeHdl.GoodsDetail)
  117. r.POST("/goods/del", storeHdl.GoodsDel)
  118. r.GET("/qrcode/base", storeHdl.QrcodeBase)
  119. r.GET("/qrcode/pay/style", storeHdl.QrcodePayStyle)
  120. r.POST("/qrcode/list", storeHdl.Qrcode)
  121. r.POST("/qrcode/save", storeHdl.QrcodeSave)
  122. r.POST("/qrcode/del", storeHdl.QrcodeDel)
  123. r.POST("/goods/cate/list", storeHdl.GoodsCate)
  124. r.POST("/goods/cate/save", storeHdl.GoodsCateSave)
  125. r.POST("/goods/cate/show", storeHdl.GoodsCateShow)
  126. r.POST("/goods/cate/del", storeHdl.GoodsCateDel)
  127. r.POST("/agent/goods/list", storeHdl.AgentGoods)
  128. r.POST("/agent/goods/detail", storeHdl.AgentGoodsDetail)
  129. r.POST("/agent/goods/copy", storeHdl.AgentGoodsCopy)
  130. }
  131. func routeCommunityTeam(r *gin.RouterGroup) {
  132. r.Use(mw.DB) // 下面接口再根据mid 获取数据库名
  133. r.Use(mw.CheckBody) //body参数转换
  134. r.Use(mw.CheckSign) //签名校验
  135. r.Use(mw.Checker)
  136. r.GET("/style/store/scan", hdl.StyleStoreScan)
  137. r.GET("/store/scan", hdl.StoreScan)
  138. r.GET("/store/pay/scan", hdl.StorePayScan)
  139. r.POST("/store/pay/info", hdl.StorePayInfo)
  140. r.POST("/city", hdl.City)
  141. r.GET("/bank/store/cate", hdl.BankStoreCate)
  142. r.GET("/bank/store/new/cate", hdl.BankStoreNewCate)
  143. r.POST("/bank/store/list", hdl.BankStore)
  144. r.POST("/bank/store/activity", hdl.BankActivity)
  145. r.POST("/bank/store/notice", hdl.BankNotice)
  146. r.GET("/new/store/cate", hdl.NewStoreCate)
  147. r.POST("/new/store/list", hdl.NewStore)
  148. r.POST("/store", hdl.Store)
  149. r.POST("/store/like/list", hdl.StoreLike)
  150. r.GET("/goods/cate", hdl.Cate)
  151. r.POST("/goods", hdl.Goods)
  152. r.POST("/goods/sku", hdl.GoodsSku)
  153. r.POST("/coupon", hdl.Coupon)
  154. r.GET("/user", hdl.User)
  155. // 用户授权后调用的接口
  156. r.Use(mw.AuthJWT)
  157. r.POST("/coupon/receive", hdl.CouponReceive)
  158. r.POST("/store/addLike", hdl.StoreAddLike)
  159. r.POST("/store/cancelLike", hdl.StoreCancelLike)
  160. r.POST("/goods/coupon", hdl.GoodsCoupon)
  161. r.POST("/order/total", hdl.OrderTotal)
  162. r.POST("/order/create", hdl.OrderCreate)
  163. r.POST("/order/cancel", hdl.OrderCancel)
  164. r.POST("/order/confirm", hdl.OrderConfirm)
  165. r.POST("/order/coupon", hdl.OrderCoupon)
  166. r.POST("/order/list", hdl.OrderList)
  167. r.POST("/order/detail", hdl.OrderDetail)
  168. r.GET("/order/cate", hdl.OrderCate)
  169. r.POST("/pay/:payMethod/:orderType", hdl.Pay)
  170. r.POST("/pay/order/create", hdl.PayOrderCreate)
  171. r.POST("/pay/order/list", hdl.PayOrderList)
  172. r.POST("/store/order/list", hdl.StoreOrderList)
  173. r.POST("/store/order/detail", hdl.StoreOrderDetail)
  174. r.POST("/store/order/confirm", hdl.StoreOrderConfirm)
  175. r.GET("/store/order/cate", hdl.StoreOrderCate)
  176. }