public JsonResult SubmintProcressData(string dataStr)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append($"学生id:{GetCurrentUser().StudentId},操作时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")};");
            sb.AppendLine($"接收数据:{dataStr}");
            DtoStudnetUnitSubmit info = new DtoStudnetUnitSubmit();

            #region json字符串填充数据
            try
            {
                JObject data = JsonConvert.DeserializeObject(dataStr) as JObject;
                info.StudnetId = GetCurrentUser().StudentId;
                info.CoruseId  = Convert.ToInt32(data["courseId"]);                         //课程id
                info.LessonId  = Convert.ToInt32(data["lessonId"]);                         //课时id
                info.LessonNum = Convert.ToInt32(data["lessonNum"]);                        //课时序号
                info.UnitID    = Convert.ToInt32(data["unitId"]);                           //单元(讲义页)id
                string   coinKey = Encrypt.DecryptQueryString(data["coinsKey"].ToString()); //金币加密字符串
                string[] check   = coinKey.Split('_');
                //验证金币加密串是否可用
                //这个验证方式要与GetLessonPage方法中加密字符串对应
                if (check.Length == 4 && check[1] == info.UnitID.ToString() && check[2] == info.LessonId.ToString() && check[3] == info.CoruseId.ToString())
                {
                    info.AllCoin      = Convert.ToInt32(check[0]);             //本页最大金币数
                    info.UnitNum      = Convert.ToInt32(data["unitNum"]);      //单元(讲义页)序号
                    info.UseTime      = Convert.ToInt32(data["useTime"]);      //学习时长(秒)
                    info.ProgressID   = Convert.ToInt32(data["progressId"]);   //学习进度id
                    info.ProgressKey  = data["progressKey"].ToString();        //学习进度key
                    info.TotalUnitNum = Convert.ToInt32(data["totalUnitNum"]); //最大学习数
                    #region 填充答题结果
                    JArray answers = JsonConvert.DeserializeObject(data["answers"].ToString()) as JArray;
                    foreach (var a in answers)
                    {
                        info.Answers.Add(SubjectAnswerObjectBuilder.TranslateAnswer(a.ToString()));
                    }
                    #endregion
                    #region 填充金币记录
                    JArray coins = JsonConvert.DeserializeObject(data["coins"].ToString()) as JArray;
                    foreach (var c in coins)
                    {
                        JObject o = JsonConvert.DeserializeObject(c.ToString()) as JObject;
                        info.Coins.Add(new StuLessonCoinItem
                        {
                            ActionId    = o["acid"].ToString(),
                            ActionCoins = Convert.ToInt32(o["acin"]),
                            ActionType  = o["type"].ToString(),
                            GetCoins    = Convert.ToInt32(o["gcin"])
                        });
                    }
                    #endregion
                }
                else
                {
                    sb.AppendLine("回复数据:金币加密串解析错误");
                    LogHelper.ErrorLog(sb.ToString(), new Exception("金币加密串解析错误"));
                    return(Json(new JsonResponse <object>
                    {
                        State = false,
                        ErrorCode = -100,
                        ErrorMsg = "金币加密串解析错误"
                    }));
                }
            }
            catch (Exception ex)
            {
                sb.AppendLine("回复数据:json数据结构错误");
                LogHelper.ErrorLog(sb.ToString(), ex);
                return(Json(new JsonResponse <object>
                {
                    State = false,
                    ErrorCode = -200,
                    ErrorMsg = "json数据结构错误"
                }));
            }
            #endregion
            StudentStudyBll bll    = new StudentStudyBll();
            int             result = bll.SubmitStudyProgress(info);//提交数据结果
            var             r      = new JsonResponse <object>();
            #region 根据结果填充返回数据
            switch (result)
            {
            case 0:    //成功
                r.State    = true;
                r.ErrorMsg = "成功";
                break;

            case -1:    //课时进度秘钥错误
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "课时进度秘钥错误";
                break;

            case -2:    //数据重复提交
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "数据重复提交";
                break;

            case -3:    //金币数目错误
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "金币数目错误";
                break;

            default:
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "未知错误";
                break;
            }
            #endregion
            if (!r.State)
            {
                sb.AppendLine($"回复数据:{r.ErrorMsg}");
                LogHelper.ErrorLog(sb.ToString(), new Exception(r.ErrorMsg));
            }
            return(Json(r));
        }
        public void SubmintProcressData()
        {
            var dataStr = "{\"coins\":[],\"answers\":[],\"useTime\":5,\"courseId\":10000,\"lessonId\":10000,\"lessonNum\":1,\"unitId\":10000,\"unitNum\":1,\"totalUnitNum\":14,\"progressId\":10001,\"progressKey\":\"71441bd833884cc78e6ae8434e552ff1\",\"coinsKey\":\"E490AD625ABC1D994DA1F5D897591D3A0A745B468D778F7B\"}";

            DtoStudnetUnitSubmit info = new DtoStudnetUnitSubmit();

            #region json字符串填充数据
            try
            {
                JObject data = JsonConvert.DeserializeObject(dataStr) as JObject;
                info.StudnetId = 10000;
                info.CoruseId  = Convert.ToInt32(data["courseId"]);                         //课程id
                info.LessonId  = Convert.ToInt32(data["lessonId"]);                         //课时id
                info.LessonNum = Convert.ToInt32(data["lessonNum"]);                        //课时序号
                info.UnitID    = Convert.ToInt32(data["unitId"]);                           //单元(讲义页)id
                string   coinKey = Encrypt.DecryptQueryString(data["coinsKey"].ToString()); //金币加密字符串
                string[] check   = coinKey.Split('_');
                //验证金币加密串是否可用
                //这个验证方式要与GetLessonPage方法中加密字符串对应
                if (check.Length == 4 && check[1] == info.UnitID.ToString() && check[2] == info.LessonId.ToString() && check[3] == info.CoruseId.ToString())
                {
                    info.AllCoin      = Convert.ToInt32(check[0]);             //本页最大金币数
                    info.UnitNum      = Convert.ToInt32(data["unitNum"]);      //单元(讲义页)序号
                    info.UseTime      = Convert.ToInt32(data["useTime"]);      //学习时长(秒)
                    info.ProgressID   = Convert.ToInt32(data["progressId"]);   //学习进度id
                    info.ProgressKey  = data["progressKey"].ToString();        //学习进度key
                    info.TotalUnitNum = Convert.ToInt32(data["totalUnitNum"]); //最大学习数
                    #region 填充答题结果
                    JArray answers = JsonConvert.DeserializeObject(data["answers"].ToString()) as JArray;
                    foreach (var a in answers)
                    {
                        info.Answers.Add(TranslateAnswer(a.ToString()));
                    }
                    #endregion
                    #region 填充金币记录
                    JArray coins = JsonConvert.DeserializeObject(data["coins"].ToString()) as JArray;
                    foreach (var c in coins)
                    {
                        JObject o = JsonConvert.DeserializeObject(c.ToString()) as JObject;
                        info.Coins.Add(new StuLessonCoinItem
                        {
                            ActionId    = o["acid"].ToString(),
                            ActionCoins = Convert.ToInt32(o["acin"]),
                            ActionType  = o["type"].ToString(),
                            GetCoins    = Convert.ToInt32(o["gcin"])
                        });
                    }
                    #endregion
                }
                else
                {
                    throw new Exception("金币加密数据错误");
                }
            }
            catch
            {
                throw new Exception("字符串转对象错误");
            }
            #endregion
            StudentStudyBll bll    = new StudentStudyBll();
            int             result = bll.SubmitStudyProgress(info);//提交数据结果
            var             r      = new JsonResponse <object>();
            #region 根据结果填充返回数据
            switch (result)
            {
            case 0:    //成功
                r.State = true;
                break;

            case -1:    //课时进度秘钥错误
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "课时进度秘钥错误";
                break;

            case -2:    //数据重复提交
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "数据重复提交";
                break;

            case -3:    //金币数目错误
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "金币数目错误";
                break;

            default:
                r.State     = false;
                r.ErrorCode = result;
                r.ErrorMsg  = "未知错误";
                break;
            }
            #endregion
        }