/// <summary> /// 查询订单返回 /// </summary> /// <param name="orderId"></param> /// <returns></returns> public static string QueryOrder(string orderId) { string url = string.Format(domain + "/rest/v1.0/order/query/access_token/{0}/sf_appid/{1}/sf_appkey/{2}", QueryAccessToken(), SFAppId, SFAppKey); MessageReq <OrderQueryReqDto> req = new MessageReq <OrderQueryReqDto>(); req.head.transType = 203; req.head.transMessageId = DateTime.Now.ToLongTimeString(); req.body = new OrderQueryReqDto(); req.body.orderId = orderId; MessageResp <OrderQueryRespDto> res = HttpWebHelper.doPost <MessageReq <OrderQueryReqDto>, MessageResp <OrderQueryRespDto> >(url, req); //return HttpWebHelper.ObjectToJson(res); if (res.head.code == "EX_CODE_OPENAPI_0105") { GetAccessToken(); QueryOrder(orderId); } if (res.head.transType == 4203) { return(res.body.mailNo); } else { throw new Exception(res.head.message); } }
/// <summary> /// Sends a scoring request and waits for the response. /// </summary> /// <param name="scoreRequest">The score request object with response info in it.</param> public ItemScoreResponse SendRequest(string url, ItemScoreRequest scoreRequest) { ItemScoreResponse scoreResponse = HttpWebHelper.SendAndReadXml <ItemScoreRequest, ItemScoreResponse>(url, scoreRequest); Log("ItemScoringClient SendRequest"); return(scoreResponse); }
public bool VoiceVerify(Dictionary <string, object> data, out string returnMessage) { string returnJsonResult = _httpWebHelper.HttpPost(API_VOICEVERIFY, data); returnMessage = returnJsonResult; return(HttpWebHelper.CheckReturnJsonStatus(returnJsonResult)); }
public bool XSend(Dictionary <string, object> data, out string returnMessage) { string retrunJsonResult = _httpWebHelper.HttpPost(API_XSEND, data); returnMessage = retrunJsonResult; return(HttpWebHelper.CheckReturnJsonStatus(retrunJsonResult)); }
public bool UnSubscribe(Dictionary <string, object> data, out string returnMessage) { string retrunJsonResult = _httpWebHelper.HttpPost(API_UNSUBSCRIBE, data); returnMessage = retrunJsonResult; return(HttpWebHelper.CheckReturnJsonStatus(retrunJsonResult)); }
public void Execute(IJobExecutionContext context) { string date = DateTime.Now.ToDateStr(); List <Comic> clst = comicmanager.Query(x => x.source == 6 && x.shortdate == date); List <Chapter> plst = new List <Chapter>(); HttpWebHelper _helper = new HttpWebHelper(); var web = new HtmlWeb(); foreach (var c in clst) { try { var data = web.Load(c.bookurl); var updatestr = data.DocumentNode.SelectSingleNode("//div[@class=\"sr-notice__text f-toe\"]").InnerText.Trim(); if (updatestr.Contains("最近更新")) { updatestr = updatestr.Substring(0, updatestr.IndexOf("最近更新")); } else { updatestr = ""; } var chapterdata = _helper.Get <wangyi_chapter>($"https://manhua.163.com/book/catalog/{c.comicid.Replace("6_", "")}.json", Encoding.GetEncoding("utf-8")); if (chapterdata.code == 200) { var t = chapterdata.catalog.sections.First(); var l = t.sections.Last(); plst.Add(new Chapter() { chapterid = c.comicid + "_" + l.sectionId, chaptername = l.title, chapterurl = $"https://manhua.163.com/reader/{l.bookId}/{l.sectionId}#imgIndex=0", sort = t.sections.Count, comicid = c.comicid, retry = 0, source = 6, downstatus = 0, isvip = "0", chaptersource = "", chapterlocal = "", modify = DateTime.Now, shortdate = DateTime.Now.ToDateStr(), chapterupdate = updatestr }); } } catch (Exception ex) { continue; } } service.ChapterCompareBatchAdd(plst, 6, DateTime.Now.ToDateStr()); }
public void Execute(IJobExecutionContext context) { //IDbCommandInterceptor interceptor = new DbCommandInterceptor(); //dbcontext.Session.AddInterceptor(interceptor); DateTime dt = DateTime.Now; string shortdate = dt.ToString("yyyy-MM-dd"); IQuery <Page> cpq = dbcontext.Query <Page>(); IQuery <Chapter> cq = dbcontext.Query <Chapter>(); List <Page> plst = cpq.Where(a => a.pagelocal.Length == 0).Take(20).ToList(); HttpWebHelper web = new HttpWebHelper(); foreach (var p in plst) { try { Stream stream = web.GetStream("http://cdn.sns.dongmanmanhua.cn/20150119_288/1421677325732TxLNo_JPEG/thumbnail_ipad.jpg"); Image img = Image.FromStream(stream); stream.Close(); string filePath = AppDomain.CurrentDomain.BaseDirectory + "DownLoadImgs/" + p.Id + ".jpg"; img.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg); string localimg = UcHelper.uploadFile("Page/" + p.Id + ".jpg", filePath); p.pagelocal = localimg; p.modify = dt; dbcontext.Update(p); dbcontext.Update <Chapter>(a => a.Id == p.chapterid, a => new Chapter() { downstatus = DownChapter.完图片, modify = dt }); File.Delete(filePath); } catch (Exception ex) { logger.Error(ex.Message); //Chapter chapter = cq.Where(x => x.Id == p.chapterid).FirstOrDefault(); //chapter.retry = chapter.retry + 1; //chapter.modify = dt; //dbcontext.Update(chapter); dbcontext.Update <Chapter>(a => a.Id == p.chapterid, a => new Chapter() { retry = a.retry + 1, modify = dt }); Err_PageJob err = new Err_PageJob(); err.imgurl = p.pagesource; err.source = p.source; err.errtype = ErrPage.限制访问; err.modify = dt; err.shortdate = shortdate; err.message = ex.Message; err = dbcontext.Insert(err); continue; } } }
public void Execute(IJobExecutionContext context) { string date = DateTime.Now.ToDateStr(); List <Comic> clst = comicmanager.Query(x => x.source == 11 && x.shortdate == date); List <Chapter> plst = new List <Chapter>(); foreach (var c in clst) { try { HttpWebHelper _helper = new HttpWebHelper(); var bookdata = _helper.Get(c.bookurl, Encoding.GetEncoding("utf-8")); List <Chapter> chapterlst = new List <Chapter>(); Regex regp1 = new Regex("var maxChapterId = \"(?<key1>.*?)\";"); Match matchp1 = regp1.Match(bookdata); string pcountstr = matchp1.Groups["key1"].Value; Regex regp2 = new Regex("<title>(?<key1>.*?)</title>"); Match matchp2 = regp2.Match(bookdata); string chaptername = matchp2.Groups["key1"].Value.Split('_')[1]; int sort = int.Parse(pcountstr); string chapterurl = $"http://m.zhangyue.com/readbook/{c.comicid.Replace("11_", "")}/{sort}/"; plst.Add(new Chapter() { chapterid = c.comicid + "_" + sort, chaptername = chaptername, chapterurl = chapterurl, sort = sort, comicid = c.comicid, retry = 0, source = 11, downstatus = 0, isvip = "0", chaptersource = "", chapterlocal = "", modify = DateTime.Now, shortdate = DateTime.Now.ToDateStr(), chapterupdate = DateTime.Now.ToDateStr() }); } catch (Exception ex) { continue; } } service.ChapterCompareBatchAdd(plst, 11, DateTime.Now.ToDateStr()); }
protected virtual string GetDimensionsXmlForSP(ItemScoreInfo scoreInfo) { scoreInfo.Rationale = null; if (scoreInfo.SubScores != null) { foreach (ItemScoreInfo subScore in scoreInfo.SubScores) { subScore.Rationale = null; } } return(HttpWebHelper.SerializeXml(scoreInfo)); }
public static List <string> GetSelfGroupMembers(string groupid) { var url = ConfigHelper.GetConfigString("GetSelfGroupMembers") + groupid; var resp = HttpWebHelper.HttpGet(url); var list = new List <string>(); resp = resp.Replace("[", "").Replace("]", ""); var arry = resp.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var s in arry) { list.Add(s.Replace("\"", "")); } return(list); }
public string HttpRequest(IDictionary <string, string> dicParams, string responseEncoding = "UTF-8") { var responseStr = ""; HttpWebHelper http = new HttpWebHelper(); if (RequestMethod.ToUpper() == "GET") { var _payUrl = HttpWebHelper.CreateParameter(dicParams); responseStr = http.Get(_payUrl, Encoding.GetEncoding(responseEncoding)); } else { responseStr = http.Post(PayUrl, dicParams, Encoding.GetEncoding(responseEncoding), Encoding.GetEncoding(responseEncoding)); } return(responseStr); }
public ActionResult GetHttpWebHelper() { Dictionary <string, string> dict = new Dictionary <string, string>() { { "SearchKey", "国元信托" }, { "AttrParam.CodeName", "xintuo" }, { "AttrParam.ProductStatusType", "1" }, }; for (int i = 0; i <= 100; i++) { var result = HttpWebHelper.GetRequest <ResponseResult>("http://productapi.jinglih.com/api/Product/GetProductList", dict); Console.WriteLine(i + "====" + result); } return(Content("")); }
public void Execute(IJobExecutionContext context) { var comiclst = new List <Comic>(); HttpWebHelper _helper = new HttpWebHelper(); DateTime dt = DateTime.Now; string shortdate = dt.ToDateStr(); var t = _helper.Get <icartoons_comic>("http://www.icartoons.cn/webapi/web/theme_contents.json?type=1&catid=0&content_type=1&page=1&pagesize=5000&sort=0", Encoding.GetEncoding("utf-8")); int sort = 0; foreach (var x in t.items) { try { sort = sort + 1; string bookurl = $"http://www.icartoons.cn/webapi/web/detail.json?type=1&content_id={x.serial_id}"; var data = _helper.Get <icartoons_comic_desc>(bookurl, Encoding.GetEncoding("utf-8")); comiclst.Add(new Comic() { comicname = x.title, authorname = data.author, bookurl = $"http://www.icartoons.cn/portal/csource.html?content_id={x.serial_id}", comiccoversource = x.cover, comiccoverlocal = "", comicdesc = data.description, comicid = "8_" + x.serial_id, isfinished = x.desc.StartsWith("全") ? "已完结" : "连载中", theme = data.theme, isvip = "0", source = 8, stopcrawer = false, isoffline = false, recrawer = false, shortdate = shortdate, modify = dt, comicsort = sort, hot = x.views }); } catch (Exception ex) { continue; } } service.ComicCompareBatchAdd(comiclst, 8, DateTime.Now.ToDateStr()); }
/// <summary> /// 请求数据 /// </summary> /// <param name="channel"></param> /// <param name="ra"></param> /// <param name="parameters">参数属性</param> /// <param name="objs">参数</param> /// <returns></returns> private Task <HttpResponseMessage> Request(RequestAttribute ra, ParameterInfo[] parameters, params object[] objs) { Task <HttpResponseMessage> rd = null; string uri = HttpWebHelper.PathCombine(Uri, ra.Uri); switch (ra.RequestType) { case RequestType.Get: rd = GetRequest(uri, parameters, objs); break; default: rd = PostRequest(uri, objs); break; } return(rd); }
public void Execute(IJobExecutionContext context) { //IDbCommandInterceptor interceptor = new DbCommandInterceptor(); //dbcontext.Session.AddInterceptor(interceptor); DateTime dt = DateTime.Now; string shortdate = dt.ToString("yyyy-MM-dd"); IQuery <Comic> comicq = dbcontext.Query <Comic>(); IQuery <Chapter> cpq = dbcontext.Query <Chapter>(); List <Chapter> plst = cpq.Where(a => a.chaptersource.Length != 0 && a.chapterlocal.Length == 0).TakePage(1, 20).ToList(); HttpWebHelper web = new HttpWebHelper(); foreach (var p in plst) { try { string refer = ""; if (p.source == Source.dongmanmanhua) { var comic = comicq.Where(x => x.comicid == p.comicid).FirstOrDefault(); refer = comic.bookurl; } Stream stream = web.GetStream(p.chaptersource, 300, "", null, refer, null); Image img = Image.FromStream(stream); stream.Close(); string filePath = AppDomain.CurrentDomain.BaseDirectory + "DownLoadImgs/" + p.Id + ".jpg"; img.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg); string localimg = UcHelper.uploadFile("Chapter/" + p.Id + ".jpg", filePath); p.chapterlocal = localimg; p.modify = dt; dbcontext.Update(p); } catch (Exception ex) { Err_ChapterJob err = new Err_ChapterJob(); err.bookurl = p.chapterurl; err.errtype = ErrChapter.图片出错; err.modify = dt; err.shortdate = shortdate; err.message = ex.Message; err = dbcontext.Insert(err); continue; } } }
//沙盒环境{domain} :open-sbox.sf-express.com //生产环境{domain} :open-prod.sf-express.com /// <summary> /// 获取Token 有效期为1小时 /// </summary> /// <returns></returns> private static string GetAccessToken() { string url = string.Format(domain + "/public/v1.0/security/access_token/sf_appid/{0}/sf_appkey/{1}", SFAppId, SFAppKey); MessageReq <TokenEntity> accessTokenReq = new MessageReq <TokenEntity>(); accessTokenReq.head.transType = 301; accessTokenReq.head.transMessageId = DateTime.Now.ToLongTimeString(); MessageResp <TokenEntity> res = HttpWebHelper.doPost <MessageReq <TokenEntity>, MessageResp <TokenEntity> >(url, accessTokenReq); if (res.head.transType == 4301) { return(res.body.accessToken); } else { throw new Exception(res.head.message); } }
public IHttpActionResult GetGroupList(string userId) { try { var chatGroupList = new List <MyGroup>(); var list = new List <MyGroup>(); /* * 1.发送请求,获取工作群 */ var unitid = ""; var url = ConfigHelper.GetConfigString("GetMyGroups") + "?unitID=" + unitid + "&userID=" + userId + "&pageSize=999"; var resp = HttpWebHelper.HttpGet(url); PmcJsonResultJsonContent result = JsonConvert.DeserializeObject <PmcJsonResultJsonContent>(resp); //获取所有 return(Json( new { Success = true, Content = result.Content, Error = "", Message = "查询成功", Count = result.Count, Total = result.Total, })); } catch (Exception ex) { return(Json( new { Success = false, Content = "", Error = ex.ToString(), Message = "查询失败", Count = 0, Total = 0 })); } }
public ActionResult PostHttpWebHelper() { SearchProductParam dict = new SearchProductParam() { SearchKey = "国元信托1", AttrParam = new SearchProductAttrParam() { CodeName = "xintuo", ProductStatusType = 1 }, }; var jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dict); for (int i = 0; i <= 100; i++) { var result = HttpWebHelper.PostRequest <ResponseResult>("http://productapi.jinglih.com/api/Product/GetProductList", jsonStr); Console.WriteLine(i + "====" + result); } return(Content("")); }
private void button1_Click(object sender, EventArgs e) { HttpWebHelper httpWebHelper = new HttpWebHelper(); ExceptionMsg exceptionMsg = new ExceptionMsg(); try { string R_result = httpWebHelper.Get("http://baidu.com", Encoding.UTF8); MessageBox.Show(exceptionMsg.IP); } catch (Exception ex) { MessageBox.Show(ex.Message); } //localCache.Add("mykey", "123", 10); localCache.Add("mykey", "123"); localCache.Set("11", DataBindingByList1()); ThreadStart threadStart = new ThreadStart(refresh); Thread thread = new Thread(threadStart); thread.Start(); new Thread(() => { while (true) { Thread.Sleep(1000); SetText($"9999\r\n"); } }) { IsBackground = true }.Start(); dynamic d = 1; int c = d + 1; //MessageBox.Show(c.ToString()); //Greeting("Make", ChineseGreeting); }
public static string QueryRoute(string trackingNumber) { string url = string.Format(domain + "/rest/v1.0/route/query/access_token/{0}/sf_appid/{1}/sf_appkey/{2}", QueryAccessToken(), SFAppId, SFAppKey); MessageReq <RouteReqDto> req = new MessageReq <RouteReqDto>(); req.head.transType = 501; req.head.transMessageId = DateTime.Now.ToLongTimeString(); req.body = new RouteReqDto(); req.body.trackingNumber = trackingNumber; req.body.trackingType = 2;//2 订单号查询 1 运单号查询 req.body.methodType = 1; MessageResp <List <RouteRespDto> > res = HttpWebHelper.doPost <MessageReq <RouteReqDto>, MessageResp <List <RouteRespDto> > >(url, req); if (res.head.code == "EX_CODE_OPENAPI_0105") { GetAccessToken(); QueryRoute(trackingNumber); } return(HttpWebHelper.ObjectToJson(res)); }
public static string SubmitOrder(string province, string city, string address, string contact, string tel, string goodsName, short payMethod) { string url = string.Format(domain + "/rest/v1.0/order/access_token/{0}/sf_appid/{1}/sf_appkey/{2}", QueryAccessToken(), SFAppId, SFAppKey); MessageReq <OrderReqEntity> req = new MessageReq <OrderReqEntity>(); req.head.transType = 200; req.head.transMessageId = DateTime.Now.ToLongTimeString(); req.body = new OrderReqEntity(); req.body.orderId = "SF" + DateTime.Now.ToString("yyyyMMddHHmmssfff"); req.body.expressType = 1; //标准快递 req.body.isDoCall = 1; //通知收派员上门取件 req.body.payMethod = payMethod; //付款方式 1月结 2收方付 3第三方付 if (req.body.payMethod == 1) { req.body.custId = SFYuJieCode;//顺丰月结卡号 10 位数字 } req.body.consigneeInfo = new DeliverConsigneeInfoDto(); req.body.consigneeInfo.address = address; req.body.consigneeInfo.city = city; req.body.consigneeInfo.company = "顺丰"; req.body.consigneeInfo.contact = contact; req.body.consigneeInfo.tel = tel; req.body.consigneeInfo.province = province; req.body.cargoInfo = new CargoInfoDto(); req.body.cargoInfo.cargo = goodsName; MessageResp <OrderRespEntity> res = HttpWebHelper.doPost <MessageReq <OrderReqEntity>, MessageResp <OrderRespEntity> >(url, req); if (res.head.code == "EX_CODE_OPENAPI_0105") { GetAccessToken(); SubmitOrder(province, city, address, contact, tel, goodsName, payMethod); } if (res.head.transType == 4200) { return(res.body.orderId); } else { throw new Exception(res.head.message); } }
public IHttpActionResult GetUserApplyResult(string userId) { try { /* * 1.发送请求,获取工作群组成员 */ var url = ConfigHelper.GetConfigString("GroupMsg03") + "?userId=" + userId; var resp = HttpWebHelper.HttpGet(url); PmcJsonResultWebApi result = JsonConvert.DeserializeObject <PmcJsonResultWebApi>(resp); //获取所有 return(Json( new { Success = result.Success, Content = result.Content, Error = "", Message = "查询成功", Count = 0, Total = 0, })); } catch (Exception ex) { return(Json( new { Success = false, Content = "", Error = ex.ToString(), Message = "查询失败", Count = 0, Total = 0 })); } }
/// <summary> /// 查询AccessToken 可以查询到数据 但是可能过期 /// </summary> /// <returns></returns> public static string QueryAccessToken() { string url = string.Format(domain + "/public/v1.0/security/access_token/query/sf_appid/{0}/sf_appkey/{1}", SFAppId, SFAppKey); MessageReq <TokenEntity> accessTokenReq = new MessageReq <TokenEntity>(); accessTokenReq.head.transType = 300; accessTokenReq.head.transMessageId = DateTime.Now.ToLongTimeString(); MessageResp <TokenEntity> res = HttpWebHelper.doPost <MessageReq <TokenEntity>, MessageResp <TokenEntity> >(url, accessTokenReq); if (res.head.code == "EX_CODE_OPENAPI_0105")//访问令牌过期 { return(GetAccessToken()); } else if (res.head.transType == 4300) { return(res.body.accessToken); } else { throw new Exception(res.head.message); } }
public IHttpActionResult GetGroupMembers(string groupID) { try { /* * 1.发送请求,获取工作群组成员 */ var url = ConfigHelper.GetConfigString("GetMyGroupMembers") + "?groupID=" + groupID; var resp = HttpWebHelper.HttpGet(url); PmcJsonResultWeb result = JsonConvert.DeserializeObject <PmcJsonResultWeb>(resp); //获取所有 return(Json( new { Success = true, Data = result.Data, Error = "", Message = "查询成功", Count = 0, Total = 0, })); } catch (Exception ex) { return(Json( new { Success = false, Content = "", Error = ex.ToString(), Message = "查询失败", Count = 0, Total = 0 })); } }
public void Execute(IJobExecutionContext context) { string date = DateTime.Now.ToDateStr(); List <Comic> clst = comicmanager.Query(x => x.source == 8 && x.shortdate == date); List <Chapter> plst = new List <Chapter>(); HttpWebHelper _helper = new HttpWebHelper(); foreach (var c in clst) { try { var bookdata = _helper.Get <icartoons_chapter>($"http://www.icartoons.cn/webapi/web/serials.json?type=1&content_id={c.comicid.Replace("8_", "")}&sort=2", Encoding.GetEncoding("utf-8")); var x = bookdata.items.First(); plst.Add(new Chapter() { chapterid = 8 + "_" + x.set_id, chaptername = x.title, chapterurl = $"http://www.icartoons.cn/portal/creader.html?content_id={c.comicid.Replace("8_", "")}&set_id={x.set_id}", sort = x.sortid, comicid = c.comicid, retry = 0, source = 8, downstatus = 0, isvip = "0", chaptersource = "", chapterlocal = "", modify = DateTime.Now, shortdate = DateTime.Now.ToDateStr(), chapterupdate = DateTime.Now.ToDateStr() }); } catch (Exception ex) { continue; } } service.ChapterCompareBatchAdd(plst, 8, DateTime.Now.ToDateStr()); }
public void Execute(IJobExecutionContext context) { //IDbCommandInterceptor interceptor = new DbCommandInterceptor(); //dbcontext.Session.AddInterceptor(interceptor); DateTime dt = DateTime.Now; string shortdate = dt.ToString("yyyy-MM-dd"); IQuery <Comic> cpq = dbcontext.Query <Comic>(); List <Comic> plst = cpq.Where(a => a.comiccoverlocal.Length == 0).TakePage(1, 20).ToList(); HttpWebHelper web = new HttpWebHelper(); foreach (var p in plst) { try { Stream stream = web.GetStream(p.comiccoversource); Image img = Image.FromStream(stream); stream.Close(); string filePath = AppDomain.CurrentDomain.BaseDirectory + "DownLoadImgs/" + p.Id + ".jpg"; img.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg); string localimg = UcHelper.uploadFile("Comic/" + p.Id + ".jpg", filePath); p.comiccoverlocal = localimg; p.modify = dt; dbcontext.Update(p); } catch (Exception ex) { Err_ComicJob err = new Err_ComicJob(); err.bookurl = p.bookurl; err.errtype = ErrComic.图片出错; err.modify = dt; err.shortdate = shortdate; err.message = ex.Message; err = dbcontext.Insert(err); continue; } } }
public InternationalSms(IAppConfig appConfig) { this._appConfig = appConfig; this._httpWebHelper = new HttpWebHelper(_appConfig); }
public void Execute(IJobExecutionContext context) { HttpWebHelper _helper = new HttpWebHelper(); Dictionary <string, string> tags = new Dictionary <string, string>(); tags.Add("19", "日常"); tags.Add("20", "恋爱"); tags.Add("22", "奇幻"); tags.Add("23", "剧情"); tags.Add("24", "爆笑"); tags.Add("27", "治愈"); tags.Add("40", "完结"); tags.Add("41", "三次元"); tags.Add("46", "古风"); tags.Add("47", "校园"); tags.Add("48", "都市"); tags.Add("49", "少年"); tags.Add("52", "总裁"); tags.Add("53", "栏目"); tags.Add("54", "正能量"); tags.Add("56", "传统"); tags.Add("57", "日漫"); Dictionary <string, Comic> comicdic = new Dictionary <string, Comic>(); try { foreach (var tag in tags) { var t = _helper.Get <kuaikan_comic>($"http://www.kuaikanmanhua.com/web/tags/{tag.Key}?count=1800&page=0", Encoding.GetEncoding("utf-8")); var comiclst = new List <Comic>(); if (t.status_code == 200) { foreach (var topic in t.data.topics) { string comicid = "12_" + topic.id; if (!comicdic.ContainsKey(comicid)) { comicdic.Add(comicid, new Comic() { comicname = topic.title, authorname = topic.user == null ? "" : topic.user.nickname, bookurl = $"http://www.kuaikanmanhua.com/web/topic/{topic.id}/", comiccoversource = topic.vertical_image_url, comiccoverlocal = "", comicdesc = topic.description, comicid = "12_" + topic.id, isfinished = topic.description.Substring(topic.description.IndexOf('【') + 1).Split('/')[1].Contains("更新")? "连载中" : "已完结", theme = tag.Value, isvip = "0", source = 12, stopcrawer = false, isoffline = false, recrawer = false, shortdate = DateTime.Now.ToDateStr(), modify = DateTime.Now, comicsort = null, hot = topic.likes, copyright = topic.description.Substring(topic.description.IndexOf('【') + 1).Split('/')[0], }); } } } } var t2 = _helper.Get <kuaikan_comic>($"http://www.kuaikanmanhua.com/web/tags/0?count=1800&page=0", Encoding.GetEncoding("utf-8")); var comiclst2 = new List <Comic>(); if (t2.status_code == 200) { int sort = 0; foreach (var topic in t2.data.topics) { sort = sort + 1; comiclst2.Add(new Comic() { comicname = topic.title, authorname = topic.user == null ? "" : topic.user.nickname, bookurl = $"http://www.kuaikanmanhua.com/web/topic/{topic.id}/", comiccoversource = topic.vertical_image_url, comiccoverlocal = "", comicdesc = topic.description, comicid = "12_" + topic.id, isfinished = "连载中", theme = "", isvip = "0", source = 12, stopcrawer = false, isoffline = false, recrawer = false, shortdate = DateTime.Now.ToDateStr(), modify = DateTime.Now, comicsort = sort, hot = topic.likes }); } } foreach (var item in comicdic) { var comic = comiclst2.Where(x => x.comicid == item.Key).FirstOrDefault(); if (comic != null) { item.Value.comicsort = comic.comicsort; } } List <Comic> addlst = new List <Comic>(); foreach (var item in comicdic) { addlst.Add(item.Value); } service.ComicCompareBatchAdd(addlst, 12, DateTime.Now.ToDateStr()); } catch (Exception ex) { _logger.Error("Job_Comic 执行过程中发生异常:" + ex.ToString()); } finally { _logger.InfoFormat("Job_Comic Execute end "); } }
public Mail(IAppConfig appConfig) { _appConfig = appConfig; _httpWebHelper = new HttpWebHelper(_appConfig); }
public Message(IAppConfig appConfig) { this._appConfig = appConfig; this._httpWebHelper = new HttpWebHelper(_appConfig); }