| 
					
				 | 
			
			
				@@ -2,7 +2,9 @@ package util 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"fmt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"math" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"testing" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"time" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"github.com/stretchr/testify/assert" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -413,16 +415,107 @@ func TestDaysBetween(t *testing.T) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-func Test_demo(t *testing.T) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	ids := make([]int64, 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	defer func() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		fmt.Println(ids) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	}() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	for i := 0; i < 10; i++ { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		ids = append(ids, int64(i)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func TestGetNeckRingActiveTimer(t *testing.T) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	nowTime := time.Now().Format(Layout) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	tests := struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		frameId  []int32 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		dateTime []string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		hours    []int32 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		frameId: []int32{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			1, 2, 3, 4, 5, 6, 8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			11, 12, 13, 14, 15, 16, 18, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			21, 22, 23, 24, 25, 26, 28, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			31, 32, 33, 34, 35, 36, 38, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			41, 42, 43, 44, 45, 46, 48, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			51, 52, 53, 54, 55, 56, 58, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			61, 62, 63, 64, 65, 66, 68, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			71, 72, 73, 74, 75, 76, 78, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			81, 82, 83, 84, 85, 86, 88, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			91, 92, 93, 94, 95, 96, 98, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			101, 102, 103, 104, 105, 106, 108, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			111, 112, 113, 114, 115, 116, 118, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		hours: []int32{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			0, 0, 1, 1, 1, 2, 2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			2, 2, 3, 3, 3, 4, 4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			4, 4, 5, 5, 5, 6, 6, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			6, 6, 7, 7, 7, 8, 8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			8, 8, 9, 9, 9, 10, 10, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			10, 10, 11, 11, 11, 12, 12, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			12, 12, 13, 13, 13, 14, 14, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			14, 14, 15, 15, 15, 16, 16, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			16, 16, 17, 17, 17, 18, 18, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			18, 18, 19, 19, 19, 20, 20, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			20, 20, 21, 21, 21, 22, 22, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			22, 22, 23, 23, 23, 24, 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		dateTime: []string{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 00:20:00", nowTime), fmt.Sprintf("%s 00:40:00", nowTime), fmt.Sprintf("%s 01:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 01:20:00", nowTime), fmt.Sprintf("%s 01:40:00", nowTime), fmt.Sprintf("%s 02:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 00:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 02:20:00", nowTime), fmt.Sprintf("%s 02:40:00", nowTime), fmt.Sprintf("%s 03:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 03:20:00", nowTime), fmt.Sprintf("%s 03:40:00", nowTime), fmt.Sprintf("%s 04:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 02:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 04:20:00", nowTime), fmt.Sprintf("%s 04:40:00", nowTime), fmt.Sprintf("%s 05:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 05:20:00", nowTime), fmt.Sprintf("%s 05:40:00", nowTime), fmt.Sprintf("%s 06:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 04:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 06:20:00", nowTime), fmt.Sprintf("%s 06:40:00", nowTime), fmt.Sprintf("%s 07:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 07:20:00", nowTime), fmt.Sprintf("%s 07:40:00", nowTime), fmt.Sprintf("%s 08:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 06:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 08:20:00", nowTime), fmt.Sprintf("%s 08:40:00", nowTime), fmt.Sprintf("%s 09:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 09:20:00", nowTime), fmt.Sprintf("%s 09:40:00", nowTime), fmt.Sprintf("%s 10:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 08:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 10:20:00", nowTime), fmt.Sprintf("%s 10:40:00", nowTime), fmt.Sprintf("%s 11:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 11:20:00", nowTime), fmt.Sprintf("%s 11:40:00", nowTime), fmt.Sprintf("%s 12:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 10:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 12:20:00", nowTime), fmt.Sprintf("%s 12:40:00", nowTime), fmt.Sprintf("%s 13:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 13:20:00", nowTime), fmt.Sprintf("%s 13:40:00", nowTime), fmt.Sprintf("%s 14:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 12:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 14:20:00", nowTime), fmt.Sprintf("%s 14:40:00", nowTime), fmt.Sprintf("%s 15:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 15:20:00", nowTime), fmt.Sprintf("%s 15:40:00", nowTime), fmt.Sprintf("%s 16:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 14:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 16:20:00", nowTime), fmt.Sprintf("%s 16:40:00", nowTime), fmt.Sprintf("%s 17:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 17:20:00", nowTime), fmt.Sprintf("%s 17:40:00", nowTime), fmt.Sprintf("%s 18:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 16:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 18:20:00", nowTime), fmt.Sprintf("%s 18:40:00", nowTime), fmt.Sprintf("%s 19:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 19:20:00", nowTime), fmt.Sprintf("%s 19:40:00", nowTime), fmt.Sprintf("%s 20:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 18:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 20:20:00", nowTime), fmt.Sprintf("%s 20:40:00", nowTime), fmt.Sprintf("%s 21:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 21:20:00", nowTime), fmt.Sprintf("%s 21:40:00", nowTime), fmt.Sprintf("%s 22:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 22:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 22:20:00", nowTime), fmt.Sprintf("%s 22:40:00", nowTime), fmt.Sprintf("%s 23:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 23:20:00", nowTime), fmt.Sprintf("%s 23:40:00", nowTime), fmt.Sprintf("%s 24:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fmt.Sprintf("%s 24:00:00", nowTime), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	for i, frameId := range tests.frameId { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		got, hours := GetNeckRingActiveTimer(frameId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		t.Logf("frameId: %d, hours: %d, got :%s", frameId, tests.hours[i], got) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//assert.Equal(t, got, tests.dateTime[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		assert.Equal(t, int32(hours), tests.hours[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func Test_demo(t *testing.T) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	ids := []int32{1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		31, 32, 33, 34, 35, 36, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 55, 56, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		61, 62, 63, 64, 65, 66, 71, 72, 73, 74, 75, 76, 81, 82, 83, 84, 85, 86, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		91, 92, 93, 94, 95, 96, 101, 102, 103, 104, 105, 106, 111, 112, 113, 114, 115, 116} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	nowTime := time.Now() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	currHour := nowTime.Hour() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for _, v := range ids { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		fmt.Println("===v==", v) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		hours := int(math.Floor(float64(v)/10) * 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		units := int(v % 10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		minutes := units * 20 % 60 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		hours += units / 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if hours > currHour { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			hours -= 24 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		activeTime := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), hours, minutes, 0, 0, time.Now().Location()).Format(LayoutTime) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fmt.Println(v, activeTime) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |