Пример #1
0
        public static bool Is_Tid(string Tid)
        {
            DbcontextDB db = new DbcontextDB();
            var         ID = db.FirstOrDefault <Tieba>("where Tid=" + Tid + "");

            return(ID == null ? true : false);
        }
Пример #2
0
        public static bool Is_Id(string newsid)
        {
            DbcontextDB db = new DbcontextDB();
            var         ID = db.FirstOrDefault <Crawler>("where NewsID=" + newsid + "");

            return(ID == null ? true : false);
        }
Пример #3
0
        public static void clearHtmlattrbute(string html)
        {
            HtmlDocument hd = new HtmlDocument();

            hd.LoadHtml(html);
            var list = hd.DocumentNode.SelectNodes(".//div[@class='col2_right j_threadlist_li_right ']");

            foreach (var item in list)
            {
                var Tid = item.SelectSingleNode("./div[1]/div[1]/a[1]").Attributes["href"].Value;
                Tid = Tid.Substring(3, Tid.Length - 3);//贴吧ID
                if (Tid.Length == 10)
                {
                    using (DbcontextDB db = new DbcontextDB())
                    {
                        var IsNew = db.FirstOrDefault <Tieba>("where Tid=@Tid", new { Tid = Tid });
                        if (IsNew == null)
                        {
                            var modul = Task.Run(() => GetTieba(item));
                            modul.Result.Tid = Tid;
                            var IsAdd = Task.Run(() => AddTieba(modul.Result));
                            if (!IsAdd.Result)
                            {
                                Console.ForegroundColor = ConsoleColor.Yellow;
                                Console.WriteLine($"标题:{modul.Result.title}添加失败!");
                            }
                        }
                    }
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Tid 有误,请查看");
                }
            }
        }
Пример #4
0
 public admin Login(admin admin)
 {
     admin.password = common.common.MD5(admin.password);
     return(db.FirstOrDefault <admin>("select * from [admin] where email=@0 and password=@1", admin.email, admin.password));
 }
 public PhoneConfig GetPhoneConfigByid(int id) => db.FirstOrDefault <PhoneConfig>("select * from phoneconfig where id=@0", id);
Пример #6
0
        public static bool is_Insert(int positionId)
        {
            var lagou = db.FirstOrDefault <Lagou>("select * from Lagou where positionId=" + positionId + " ");

            return((lagou == null) ? true : false);
        }