项目初始化后续改动
This commit is contained in:
1 parent
40c702883c
commit
42acf1b1cb
67 files changed
+5794
-1762
No files matched your search
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AllBase;
|
||||
@@ -35,6 +36,54 @@ namespace Work
|
||||
Addresses[a.UpId].Add(a);
|
||||
}
|
||||
}
|
||||
|
||||
#region 获取阿里巴巴省市县区的地址
|
||||
public static Dictionary<int, List<AddressBase>> Addressdic = new Dictionary<int, List<AddressBase>>();
|
||||
public static List<AddressBase> AddressAllList = new List<AddressBase>();
|
||||
public void getAddress1688()
|
||||
{
|
||||
//Thread.Sleep(2000);
|
||||
string file = FileBase.ReadAllText("1688_address.tjm", Encoding.UTF8);
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
MessageBox.Show("初始化1688址信息错误,请检查网络", "提示");
|
||||
return;
|
||||
}
|
||||
string strContent = FileBase.ReadAllText("1688_address.tjm");
|
||||
strContent = GetHtml.UrlDecode(strContent);
|
||||
var m = BaseRegex.GetMatchRegex(ref strContent, @"{[^}]+?}");
|
||||
for (int i = 0; m != null && i < m.Count; i++)
|
||||
{
|
||||
string addressContent = m[i].Groups[0].Value;
|
||||
AddressBase a = new AddressBase();
|
||||
string[] addressArray = addressContent.Split(',');
|
||||
for (int j = 0; j < addressArray.Length; j++)
|
||||
{
|
||||
var itemMatch = BaseRegex.GetMatchRegex(ref addressArray[j], @"([\w\W]+?):([\w\W]+)");
|
||||
string itemname = itemMatch[0].Groups[1].Value.Replace("{", "");
|
||||
string itemvalue = itemMatch[0].Groups[2].Value.Replace("\"", "").Replace("}", "");
|
||||
if (itemname == "a")
|
||||
{
|
||||
a.Id = int.Parse(itemvalue);
|
||||
}
|
||||
if (itemname == "n")
|
||||
{
|
||||
a.Name = itemvalue;
|
||||
}
|
||||
if (itemname == "p")
|
||||
{
|
||||
a.UpId = int.Parse(itemvalue);
|
||||
}
|
||||
}
|
||||
AddressAllList.Add(a);
|
||||
if (!Addressdic.ContainsKey(a.Id))
|
||||
Addressdic.Add(a.Id, new List<AddressBase>());
|
||||
if (!Addressdic.ContainsKey(a.UpId))
|
||||
Addressdic.Add(a.UpId, new List<AddressBase>());
|
||||
Addressdic[a.UpId].Add(a);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class AddressBase
|
||||
|
||||
Reference in new issue
Block a user