/// <summary> /// 获取作业信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public static dto_Zy GetZy(int id) { dto_Zy tempresult = null; string key = RedisHelper.GetEasyZyRedisKey(CacheCatalog.Zy, id.ToString()); using (var client = RedisHelper.Instance.GetRedisClient(CacheCatalog.Zy.ToString())) { if (client != null) { tempresult = client.Get <dto_Zy>(key); if (tempresult == null) { T_Zy z = B_Zy.GetZy(id); string subName = ""; Subjects.TryGetValue(z.SubjectId, out subName); tempresult = new dto_Zy() { Id = z.Id, UserId = z.UserId, ZyName = z.ZyName, Type = z.Type, CourseId = z.CourseId, SubjectId = z.SubjectId, CreateDate = z.CreateDate, OpenDate = z.OpenDate, DueDate = z.DueDate, OpenDateStr = z.OpenDate.ToString("yyyy-MM-dd HH:mm:ss"), DueDateStr = z.DueDate.ToString("yyyy-MM-dd HH:mm:ss"), SubjectName = subName, TypeName = z.Type == 0 ? "题库" : "自传", Status = z.Status }; if (tempresult != null) { client.Set(key, tempresult, ts); } } } } return(tempresult); }
/// <summary> /// 获取作业的试题json信息 /// </summary> /// <param name="zyId"></param> /// <returns></returns> public static string GetQdbZyQuesJson(int zyId) { string tempresult = null; string key = RedisHelper.GetEasyZyRedisKey(CacheCatalog.QdbZyQues, zyId.ToString()); using (var client = RedisHelper.Instance.GetRedisClient(CacheCatalog.QdbZyQues.ToString())) { if (client != null) { tempresult = client.Get <string>(key); if (tempresult == null) { tempresult = B_Zy.GetQdbZyQues(zyId); if (tempresult != null) { client.Set(key, tempresult, ts); } } } } return(tempresult); }