|
@@ -3896,3 +3896,44 @@ func (r *WrSpotGroupTradeSumEx) GetDataEx() (interface{}, error) {
|
|
|
|
|
|
|
|
return sData, err
|
|
return sData, err
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// WrSpotGroupTradeSumDetail 折线图价格走势
|
|
|
|
|
+type WrSpotGroupTradeSumDetail struct {
|
|
|
|
|
+ RECKONDATE string `json:"reckondate" xorm:"'RECKONDATE'"` // 日期(yyymmdd, 如:20211031)
|
|
|
|
|
+ DELIVERYGOODSID int64 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'" form:"deliverygoodsid"` // 现货商品id
|
|
|
|
|
+ PRICE float64 `json:"price" xorm:"'PRICE'"` // 价格
|
|
|
|
|
+
|
|
|
|
|
+ LASTNUM int32 `json:"-" form:"lastnum"` // 最新多少条
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *WrSpotGroupTradeSumDetail) calc() {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *WrSpotGroupTradeSumDetail) buildSql() string {
|
|
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
|
|
+select a.*
|
|
|
|
|
+ from (select t.reckondate, t.deliverygoodsid, t.todayavgprice price, rownum cnt
|
|
|
|
|
+ from reckon_spotgrouptradesum t
|
|
|
|
|
+ where 1 = 1
|
|
|
|
|
+ and t.deliverygoodsid = %v
|
|
|
|
|
+ order by t.reckondate desc) a
|
|
|
|
|
+ where a.cnt <= %v
|
|
|
|
|
+ order by a.reckondate
|
|
|
|
|
+`
|
|
|
|
|
+ if r.LASTNUM == 0 {
|
|
|
|
|
+ r.LASTNUM = 30 // 如果没传值, 默认查最近30条
|
|
|
|
|
+ }
|
|
|
|
|
+ sqlId.FormatParam(r.DELIVERYGOODSID, r.LASTNUM)
|
|
|
|
|
+ return sqlId.String()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// GetDataEx 获取折线图价格走势
|
|
|
|
|
+func (r *WrSpotGroupTradeSumDetail) GetDataEx() (interface{}, error) {
|
|
|
|
|
+ sData := make([]WrSpotGroupTradeSumDetail, 0)
|
|
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
|
|
+ for i := range sData {
|
|
|
|
|
+ sData[i].calc()
|
|
|
|
|
+ }
|
|
|
|
|
+ return sData, err
|
|
|
|
|
+}
|