siago用到的paster,coaster等类型定义,以及函数,都从core中获得,不再自己写逻辑
This commit is contained in:
		
							parent
							
								
									dfb682c027
								
							
						
					
					
						commit
						7fbc4041a3
					
				
							
								
								
									
										7
									
								
								maX.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								maX.go
									
									
									
									
									
								
							| @ -136,13 +136,12 @@ func (mxl *MaXList) RPush(sm *MaX) (Sample, error) { | |||||||
| 		mxl.List = append(mxl.List, sm) | 		mxl.List = append(mxl.List, sm) | ||||||
| 		return nil, nil | 		return nil, nil | ||||||
| 	} | 	} | ||||||
| 	return nil, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // 冒泡排序 | // 冒泡排序 | ||||||
| func (mxl *MaXList) RecursiveBubbleS(length int, ctype string) error { | func (mxl *MaXList) RecursiveBubbleS(length int, ctype string) error { | ||||||
| 	if length == 0 { | 	if length == 0 { | ||||||
| 		return nil | 		return errors.New("length is zero") | ||||||
| 	} | 	} | ||||||
| 	realLength := len(mxl.List) | 	realLength := len(mxl.List) | ||||||
| 	//FIXME:在对这个List进行排序时,List中途长度变了,就会报错: | 	//FIXME:在对这个List进行排序时,List中途长度变了,就会报错: | ||||||
| @ -166,6 +165,6 @@ func (mxl *MaXList) RecursiveBubbleS(length int, ctype string) error { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	length-- | 	length-- | ||||||
| 	mxl.RecursiveBubbleS(length, ctype) | 	err := mxl.RecursiveBubbleS(length, ctype) | ||||||
| 	return nil | 	return err | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										9
									
								
								plate.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								plate.go
									
									
									
									
									
								
							| @ -113,19 +113,22 @@ func (pl *Plate) MakeCoaster(cr *Core, period string) error { | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	cdl.RecursiveBubbleS(len(cdl.List), "asc") | 	err = cdl.RecursiveBubbleS(len(cdl.List), "asc") | ||||||
| 	setName7 := "ma7|" + setName | 	setName7 := "ma7|" + setName | ||||||
| 	setName30 := "ma30|" + setName | 	setName30 := "ma30|" + setName | ||||||
| 	mxl7, err := cr.GetRangeMaXSortedSet(setName7, pl.Count, lastTime) | 	mxl7, err := cr.GetRangeMaXSortedSet(setName7, pl.Count, lastTime) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		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) | 	mxl30, err := cr.GetRangeMaXSortedSet(setName30, pl.Count, lastTime) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	mxl30.RecursiveBubbleS(len(mxl30.List), "asc") | 	err = mxl30.RecursiveBubbleS(len(mxl30.List), "asc") | ||||||
| 	coaster := Coaster{ | 	coaster := Coaster{ | ||||||
| 		InstID:     pl.InstID, | 		InstID:     pl.InstID, | ||||||
| 		Period:     period, | 		Period:     period, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zhangkun9038@dingtalk.com
						zhangkun9038@dingtalk.com