Esempio n. 1
0
        /// <summary>
        /// 获取四级地址
        /// </summary>
        /// <returns></returns>
        public ThirdResponse <Jinher.AMP.BTP.Deploy.CustomDTO.JD.AreaDTO> GetTownExt(string Code)
        {
            ThirdResponse <Jinher.AMP.BTP.Deploy.CustomDTO.JD.AreaDTO> res = new ThirdResponse <Deploy.CustomDTO.JD.AreaDTO>();

            try
            {
                Jinher.AMP.BTP.Deploy.CustomDTO.JD.AreaDTO        Areadto = new Deploy.CustomDTO.JD.AreaDTO();
                List <Jinher.AMP.BTP.Deploy.CustomDTO.JD.AreaDto> objlist = new List <Deploy.CustomDTO.JD.AreaDto>();
                string objstr = JdHelper.GetTown(Code);
                if (!string.IsNullOrEmpty(objstr))
                {
                    JObject obj = JObject.Parse(objstr);
                    if (obj.Count > 0)
                    {
                        foreach (var item in obj)
                        {
                            Jinher.AMP.BTP.Deploy.CustomDTO.JD.AreaDto model = new Deploy.CustomDTO.JD.AreaDto();
                            model.Name = item.Key;
                            model.Code = item.Value.ToString();
                            objlist.Add(model);
                        }
                    }
                    Areadto.Count = objlist.Count();
                    Areadto.Data  = objlist;

                    res.Code   = 200;
                    res.Result = Areadto;
                    res.Msg    = "查询成功!";
                }
                else
                {
                    res.Code   = 200;
                    res.Result = Areadto;
                    res.Msg    = "查询成功!";
                }
            }
            catch (Exception ex)
            {
                res.Code   = 200;
                res.Result = new Deploy.CustomDTO.JD.AreaDTO();
                res.Msg    = ex.Message;
            }
            return(res);
        }