<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__Fn4kY5ypBEIId5vEJ3u">
  <name>课程进度</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>put</requestType>
  <requestUrl>/lesson/lessonProgress</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[(function () {
  //Packages.java.lang.System.err.println("================课程进度API开始=================");
  var result = new Packages.java.util.HashMap(); //创建指定类对象
  var jsonStr = getParameter("_content");
  var json = JSON.parse(jsonStr);
  var authLessonId = json["authLessonId"];
  var authrecordid = json["authrecordid"];
  var progress = json["progress"];
  var idcard = json["authUserId"];
  var sql1 = "select '" + getDomainid() + "' as domainid,id from tlk_lesson_auth_base_info where ITEM_authUserId='" + idcard + "' and ITEM_authLessonId='" + authLessonId + "' and item_isDelete!='1'";
 // Packages.java.lang.System.err.println("================sql1================="+sql1);
  var datas = queryByDSName("tms", sql1);
  if (datas.size() > 0) {
    for (var iterator = datas.iterator(); iterator.hasNext();) {
      var map1 = iterator.next();//取值
      var docids = map1.get("id");
    }
  }
 // Packages.java.lang.System.err.println("================docids================="+docids);
  result.put("msg","sss")
  result.put("docids",docids)
  result.put("authrecordid",authrecordid)
  println("-------"+docids);
  if((!"undefined".equals(docids))&&docids != null && docids != "") {
  //  Packages.java.lang.System.err.println("================进来没1=================");
    var process =  getDocumentProcess();
    println("-------"+process);
    result.put("authrecordid111",authrecordid)
    result.put("process",process)
    var Info = findDocument(docids);
    if(authrecordid  != null && authrecordid != ""){
      var applyinfo = findDocument(authrecordid);
      if(isNotNull(progress)){
        applyinfo.findItem("progress").setValue(progress)
      }
      process.doUpdate(applyinfo);
      result.put("进来2",authrecordid)
      var applyinfo = findDocument(authrecordid);
      if(isNotNull(progress)){
        applyinfo.findItem("progress").setValue(progress)
      }
      process.doUpdate(applyinfo);
      result.put("进来1",authrecordid)
    }else{

    }

    for (var key in json) {
      var value = json[key];
      if(isNotNull(key) && isNotNull(value)){
        Info.findItem(key).setValue(value);
      }
    }
    if(isNotNull(process)){
      process.doUpdate(Info);
    }
    result.put("type", "update");
    result.put("msg", "success");
    result.put("code", "0");
  } else {
    result.put("code", "-1");
    result.put("msg", "身份证和课程id不能为空");
  }
//  Packages.java.lang.System.err.println("================课程进度API结束=================");
  return result;
})()]]></responseScript>
</Api>