Пример #1
0
        /// <summary>
        /// 验证车牌
        /// </summary>
        /// <param name="context"></param>
        public void VerifyLicensePlate(HttpContext context)
        {
            var             cph    = context.Request.Params["cph"].ToString().Replace(",", ";");
            string          logid  = context.Request.Params["logid"];
            string          token  = DESEncrypt(userid, "tms&sgt#");
            string          param  = "userId=" + userid + "&token=" + token + "&vnos=" + HttpUtility.UrlEncode(cph, Encoding.UTF8);
            string          ret    = PostWebRequest(url, param, Encoding.UTF8);
            MapResponseData mapRes = JsonConvert.DeserializeObject <MapResponseData>(ret);

            if (mapRes.code == "0" || mapRes.code == "3")
            {
                res.result = true;
                res.data   = param;
                if (mapRes.code == "3")
                {
                    res.msg  = "只找到部分车的定位信息:" + mapRes.result;
                    res.data = "userId=" + userid + "&token=" + token + "&vnos="
                               + HttpUtility.UrlEncode(mapRes.result.Replace(",", ";").TrimEnd(';'), Encoding.UTF8);
                }
                if (string.IsNullOrEmpty(logid))
                {
                    Interfaces.Service.MapService serv = new Interfaces.Service.MapService();
                    serv.InsertMapLog(userid, token, cph, res.msg);
                }
            }
            else if (mapRes.code == "1" || mapRes.code == "2")
            {
                res.result = false;
                res.msg    = mapRes.des;
            }
        }
Пример #2
0
        public void Sbztcx(HttpContext context)
        {
            var    deviceNums = context.Request.Params["deviceNums"].ToString();
            string logid      = context.Request.Params["logid"];
            string token      = HttpUtility.UrlEncode(DESEncrypt(userid, "tms&sgt#"));
            string param      = "userId=" + userid + "&token=" + token + "&deviceNums=" + deviceNums;
            string ret        = PostWebRequest(url_sbztcx, param, Encoding.UTF8);
            MapResponseData_Sbztcx mapRes_Sbztcx = new MapResponseData_Sbztcx();

            mapRes_Sbztcx = JsonConvert.DeserializeObject <MapResponseData_Sbztcx>(ret);

            if (mapRes_Sbztcx.code == "0" || mapRes_Sbztcx.code == "3")
            {
                res.result = true;
                res.data   = param;
                if (mapRes_Sbztcx.code == "0")
                {
                    //res.msg = mapRes_Sbztcx.MapResponseData_Sbztcx_mxx;
                    //res.data = "userId=" + userid + "&token=" + token + "&vnos="
                    //    + HttpUtility.UrlEncode(mapRes_Sbztcx.result.Replace(",", ";").TrimEnd(';'), Encoding.UTF8);
                    List <yw_hddz_bdsbwhEntity> list = new List <yw_hddz_bdsbwhEntity>();
                    foreach (var m in mapRes_Sbztcx.result)
                    {
                        yw_hddz_bdsbwhEntity model = new yw_hddz_bdsbwhEntity();
                        model.bdyssbh      = m.deviceNum;
                        model.deviceID     = m.deviceID;
                        model.deviceNum    = m.deviceNum;
                        model.adr          = m.adr;
                        model.odometer     = m.odometer;
                        model.onlineStatus = m.onlineStatus;
                        model.status       = m.status;
                        model.vno          = m.vno;
                        list.Add(model);
                    }
                    new Interfaces.Service.MapService().UpdateBdsbwh(list);
                }
                if (string.IsNullOrEmpty(logid))
                {
                    Interfaces.Service.MapService serv = new Interfaces.Service.MapService();
                    serv.InsertMapLog(userid, token, deviceNums, res.msg);
                }
            }
            else if (mapRes_Sbztcx.code == "1" || mapRes_Sbztcx.code == "2")
            {
                res.result = false;
                res.msg    = mapRes_Sbztcx.des;
            }
        }