123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using FCS.Common;
- using FCS.Interface;
- using FCS.Models.Entity;
- using Quartz;
- namespace FCS.Crawler.Basketball
- {
- /// <summary>
- /// 篮球赛事
- /// 制作人:海棠
- /// </summary>
- public class B_EventsJob : CommonJob
- {
- private List<B_Events> eventsList;
- public B_EventsJob()
- {
- eventsList = services.Query<B_Events>().ToList();
- }
- public List<B_Events> GetEventList()
- {
- var id = string.Empty;
- if (eventsList.Count == 2)
- return eventsList;
- else
- {
- services.Delete<B_Events>();
- services.SqlBulkCopyAdd<B_Events>(GetAddData());
- eventsList = services.Query<B_Events>().ToList();
- }
- return eventsList;
- }
- /// <summary>
- /// 得到新增数据
- /// </summary>
- /// <returns></returns>
- private IEnumerable<B_Events> GetAddData()
- {
- var eventNameList = new List<string>() {
- ConfigurationManager.AppSettings["NBAEventName"],
- ConfigurationManager.AppSettings["CBAEventName"],
- };
- foreach (var item in eventNameList)
- {
- yield return new B_Events
- {
- Id = CommonHelper.GetGuid().ToString(),
- Name = item,
- CreateDateTime = DateTime.Now,
- Describe = item,
- Sort = 1
- };
- }
- }
- }
- }
|