初识爬虫
Posted steve-
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了初识爬虫相关的知识,希望对你有一定的参考价值。
这两个用法其实我也还是没有怎么搞懂,先记录下吧
HttpContent content = new StringContent(JsonConvert.SerializeObject(o), Encoding.UTF8, "application/json"); var myhttpclient = _myhttpclientfactory.CreateClient(); var message = Task.Run(() => { return myhttpclient.PostAsync(url, content); }); message.Wait(); _Database.Add(new jsonlog { Time = Now.DateTime, Fk = Id, Json = JsonConvert.SerializeObject(o), Pk = System.Guid.NewGuid(), Msg = $ "{OrderNum}" }); _Database.SaveChanges(); if(message.Result.IsSuccessStatusCode) { var rr = message.Result.Content.ReadAsStringAsync().GetAwaiter().GetResult(); _Database.OmsEcjsonlog.Add(new OmsEcjsonlog { CreateDateTime = Now.DateTime, Fk = Id, Json = rr, Pk = System.Guid.NewGuid(), Msg = $ "{OrderNum}" }); _Database.SaveChanges(); var j = JObject.Parse(rr); string flag = j["response"]["success"].ToString(); string msg = j["response"]["msg"].ToString(); if(flag.ToLower() == "true" || msg == "ok") { using(var tran = _OMSECDatabase.Database.BeginTransaction()) { try { tran.Commit(); i = 1; } catch(Exception ex) { if(tran != null) tran.Rollback(); throw new Exception($ "SO Cancel Tran Failed,{ex.Message}"); } } } else {} }
找了两个相关链接 A B 微软DOC
以上是关于初识爬虫的主要内容,如果未能解决你的问题,请参考以下文章
初识Spring源码 -- doResolveDependency | findAutowireCandidates | @Order@Priority调用排序 | @Autowired注入(代码片段
初识Spring源码 -- doResolveDependency | findAutowireCandidates | @Order@Priority调用排序 | @Autowired注入(代码片段