using System;
using System.Collections.Generic;
using System.Linq;
using MySystem.PxcModels;
using Library;
using LitJson;

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

        public void Start(JobMqMsg jobInfo)
        {
            try
            {
                string OrderString = jobInfo.OrderString;
                if (OrderString.StartsWith("Sp:") && OrderString.EndsWith(":SpServer"))
                {
                    string Kind = OrderString.Split(':')[1];
                    dosomething(Kind);
                    // jobInfo.Status = 1;
                    // jobInfo.Msg = "执行完成";
                    // RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "SycnSpServerBack");
                }
            }
            catch (Exception ex)
            {
                Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "同步SP数据到MAIN异常");
            }
        }

        public void dosomething(string Kind)
        { 
            // if (Kind == "bind")
            // {
            //     SycnSpBindService.Instance.Start();
            // }
            // else if (Kind == "active")
            // { 
            //     SycnSpActiveService.Instance.Start();
            // }
            // else if (Kind == "trade")
            // { 
            //     SycnSpTradeService.Instance.Start();
            // }
            // else if (Kind == "merchant")
            // { 
            //     SycnSpMerchantService.Instance.Start();
            // }
        }
    }
}