|
@@ -4150,6 +4150,7 @@ SELECT t.ID,
|
|
|
WHERE 1 = 1 and t.isshow = 1 and t.status = 20
|
|
WHERE 1 = 1 and t.isshow = 1 and t.status = 20
|
|
|
order by t.istop desc, t.updatedate desc
|
|
order by t.istop desc, t.updatedate desc
|
|
|
`
|
|
`
|
|
|
|
|
+ sqlId.AndEx("t.COLUMNID", r.COLUMNID, r.COLUMNID > 0)
|
|
|
sqlId.Page(r.Page, r.PageSize)
|
|
sqlId.Page(r.Page, r.PageSize)
|
|
|
return sqlId.String()
|
|
return sqlId.String()
|
|
|
}
|
|
}
|
|
@@ -4167,7 +4168,7 @@ func (r *WrSiteColumnDetail) GetDataByPage() (interface{}, error, int, int, int)
|
|
|
return sData, err, r.Page, r.PageSize, r.Total
|
|
return sData, err, r.Page, r.PageSize, r.Total
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// WrDeliveryGoodsSection 板块(分类)
|
|
|
|
|
|
|
+// WrDeliveryGoodsSection 走势 (分类)
|
|
|
type WrDeliveryGoodsSection struct {
|
|
type WrDeliveryGoodsSection struct {
|
|
|
SECTIONID int64 `json:"sectionid" xorm:"SECTIONID" form:"sectionid"` // 版块ID (SEQ_DELIVERYGOODSSECTION) - 自增100开始, 前面ID预留给SectionType = 1的版块1 - 云融指数
|
|
SECTIONID int64 `json:"sectionid" xorm:"SECTIONID" form:"sectionid"` // 版块ID (SEQ_DELIVERYGOODSSECTION) - 自增100开始, 前面ID预留给SectionType = 1的版块1 - 云融指数
|
|
|
SECTIONTYPE int32 `json:"sectiontype" xorm:"SECTIONTYPE"` // 版块类型 - 1:指数版块 2:普通版块
|
|
SECTIONTYPE int32 `json:"sectiontype" xorm:"SECTIONTYPE"` // 版块类型 - 1:指数版块 2:普通版块
|
|
@@ -4568,3 +4569,66 @@ func (r *WrPreSaleInfo) GetDataEx() (interface{}, error) {
|
|
|
}
|
|
}
|
|
|
return sData, err
|
|
return sData, err
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// WrReckonSpotGoodsTradeSum 价格走势
|
|
|
|
|
+type WrReckonSpotGoodsTradeSum struct {
|
|
|
|
|
+ RECKONDATE string `json:"reckondate" xorm:"'RECKONDATE'"` // 日期 格式 yyyymmdd
|
|
|
|
|
+ MARKETID int `json:"marketid" xorm:"'MARKETID'" form:"marketid"` // 市场ID
|
|
|
|
|
+ WRSTANDARDID int `json:"wrstandardid" xorm:"'WRSTANDARDID'" form:"wrstandardid"` // 现货商品ID
|
|
|
|
|
+ TRADEQTY SFLOAT64 `json:"tradeqty" xorm:"'TRADEQTY'"` // 日成交数量(当日单方向成交数量)
|
|
|
|
|
+ TRADEAMOUNT SFLOAT64 `json:"tradeamount" xorm:"'TRADEAMOUNT'"` // 日成交金额(当日单方向成交金额)
|
|
|
|
|
+ PRICE string `json:"price"` // 价格 = 日成交金额 / 日成交数量
|
|
|
|
|
+
|
|
|
|
|
+ BEGINDATE string `json:"begindate" form:"begindate"` // 开始日期(结果含开始日期) yyyymmdd
|
|
|
|
|
+ ENDDATE string `json:"enddate" form:"enddate"` // 结束日期(结果含结束日期) yyyymmdd
|
|
|
|
|
+ LastNum int `json:"-" form:"lastnum"` // 最近多少条记录
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *WrReckonSpotGoodsTradeSum) calc() {
|
|
|
|
|
+ if r.TRADEQTY > 1e-10 {
|
|
|
|
|
+ d := r.TRADEAMOUNT / r.TRADEQTY
|
|
|
|
|
+ r.PRICE = d.Round(2).string()
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *WrReckonSpotGoodsTradeSum) buildSql() string {
|
|
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
|
|
+select t.reckondate,
|
|
|
|
|
+ t.marketid,
|
|
|
|
|
+ t.wrstandardid,
|
|
|
|
|
+ sum(t.tradeqty) tradeqty,
|
|
|
|
|
+ sum(t.tradeamount) tradeamount
|
|
|
|
|
+ from reckon_spotgoodstradesum t
|
|
|
|
|
+ where 1 = 1 %v
|
|
|
|
|
+ group by t.reckondate, t.marketid, t.wrstandardid
|
|
|
|
|
+ order by t.reckondate desc
|
|
|
|
|
+`
|
|
|
|
|
+ var sqlParam utils.SQLVal
|
|
|
|
|
+ sqlParam.And("t.marketid", r.MARKETID)
|
|
|
|
|
+ sqlParam.And("t.wrstandardid", r.WRSTANDARDID)
|
|
|
|
|
+
|
|
|
|
|
+ // 格式 yyyymmdd
|
|
|
|
|
+ if len(r.BEGINDATE) > 0 {
|
|
|
|
|
+ sqlParam.JoinFormat(" and t.reckondate >= '%v'", r.BEGINDATE)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if len(r.ENDDATE) > 0 {
|
|
|
|
|
+ sqlParam.JoinFormat(" and t.reckondate <= '%v'", r.ENDDATE)
|
|
|
|
|
+ }
|
|
|
|
|
+ sqlId.FormatParam(sqlParam.String())
|
|
|
|
|
+ sqlId.Page(1, r.LastNum)
|
|
|
|
|
+ return sqlId.String()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// GetDataEx 获取价格走势
|
|
|
|
|
+func (r *WrReckonSpotGoodsTradeSum) GetDataEx() (interface{}, error) {
|
|
|
|
|
+ sData := make([]WrReckonSpotGoodsTradeSum, 0)
|
|
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
|
|
+ for i := range sData {
|
|
|
|
|
+ sData[i].calc()
|
|
|
|
|
+ sData[i].BEGINDATE = r.BEGINDATE
|
|
|
|
|
+ sData[i].ENDDATE = r.ENDDATE
|
|
|
|
|
+ }
|
|
|
|
|
+ return sData, err
|
|
|
|
|
+}
|