public ActionResult AddAgentInfo(ExtensionAgents extensionAgents) { extensionAgents.SubTime = DateTime.Now; extensionAgents.ModifiedOn = DateTime.Now; extensionAgents.Sort = "0"; extensionAgents.DelFlag = 0; extensionAgents.ExtensionScore = 0; if (extensionAgents.UrlName == null) { return(Content("no")); } string[] temp = extensionAgents.UrlName.Split(','); if (temp.Length != 2) { return(Content("no")); } else { extensionAgents.GUID = Guid.NewGuid().ToString("N"); extensionAgents.RouteStatisticsLinks_ID = int.Parse(temp[0]); extensionAgents.ExtensionUrl = ExtendMethord.ExUrlCreate(extensionAgents.GUID); extensionAgents.ExtensionScore = 0; extensionAgents.UrlName = temp[1]; extensionAgentsService.AddEntity(extensionAgents); Dictionary <string, string> Dic = new Dictionary <string, string> { { extensionAgents.GUID, routeStatisticsLinksService.LoadEntities(c => c.ID == extensionAgents.RouteStatisticsLinks_ID).Select(c => c.Url).FirstOrDefault() } }; if (ExtendMethord.GetUrl().URLMap != null) { ExtendMethord.GetUrl().URLMap = Dic; // 更新内存值,这里的等号相当于添加 } } return(Content("ok")); }
public ActionResult Index(string strQuery) {//strQuery为推广员的ID if (strQuery != null) { string url; try { UrlCache cache = ExtendMethord.GetUrl(); url = cache.URLMap[strQuery]; ExtendMethord.OperateScoreCacheQueue.Enqueue(new OperateScoreCache(strQuery));//增加放到队列里去做 } catch (Exception e) { UrlCache cache = new UrlCache(); url = cache.URLMap[strQuery]; ExtendMethord.OperateScoreCacheQueue.Enqueue(new OperateScoreCache(strQuery));//增加放到队列里去做 } return(Redirect(url)); } else { return(Content("链接错误!")); } }