123456789101112131415161718192021222324252627282930313233343536 |
- using System.Threading;
- using MySystem;
- using MySystem.OpModels;
- public class OperateAmountRecordService
- {
- public readonly static OperateAmountRecordService Instance = new OperateAmountRecordService();
- private OperateAmountRecordService()
- {
- }
-
- public void Start()
- {
- Thread th = new Thread(DoWorks);
- th.IsBackground = true;
- th.Start();
- }
- private void DoWorks()
- {
- while (true)
- {
- string content = RedisDbconn.Instance.RPop<string>("OperateAmountRecordServiceQueue");
- if (!string.IsNullOrEmpty(content))
- {
- WebCMSEntities db = new WebCMSEntities();
- Utils.Instance.OperateAmountChange(db,Newtonsoft.Json.JsonConvert.DeserializeObject<OpAmountItem>(content));
- db.Dispose();
- }
- else
- {
- Thread.Sleep(5000);
- }
- }
- }
- }
|