Compare commits

...

2 Commits

Author SHA1 Message Date
zhangkun9038@dingtalk.com
3b667443c2 readme 2025-02-15 01:07:48 +08:00
zhangkun9038@dingtalk.com
7fbc4041a3 siago用到的paster,coaster等类型定义,以及函数,都从core中获得,不再自己写逻辑 2025-02-12 11:24:01 +08:00
3 changed files with 11 additions and 7 deletions

View File

@ -11,3 +11,5 @@ go mod tidy
go mod vendor
加入内网gitea库

7
maX.go
View File

@ -136,13 +136,12 @@ func (mxl *MaXList) RPush(sm *MaX) (Sample, error) {
mxl.List = append(mxl.List, sm)
return nil, nil
}
return nil, nil
}
// 冒泡排序
func (mxl *MaXList) RecursiveBubbleS(length int, ctype string) error {
if length == 0 {
return nil
return errors.New("length is zero")
}
realLength := len(mxl.List)
//FIXME在对这个List进行排序时List中途长度变了就会报错
@ -166,6 +165,6 @@ func (mxl *MaXList) RecursiveBubbleS(length int, ctype string) error {
}
}
length--
mxl.RecursiveBubbleS(length, ctype)
return nil
err := mxl.RecursiveBubbleS(length, ctype)
return err
}

View File

@ -113,19 +113,22 @@ func (pl *Plate) MakeCoaster(cr *Core, period string) error {
if err != nil {
return err
}
cdl.RecursiveBubbleS(len(cdl.List), "asc")
err = cdl.RecursiveBubbleS(len(cdl.List), "asc")
setName7 := "ma7|" + setName
setName30 := "ma30|" + setName
mxl7, err := cr.GetRangeMaXSortedSet(setName7, pl.Count, lastTime)
if err != nil {
return err
}
mxl7.RecursiveBubbleS(len(mxl7.List), "asc")
err = mxl7.RecursiveBubbleS(len(mxl7.List), "asc")
if err != nil {
return err
}
mxl30, err := cr.GetRangeMaXSortedSet(setName30, pl.Count, lastTime)
if err != nil {
return err
}
mxl30.RecursiveBubbleS(len(mxl30.List), "asc")
err = mxl30.RecursiveBubbleS(len(mxl30.List), "asc")
coaster := Coaster{
InstID: pl.InstID,
Period: period,