This commit is contained in:
aozhiwei 2024-06-20 10:45:48 +08:00
parent 57f39bfd53
commit b3e10ff433
7 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,5 @@
package gold_bullon
type ApiGroup struct {
GoldBullionApi
}

View File

@ -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) {
}

View File

@ -0,0 +1,5 @@
package hero
type ApiGroup struct {
HeroApi
}

View File

@ -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) {
}

View File

@ -0,0 +1,5 @@
package shopcart
type ApiGroup struct {
ShopCartApi
}

View File

@ -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) {
}

View File

@ -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()
}
}