using System;
using System.Collections.Generic;
using System.Data;
using Library;
using LitJson;

namespace MySystem
{
    public class ReceiveProfitService
    {
        public readonly static ReceiveProfitService Instance = new ReceiveProfitService();
        private ReceiveProfitService()
        { }

        public void Start(JobMqMsg jobInfo)
        {
            string content = "";
            try
            {
                string OrderString = jobInfo.OrderString;
                // string Msg = "success";
                if (OrderString == "SplitAccount")
                {
                    string Table = OrderString.Split(':')[1];
                    ProfitHelper.Instance.StartListenSplitAccount();
                }
                // jobInfo.Status = Msg == "success" ? 1 : 0;
                // jobInfo.Msg = Msg == "success" ? "执行完成" : Msg;
                // RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "PublicBack");
            }
            catch (Exception ex)
            {
                if (!string.IsNullOrEmpty(content))
                {
                    Dictionary<string, string> data = new Dictionary<string, string>();
                    data.Add("ErrTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    data.Add("ErrMsg", ex.ToString());
                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(data), "public_err");
                }
                else
                {
                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "public_service");
                }
            }
        }
    }
}