123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Threading;
- using MySystem.Models;
- using Library;
- using LitJson;
- namespace MySystem
- {
- /// <summary>
- /// 获取腾讯地图地址
- /// </summary>
- public class GetTencentAddressInfoService
- {
- public readonly static GetTencentAddressInfoService Instance = new GetTencentAddressInfoService();
- private GetTencentAddressInfoService()
- { }
- public void Start()
- {
- Thread th = new Thread(GetTencentAddress);
- th.IsBackground = true;
- th.Start();
- }
- public void GetTencentAddress()
- {
- while (true)
- {
- try
- {
- string data = RedisDbconn.Instance.RPop<string>("GetTencentAddressInfoQueue");
- JsonData jsonObj = JsonMapper.ToObject(data);
- string Address = jsonObj["Data"]["Address"].ToString();
- string Key = Library.ConfigurationManager.AppSettings["TencentKey"].ToString();
- var info = function.GetWebRequest("https://apis.map.qq.com/ws/geocoder/v1/?address=" + Address + "&key=" + Key);
- }
- catch (Exception ex)
- {
- function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "过期机具执行扣费异常");
- }
- Thread.Sleep(100000);
- }
- }
- }
- }
|