static void Main1(string[] args) { ConfigReset(); for (int i = 0; i < 102; i++) { string sql = " select id,fullid,dd from BlindDate where dd=0 limit 10 "; List <BlindDate> datas = conn.Query <BlindDate>(sql).AsList(); string res = ""; List <FullPages> pages = new List <FullPages>(); foreach (var data in datas) { res = GetRespose(data.fullid); FullPages page = new FullPages(); page.fullid = data.fullid; page.details = res; pages.Add(page); int ins = conn.Execute($" update BlindDate set dd=1 where id={data.id}"); } long insert = conn.Insert(pages); } }
private static void ObjectAddList(TitleModel model, List <BlindDate> li, List <FullPages> pages) { foreach (var item in model.items) { var target = item.target; BlindDate date = new BlindDate(); if (target.status == null) { if (int.TryParse(target.author.id, out int id)) { date.author_id = id; } if (int.TryParse(target.id, out int fullid)) { date.fullid = fullid; } else { nlog.Error($"原:{target.id},start:{start},target{item.target.ToJson()}"); break; } date.author_loc = target.author.loc == null ? "" : target.author.loc.name; date.author_name = target.author.name == null ? "" : target.author.name; date.author_reg = Convert.ToDateTime(target.author.reg_time); date.theabstract = item.@abstract; date.page_createtime = Convert.ToDateTime(target.create_time); li.Add(date); } else { FullPages page = new FullPages(); var status = target.status; if (long.TryParse(status.author.id, out long id)) { date.author_id = id; } if (long.TryParse(status.id, out long fullid)) { date.fullid = fullid; page.fullid = fullid; } else { nlog.Error($"原:{status.id},start:{start},target{item.target.ToJson()}"); break; } date.author_loc = status.author.loc == null ? "" : status.author.loc.name; date.author_name = status.author.name; date.author_reg = Convert.ToDateTime(status.author.reg_time); date.theabstract = item.@abstract; date.page_createtime = Convert.ToDateTime(status.create_time); li.Add(date); page.detailstext = status.text; string imgs = ""; if (status.images.Length > 0) { foreach (var img in status.images) { imgs += img.large.url + ";"; } } page.imgs = imgs; pages.Add(page); } } }