|
|
@@ -6,6 +6,7 @@ import (
|
|
|
"mtp2_if/global/e"
|
|
|
"mtp2_if/logger"
|
|
|
"mtp2_if/models"
|
|
|
+ "mtp2_if/mtpcache"
|
|
|
"mtp2_if/utils"
|
|
|
"net/http"
|
|
|
"strings"
|
|
|
@@ -178,54 +179,54 @@ func QueryQuoteDay(c *gin.Context) {
|
|
|
}
|
|
|
for _, v := range quoteDays {
|
|
|
// 获取对应的商品信息
|
|
|
- goods, _ := models.GetGoodsByGoodsCode(v.Goodscode)
|
|
|
- if goods != nil {
|
|
|
+ goods, bFind := mtpcache.GetGoods(v.Goodscode)
|
|
|
+ if bFind {
|
|
|
rsp = append(rsp, QueryQuoteDayRsp{
|
|
|
Exchangedate: v.Exchangedate,
|
|
|
Goodscode: v.Goodscode,
|
|
|
Exchangecode: v.Exchangecode,
|
|
|
- Preclose: utils.IntToFloat64(int(v.Preclose), int(goods.Decimalplace)),
|
|
|
+ Preclose: utils.IntToFloat64(int(v.Preclose), int(goods.DECIMALPLACE)),
|
|
|
Opentime: time.Unix(int64(v.Opentime), 0),
|
|
|
- Opened: utils.IntToFloat64(int(v.Opened), int(goods.Decimalplace)),
|
|
|
- Highest: utils.IntToFloat64(int(v.Highest), int(goods.Decimalplace)),
|
|
|
- Lowest: utils.IntToFloat64(int(v.Lowest), int(goods.Decimalplace)),
|
|
|
+ Opened: utils.IntToFloat64(int(v.Opened), int(goods.DECIMALPLACE)),
|
|
|
+ Highest: utils.IntToFloat64(int(v.Highest), int(goods.DECIMALPLACE)),
|
|
|
+ Lowest: utils.IntToFloat64(int(v.Lowest), int(goods.DECIMALPLACE)),
|
|
|
Lasttime: v.Lasttime,
|
|
|
Utclasttime: time.Unix(int64(v.Utclasttime), 0),
|
|
|
- Last: utils.IntToFloat64(int(v.Last), int(goods.Decimalplace)),
|
|
|
+ Last: utils.IntToFloat64(int(v.Last), int(goods.DECIMALPLACE)),
|
|
|
Lastvolume: v.Lastvolume,
|
|
|
Lastturnover: float64(v.Lastturnover),
|
|
|
Totalbidvolume: v.Totalbidvolume,
|
|
|
Totalaskvolume: v.Totalaskvolume,
|
|
|
Totalvolume: v.Totalvolume,
|
|
|
Totalturnover: float64(v.Totalturnover),
|
|
|
- Bid: utils.IntToFloat64(int(v.Bid), int(goods.Decimalplace)),
|
|
|
- Bid2: utils.IntToFloat64(int(v.Bid2), int(goods.Decimalplace)),
|
|
|
- Bid3: utils.IntToFloat64(int(v.Bid3), int(goods.Decimalplace)),
|
|
|
- Bid4: utils.IntToFloat64(int(v.Bid4), int(goods.Decimalplace)),
|
|
|
- Bid5: utils.IntToFloat64(int(v.Bid5), int(goods.Decimalplace)),
|
|
|
+ Bid: utils.IntToFloat64(int(v.Bid), int(goods.DECIMALPLACE)),
|
|
|
+ Bid2: utils.IntToFloat64(int(v.Bid2), int(goods.DECIMALPLACE)),
|
|
|
+ Bid3: utils.IntToFloat64(int(v.Bid3), int(goods.DECIMALPLACE)),
|
|
|
+ Bid4: utils.IntToFloat64(int(v.Bid4), int(goods.DECIMALPLACE)),
|
|
|
+ Bid5: utils.IntToFloat64(int(v.Bid5), int(goods.DECIMALPLACE)),
|
|
|
Bidvolume: v.Bidvolume,
|
|
|
Bidvolume2: v.Bidvolume2,
|
|
|
Bidvolume3: v.Bidvolume3,
|
|
|
Bidvolume4: v.Bidvolume4,
|
|
|
Bidvolume5: v.Bidvolume5,
|
|
|
- Ask: utils.IntToFloat64(int(v.Ask), int(goods.Decimalplace)),
|
|
|
- Ask2: utils.IntToFloat64(int(v.Ask2), int(goods.Decimalplace)),
|
|
|
- Ask3: utils.IntToFloat64(int(v.Ask3), int(goods.Decimalplace)),
|
|
|
- Ask4: utils.IntToFloat64(int(v.Ask4), int(goods.Decimalplace)),
|
|
|
- Ask5: utils.IntToFloat64(int(v.Ask5), int(goods.Decimalplace)),
|
|
|
+ Ask: utils.IntToFloat64(int(v.Ask), int(goods.DECIMALPLACE)),
|
|
|
+ Ask2: utils.IntToFloat64(int(v.Ask2), int(goods.DECIMALPLACE)),
|
|
|
+ Ask3: utils.IntToFloat64(int(v.Ask3), int(goods.DECIMALPLACE)),
|
|
|
+ Ask4: utils.IntToFloat64(int(v.Ask4), int(goods.DECIMALPLACE)),
|
|
|
+ Ask5: utils.IntToFloat64(int(v.Ask5), int(goods.DECIMALPLACE)),
|
|
|
Askvolume: v.Askvolume,
|
|
|
Askvolume2: v.Askvolume2,
|
|
|
Askvolume3: v.Askvolume3,
|
|
|
Askvolume4: v.Askvolume4,
|
|
|
Askvolume5: v.Askvolume5,
|
|
|
- Presettle: utils.IntToFloat64(int(v.Presettle), int(goods.Decimalplace)),
|
|
|
- Settle: utils.IntToFloat64(int(v.Settle), int(goods.Decimalplace)),
|
|
|
+ Presettle: utils.IntToFloat64(int(v.Presettle), int(goods.DECIMALPLACE)),
|
|
|
+ Settle: utils.IntToFloat64(int(v.Settle), int(goods.DECIMALPLACE)),
|
|
|
Preholdvolume: v.Preholdvolume,
|
|
|
Holdvolume: v.Holdvolume,
|
|
|
- Averageprice: utils.IntToFloat64(int(v.Averageprice), int(goods.Decimalplace)),
|
|
|
+ Averageprice: utils.IntToFloat64(int(v.Averageprice), int(goods.DECIMALPLACE)),
|
|
|
Orderid: v.Orderid,
|
|
|
- Limitup: utils.IntToFloat64(int(v.Limitup), int(goods.Decimalplace)),
|
|
|
- Limitdown: utils.IntToFloat64(int(v.Limitdown), int(goods.Decimalplace)),
|
|
|
+ Limitup: utils.IntToFloat64(int(v.Limitup), int(goods.DECIMALPLACE)),
|
|
|
+ Limitdown: utils.IntToFloat64(int(v.Limitdown), int(goods.DECIMALPLACE)),
|
|
|
Inventory: v.Inventory,
|
|
|
Holdincrement: v.Holdincrement,
|
|
|
Iscleared: v.Iscleared,
|
|
|
@@ -244,7 +245,7 @@ func QueryQuoteDay(c *gin.Context) {
|
|
|
Askorderid5: v.Askorderid5,
|
|
|
Lastlot: v.Lastlot,
|
|
|
Totallot: v.Totallot,
|
|
|
- Strikeprice: utils.IntToFloat64(int(v.Strikeprice), int(goods.Decimalplace)),
|
|
|
+ Strikeprice: utils.IntToFloat64(int(v.Strikeprice), int(goods.DECIMALPLACE)),
|
|
|
Cleartime: v.Cleartime,
|
|
|
Calloptionpremiums: v.Calloptionpremiums,
|
|
|
Calloptionpremiums2: v.Calloptionpremiums2,
|
|
|
@@ -261,24 +262,24 @@ func QueryQuoteDay(c *gin.Context) {
|
|
|
Nontotalturnover: v.Nontotalturnover,
|
|
|
Nontotallot: v.Nontotallot,
|
|
|
Publictradetype: v.Publictradetype,
|
|
|
- Iep: utils.IntToFloat64(int(v.Iep), int(goods.Decimalplace)),
|
|
|
- Iev: utils.IntToFloat64(int(v.Iev), int(goods.Decimalplace)),
|
|
|
- Grepmarketprice: utils.IntToFloat64(int(v.Grepmarketprice), int(goods.Decimalplace)),
|
|
|
- Bid6: utils.IntToFloat64(int(v.Bid6), int(goods.Decimalplace)),
|
|
|
- Bid7: utils.IntToFloat64(int(v.Bid7), int(goods.Decimalplace)),
|
|
|
- Bid8: utils.IntToFloat64(int(v.Bid8), int(goods.Decimalplace)),
|
|
|
- Bid9: utils.IntToFloat64(int(v.Bid9), int(goods.Decimalplace)),
|
|
|
- Bid10: utils.IntToFloat64(int(v.Bid10), int(goods.Decimalplace)),
|
|
|
+ Iep: utils.IntToFloat64(int(v.Iep), int(goods.DECIMALPLACE)),
|
|
|
+ Iev: utils.IntToFloat64(int(v.Iev), int(goods.DECIMALPLACE)),
|
|
|
+ Grepmarketprice: utils.IntToFloat64(int(v.Grepmarketprice), int(goods.DECIMALPLACE)),
|
|
|
+ Bid6: utils.IntToFloat64(int(v.Bid6), int(goods.DECIMALPLACE)),
|
|
|
+ Bid7: utils.IntToFloat64(int(v.Bid7), int(goods.DECIMALPLACE)),
|
|
|
+ Bid8: utils.IntToFloat64(int(v.Bid8), int(goods.DECIMALPLACE)),
|
|
|
+ Bid9: utils.IntToFloat64(int(v.Bid9), int(goods.DECIMALPLACE)),
|
|
|
+ Bid10: utils.IntToFloat64(int(v.Bid10), int(goods.DECIMALPLACE)),
|
|
|
Bidvolume6: v.Bidvolume6,
|
|
|
Bidvolume7: v.Bidvolume7,
|
|
|
Bidvolume8: v.Bidvolume8,
|
|
|
Bidvolume9: v.Bidvolume9,
|
|
|
Bidvolume10: v.Bidvolume10,
|
|
|
- Ask6: utils.IntToFloat64(int(v.Ask6), int(goods.Decimalplace)),
|
|
|
- Ask7: utils.IntToFloat64(int(v.Ask7), int(goods.Decimalplace)),
|
|
|
- Ask8: utils.IntToFloat64(int(v.Ask8), int(goods.Decimalplace)),
|
|
|
- Ask9: utils.IntToFloat64(int(v.Ask9), int(goods.Decimalplace)),
|
|
|
- Ask10: utils.IntToFloat64(int(v.Ask10), int(goods.Decimalplace)),
|
|
|
+ Ask6: utils.IntToFloat64(int(v.Ask6), int(goods.DECIMALPLACE)),
|
|
|
+ Ask7: utils.IntToFloat64(int(v.Ask7), int(goods.DECIMALPLACE)),
|
|
|
+ Ask8: utils.IntToFloat64(int(v.Ask8), int(goods.DECIMALPLACE)),
|
|
|
+ Ask9: utils.IntToFloat64(int(v.Ask9), int(goods.DECIMALPLACE)),
|
|
|
+ Ask10: utils.IntToFloat64(int(v.Ask10), int(goods.DECIMALPLACE)),
|
|
|
Askvolume6: v.Askvolume6,
|
|
|
Askvolume7: v.Askvolume7,
|
|
|
Askvolume8: v.Askvolume8,
|
|
|
@@ -309,6 +310,6 @@ func QueryQuoteDay(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
// 查询成功
|
|
|
- logger.GetLogger().Debugln("QueryQuoteDay successed: %v", rsp)
|
|
|
+ logger.GetLogger().Debugln("QueryQuoteDay successed, rows: %v", len(rsp))
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, rsp)
|
|
|
}
|