zhou.xiaoning 3 éve
szülő
commit
dfc259ca87
5 módosított fájl, 31 hozzáadás és 5 törlés
  1. 1 0
      controllers/wrTrade2/qryWrTrade.go
  2. 6 0
      docs/docs.go
  3. 10 0
      docs/swagger.json
  4. 7 0
      docs/swagger.yaml
  5. 7 5
      models/wrTrade2.go

+ 1 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -755,6 +755,7 @@ func QueryWrPreSaleInfo(c *gin.Context) {
 // @Param begindate query string false "开始交易日(yyyymmdd)"
 // @Param enddate query string false "结束交易日(yyyymmdd)"
 // @param lastnum query int false "最近多少条记录(按交易日倒序)"
+// @param istoday query bool false "是否今日"
 // @Success 200 {array} models.WrReckonSpotGoodsTradeSum
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrReckonSpotGoodsTradeSum [get]

+ 6 - 0
docs/docs.go

@@ -14160,6 +14160,12 @@ var doc = `{
                         "description": "最近多少条记录(按交易日倒序)",
                         "name": "lastnum",
                         "in": "query"
+                    },
+                    {
+                        "type": "boolean",
+                        "description": "是否今日",
+                        "name": "istoday",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 10 - 0
docs/swagger.json

@@ -14144,6 +14144,12 @@
                         "description": "最近多少条记录(按交易日倒序)",
                         "name": "lastnum",
                         "in": "query"
+                    },
+                    {
+                        "type": "boolean",
+                        "description": "是否今日",
+                        "name": "istoday",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -38168,6 +38174,10 @@
                     "description": "结束日期(结果含结束日期) yyyymmdd",
                     "type": "string"
                 },
+                "istoday": {
+                    "description": "是否当日",
+                    "type": "boolean"
+                },
                 "marketid": {
                     "description": "市场ID",
                     "type": "integer"

+ 7 - 0
docs/swagger.yaml

@@ -17411,6 +17411,9 @@ definitions:
       enddate:
         description: 结束日期(结果含结束日期) yyyymmdd
         type: string
+      istoday:
+        description: 是否当日
+        type: boolean
       marketid:
         description: 市场ID
         type: integer
@@ -29219,6 +29222,10 @@ paths:
         in: query
         name: lastnum
         type: integer
+      - description: 是否今日
+        in: query
+        name: istoday
+        type: boolean
       produces:
       - application/json
       responses:

+ 7 - 5
models/wrTrade2.go

@@ -4665,6 +4665,7 @@ type WrReckonSpotGoodsTradeSum struct {
 	ENDDATE   string `json:"enddate" form:"enddate"`     // 结束日期(结果含结束日期) yyyymmdd
 	LastNum   int    `json:"-" form:"lastnum"`           // 最近多少条记录
 
+	ISTODAY bool `json:"istoday" form:"istoday"` // 是否当日
 }
 
 func (r *WrReckonSpotGoodsTradeSum) calc() {
@@ -4717,7 +4718,7 @@ func (r *WrReckonSpotGoodsTradeSum) buildSqlByToday(today string) string {
 	from WRTrade_TradeDetail t
 	left join WRFactorType w on w.WRFactorTypeID = t.WRFactorTypeID
 	where t.marketid = %v and w.wrstandardid = %v 
-	order by t.TradeTime desc)
+	order by t.WRTradeDetailID desc)
 	select distinct 
 		t.RECKONDATE, 
 		t.marketid, 
@@ -4735,11 +4736,11 @@ func (r *WrReckonSpotGoodsTradeSum) buildSqlByToday(today string) string {
 func (r *WrReckonSpotGoodsTradeSum) GetDataEx() (interface{}, error) {
 	sql := r.buildSql()
 	// 判断是否获取今日走势
-	if r.MARKETID > 0 && r.ENDDATE != "" {
+	if r.MARKETID > 0 && r.ISTODAY {
 		if marketRun, err := GetMarketRun(r.MARKETID); err == nil {
-			if marketRun.Tradedate == r.ENDDATE {
-				sql = r.buildSqlByToday(marketRun.Tradedate)
-			}
+			sql = r.buildSqlByToday(marketRun.Tradedate)
+		} else {
+			return nil, errors.New("数据异常")
 		}
 	}
 
@@ -4749,6 +4750,7 @@ func (r *WrReckonSpotGoodsTradeSum) GetDataEx() (interface{}, error) {
 		sData[i].calc()
 		sData[i].BEGINDATE = r.BEGINDATE
 		sData[i].ENDDATE = r.ENDDATE
+		sData[i].ISTODAY = r.ISTODAY
 	}
 	return sData, err
 }