diff --git a/server/marketserver/api/v1/gold_bullion/enter.go b/server/marketserver/api/v1/gold_bullion/enter.go new file mode 100644 index 00000000..66d87499 --- /dev/null +++ b/server/marketserver/api/v1/gold_bullion/enter.go @@ -0,0 +1,5 @@ +package gold_bullon + +type ApiGroup struct { + GoldBullionApi +} diff --git a/server/marketserver/api/v1/gold_bullion/gold_bullion.go b/server/marketserver/api/v1/gold_bullion/gold_bullion.go new file mode 100644 index 00000000..84f364a2 --- /dev/null +++ b/server/marketserver/api/v1/gold_bullion/gold_bullion.go @@ -0,0 +1,19 @@ +package gold_bullion + +import ( + "q5" + "f5" + "main/constant" + "main/common" + "fmt" + "strings" + . "main/global" + "github.com/gin-gonic/gin" +) + +type GoldBulloinApi struct { + +} + +func (this *GoldBulloinApi) Use(c *gin.Context) { +} diff --git a/server/marketserver/api/v1/hero/enter.go b/server/marketserver/api/v1/hero/enter.go new file mode 100644 index 00000000..2fe2599b --- /dev/null +++ b/server/marketserver/api/v1/hero/enter.go @@ -0,0 +1,5 @@ +package hero + +type ApiGroup struct { + HeroApi +} diff --git a/server/marketserver/api/v1/hero/hero.go b/server/marketserver/api/v1/hero/hero.go new file mode 100644 index 00000000..4e09fea9 --- /dev/null +++ b/server/marketserver/api/v1/hero/hero.go @@ -0,0 +1,19 @@ +package hero + +import ( + "q5" + "f5" + "main/constant" + "main/common" + "fmt" + "strings" + . "main/global" + "github.com/gin-gonic/gin" +) + +type HeroApi struct { + +} + +func (this *HeroApi) Use(c *gin.Context) { +} diff --git a/server/marketserver/api/v1/shopcart/enter.go b/server/marketserver/api/v1/shopcart/enter.go new file mode 100644 index 00000000..cbe1ce64 --- /dev/null +++ b/server/marketserver/api/v1/shopcart/enter.go @@ -0,0 +1,5 @@ +package shopcart + +type ApiGroup struct { + ShopCartApi +} diff --git a/server/marketserver/api/v1/shopcart/shopcart.go b/server/marketserver/api/v1/shopcart/shopcart.go new file mode 100644 index 00000000..20588d5a --- /dev/null +++ b/server/marketserver/api/v1/shopcart/shopcart.go @@ -0,0 +1,28 @@ +package shopcart + +import ( + "q5" + "f5" + "main/constant" + "main/common" + "fmt" + "strings" + . "main/global" + "github.com/gin-gonic/gin" +) + +type ShopCartApi struct { + +} + +func (this *ShopCartApi) ShopCartList(c *gin.Context) { +} + +func (this *ShopCartApi) ShopCartAdd(c *gin.Context) { +} + +func (this *ShopCartApi) ShopCartDel(c *gin.Context) { +} + +func (this *ShopCartApi) ShopCartClear(c *gin.Context) { +} diff --git a/server/marketserver/middleware/cors.go b/server/marketserver/middleware/cors.go new file mode 100644 index 00000000..6dc36b67 --- /dev/null +++ b/server/marketserver/middleware/cors.go @@ -0,0 +1,24 @@ +package middleware + +import ( + "github.com/gin-gonic/gin" + // "net/http" +) + +func Cors() gin.HandlerFunc { + return func(c *gin.Context) { + method := c.Request.Method + //origin := c.Request.Header.Get("Origin") + //if origin != "" { + //c.Header("Access-Control-Allow-Origin", "*") // 可将将 * 替换为指定的域名 + c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE") + c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization") + c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type") + c.Header("Access-Control-Allow-Credentials", "true") + //} + if method == "OPTIONS" { + c.AbortWithStatus(200) + } + c.Next() + } +}