|
|
@@ -0,0 +1,77 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using Library;
|
|
|
+using System.Linq;
|
|
|
+using System.Threading;
|
|
|
+using System.Text;
|
|
|
+
|
|
|
+namespace MySystem
|
|
|
+{
|
|
|
+ public class PrizeSendService
|
|
|
+ {
|
|
|
+ public readonly static PrizeSendService Instance = new PrizeSendService();
|
|
|
+ private PrizeSendService()
|
|
|
+ { }
|
|
|
+
|
|
|
+ public void Start()
|
|
|
+ {
|
|
|
+ Thread th = new Thread(dosomething);
|
|
|
+ th.IsBackground = true;
|
|
|
+ th.Start();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void dosomething()
|
|
|
+ {
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ string content = RedisDbconn.Instance.RPop<string>("PrizeSendQueue");
|
|
|
+ if (!string.IsNullOrEmpty(content))
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ RabbitMQPrize.Instance.SendMsg(content, "PRIZE_SEND_QUEUE");
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "推送客小爽机具数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Thread.Sleep(2000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void StartMp()
|
|
|
+ {
|
|
|
+ Thread th = new Thread(dosomethingMp);
|
|
|
+ th.IsBackground = true;
|
|
|
+ th.Start();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void dosomethingMp()
|
|
|
+ {
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ string content = MpRedisDbconn.Instance.RPop<string>("KxsActQueue");
|
|
|
+ if (!string.IsNullOrEmpty(content))
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ RabbitMQClient.Instance.SendMsg3(content, "QUEUE_KXS_ACT_DIVISION");
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "推送客小爽码牌激活数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Thread.Sleep(500);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|