Simon Zhou 5 роки тому
батько
коміт
b7841d087d
4 змінених файлів з 7 додано та 4 видалено
  1. 1 1
      controllers/cptrade/cpTrade.go
  2. 1 3
      go.mod
  3. 2 0
      go.sum
  4. 3 0
      routers/router.go

+ 1 - 1
controllers/cptrade/cpTrade.go

@@ -139,7 +139,7 @@ type Cptradeusergoodsdata struct {
 	Goodsid        int64   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID
 	Wrstandardid   int64   `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`              // 仓单标准ID
 	Userid         int64   `json:"userid"  xorm:"'USERID'"`                          // 用户ID
-	Inqty          int64   `json:"inqty"  xorm:"'INQTY'"`                            // 转入量
+	Inqty          int64   `json:"inqty"  xorm:"'INQTY'"`                            // 转入量(总数量)
 	Cancelqty      int64   `json:"cancelqty"  xorm:"'CANCELQTY'"`                    // 注销量
 	Deliveryqty    int64   `json:"deliveryqty"  xorm:"'DELIVERYQTY'"`                // 交割量
 	Curpresaleqty  int64   `json:"curpresaleqty"  xorm:"'CURPRESALEQTY'"`            // 当前预售量

+ 1 - 3
go.mod

@@ -12,7 +12,6 @@ require (
 	github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
 	github.com/beevik/etree v1.1.0
 	github.com/bndr/gotabulate v1.1.2 // indirect
-	github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
 	github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
 	github.com/fatih/structs v1.1.0 // indirect
 	github.com/gin-gonic/gin v1.6.3
@@ -38,8 +37,6 @@ require (
 	github.com/syndtr/goleveldb v1.0.0 // indirect
 	github.com/tealeg/xlsx v1.0.5 // indirect
 	github.com/tebeka/strftime v0.1.3 // indirect
-	github.com/urfave/cli v1.22.4 // indirect
-	github.com/urfave/cli/v2 v2.2.0 // indirect
 	github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be // indirect
 	github.com/xormplus/core v0.0.0-20200308074340-f3bce19d5f31
 	github.com/xormplus/xorm v0.0.0-20200529061552-7d0d26c6f81c
@@ -47,4 +44,5 @@ require (
 	golang.org/x/tools v0.0.0-20200612220849-54c614fe050c // indirect
 	gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 // indirect
 	gopkg.in/yaml.v2 v2.3.0 // indirect
+	github.com/gin-contrib/cors v1.3.1
 )

+ 2 - 0
go.sum

@@ -59,6 +59,8 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA=
+github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk=
 github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
 github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
 github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=

+ 3 - 0
routers/router.go

@@ -7,6 +7,7 @@ import (
 	"mtp2_if/token"
 	"time"
 
+	"github.com/gin-contrib/cors"
 	"github.com/gin-gonic/gin"
 
 	// Swagger生成的文档
@@ -23,6 +24,8 @@ func InitRouter() *gin.Engine {
 	r.Use(ginLoggerMiddleware())
 	// 设置奔溃中间件
 	r.Use(ginRecoveryMiddleware())
+	// 跨域.
+	r.Use(cors.Default())
 	// Swagger
 	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))