using System; using System.Collections.Generic; using Library; using LitJson; using System.Linq; using System.Data; using System.Threading; using MySystem.PxcModels; namespace MySystem { public class MiniSetVersionService { public readonly static MiniSetVersionService Instance = new MiniSetVersionService(); private MiniSetVersionService() { } public void Start() { Thread th = new Thread(StartListen); th.IsBackground = true; th.Start(); } public void StartListen() { while(true) { try { string content = RedisDbconn.Instance.RPop("MiniSetVersionQueue"); if(!string.IsNullOrEmpty(content)) { StartListenDo(content); } else { Thread.Sleep(10000); } } catch { Thread.Sleep(600000); } } } public void StartListenDo(string Id) { string conn = Library.ConfigurationManager.AppSettings["MiniSqlConnStr"].ToString(); CustomerSqlConn.op("update ProjectVersion set VersionNo=VersionNo+1 where ProjectId=" + Id + " and UserId=1", conn); } } }