duxin 2 жил өмнө
parent
commit
e2b77261cd

+ 2 - 4
src/jfw/jyutil/classroomiInfo.go

@@ -84,10 +84,8 @@ func init() {
 // Course 剑鱼课堂首页课程 & 帮助中心热门视频 classify:0:中标比听课视频 1:帮助中心视频(获取所有)
 // Course 剑鱼课堂首页课程 & 帮助中心热门视频 classify:0:中标比听课视频 1:帮助中心视频(获取所有)
 func Course(num, iType int) *[]map[string]interface{} {
 func Course(num, iType int) *[]map[string]interface{} {
 	if data := redis.Get("other", fmt.Sprintf("course_%d_%d", num, iType)); data != nil {
 	if data := redis.Get("other", fmt.Sprintf("course_%d_%d", num, iType)); data != nil {
-		dataMap, _ := data.([]interface{})
-		log.Println("other,course", len(dataMap))
-		_d := util.ObjArrToMapArr(dataMap)
-		return &_d
+		dataMap := IterToMap(data)
+		return &dataMap
 	}
 	}
 	//热门课程
 	//热门课程
 	/*var HotCourse *[]map[string]interface{}
 	/*var HotCourse *[]map[string]interface{}

+ 7 - 0
src/jfw/jyutil/jyutil.go

@@ -250,3 +250,10 @@ func Http_M(hrefType, href, contentType, param string, timeout int) (map[string]
 	t2 := time.Now().UnixNano()
 	t2 := time.Now().UnixNano()
 	return resData, resp.StatusCode, t2 - t1
 	return resData, resp.StatusCode, t2 - t1
 }
 }
+
+func IterToMap(obj interface{}) []map[string]interface{} {
+	m := []map[string]interface{}{}
+	j, _ := json.Marshal(obj)
+	_ = json.Unmarshal(j, &m)
+	return m
+}