示例#1
0
        public bool QueryRecordList(QeuryRecord qeuryRecord, ref string recordList)
        {
            try
            {
                string url = "https://openapi.lechange.cn/openapi/queryCloudRecords";

                JObject         jsonObj    = new JObject();
                System.DateTime startTime  = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
                long            time       = (long)(DateTime.Now - startTime).TotalSeconds;
                string          stringTemp = "";
                JObject         paramsList = new JObject(
                    new JProperty("token", qeuryRecord.token),
                    new JProperty("deviceId", qeuryRecord.deviceId),
                    new JProperty("channelId", qeuryRecord.channelId),
                    new JProperty("beginTime", qeuryRecord.beginTime),
                    new JProperty("endTime", qeuryRecord.endTime),
                    new JProperty("queryRange", qeuryRecord.queryRange)
                    );
                if (qeuryRecord.type != "")//查询设备本地录像片段
                {
                    url = "https://openapi.lechange.cn/openapi/queryLocalRecords";
                    paramsList.Add("type", qeuryRecord.type);
                }
                JToken jtoken  = JToken.Parse(paramsList.ToString());
                string strJson = SortJson(jtoken, null);
                paramsList = (JObject)JsonConvert.DeserializeObject(strJson);
                JObject systemList = GetSystemJsonArray(paramsList);
                jsonObj.Add("system", systemList);
                jsonObj.Add("params", paramsList);
                jsonObj.Add("id", "88");
                stringTemp = jsonObj.ToString();
                stringTemp = stringTemp.Replace("\r\n", "");

                string resultContent = GetPostRequest(url, stringTemp);
                jsonObj = (JObject)JsonConvert.DeserializeObject(resultContent);
                string errcode = jsonObj["result"]["code"].ToString();
                string errmsg  = jsonObj["result"]["msg"].ToString();
                if (errcode == "0")
                {
                    recordList = jsonObj["result"]["data"].ToString();
                    return(true);
                }
                else
                {
                    recordList = errmsg;
                }
            }
            catch (Exception ex)
            {
                int ii = 0;
            }
            return(false);
        }
示例#2
0
 //【查询远程录像片段】
 //参数-qeuryRecord	    查询参数信息
 //参数-recordList	    录像片段列表
 //返回值:		    =false获取失败
 public static bool LCOpenSDK_QueryRecordList(QeuryRecord qeuryRecord, ref string recordList)
 {
     return(https.QueryRecordList(qeuryRecord, ref recordList));
 }