public int ServerRun() { LastServerRunTime = Environment.TickCount; int hdlGoodNum = 0; try { var goodList = appInterface.GetGoodList(); var list = appInterface.GetNeedHandle(); foreach (var goodItem in list) { var goodDetailRaw = appInterface.GetGoodDetail(goodItem); if (goodDetailRaw != null) { var goodDetail = goodDetailRaw.equip; var good = new Goods.Goods(new Server(goodDetail.serverid.ToString(), goodDetail.server_name, goodDetail.areaid.ToString(), goodDetail.area_name, ""), goodDetail.equip_name, goodDetail.game_ordersn, goodDetail.equip_desc, goodDetail.equip_detail_url) { Price = goodDetail.price_desc, GoodCreate = DateTime.Parse(goodDetail.create_time), BookStatus = goodDetail.status_desc, Rank = goodDetail.level_desc }; good.CheckAndSubmit(); hdlGoodNum++; } } } catch (GoodListNoDataException ex) { Server.ExitAftert($"#:{ex.Message}"); Program.anyTaskWorking = false; return(-1); } try { #region 暂时关闭 if (Program.vpsStatus == Program.VpsStatus.Idle || Program.vpsStatus == Program.VpsStatus.WaitConnect) { Program.anyTaskWorking = false; return(0); } //Program.setting.threadSetting.Status = string.Format("{1}次: {0}", "App接口", runTimeRecord); #endregion } catch (Exception ex) { Program.Tcp?.Send(new RpClientWaitMessage(0, 0, -1)); Server.ExitAftert($"处理结束后发生异常:{ex.Message}"); Program.anyTaskWorking = false; return(0); } return(hdlGoodNum); }
private void HdlResult(string info) { var firstGoodInfoRaw = HttpUtil.GetElement(info, "generate_tips(", ")"); if (firstGoodInfoRaw == null) { if (info.Contains("为了您的帐号安全,请登录之后继续访问")) { ExitAftert("需登录 失败"); } else if (info.Contains("请输入验证码")) { ExitAftert("需验证码 失败"); } else if (info.Contains("系统繁忙")) { ExitAftert("系统繁忙 失败"); } else if (info.Contains("该服务器已被合服")) { ExitAftert("已合服"); } else if (info.Contains("请输入正确的服务器名称")) { ExitAftert("服务器名称无效"); } else { ExitAftert("加载页面失败."); Logger.SysLog(info + "\n\n\n\n\n", "PageRaw"); } return; } var firstGoodInfo = firstGoodInfoRaw.Split(new string[] { ", " }, StringSplitOptions.None); var firstGoodBookStatus = HttpUtil.GetElement(info, "<script>gen_bookind_btn(", ")"); var firstGoodId = firstGoodInfo[1].Trim('\''); var firstGoodName = firstGoodInfo[2].Trim('\''); var firstGoodDetail = HttpUtil.GetElement(info, "<textarea id=\"large_equip_desc_", "/textarea>"); firstGoodDetail = HttpUtil.GetElement(firstGoodDetail, ">", "<").Replace('\n', ' '); var firstGoodBookStatusInfo = firstGoodBookStatus.Split(new string[] { ", " }, StringSplitOptions.None); var firstGoodRank = HttpUtil.GetElement(info, "data_equip_level_desc=\"", "\""); firstGoodRank = firstGoodRank.Substring(2); var firstGood = new Goods.Goods(this, firstGoodName, firstGoodId, firstGoodDetail, HttpUtil.GetElement(info, "text-decoration:none;\" href=\"", "\"")) { BookStatus = firstGoodBookStatusInfo[2], Price = firstGoodBookStatusInfo[1], Rank = firstGoodRank }; firstGood.CheckAndSubmit(); }