Esempio n. 1
0
        public void Run(IServiceProvider serviceProvide)
        {
            ISysLogAppService _sysLogAppService = serviceProvide.CreateScope().ServiceProvider.GetService <ISysLogAppService>() as ISysLogAppService;

            try
            {
                //执行任务
                IDistributionRepository _distributionRepository = serviceProvide.CreateScope().ServiceProvider.GetService <IDistributionRepository>() as IDistributionRepository;

                var      malldate = _distributionRepository.GetLastSynTime();
                DateTime?iwmsdate = _distributionRepository.GetLastSynTime(false);
                //获取IWMS数据
                var result = _distributionRepository.GetDataSource(iwmsdate);
                //同步IWMS数据
                _distributionRepository.DistributionDataSiurce(result, false);
                AdInfo_WebServiceSoapClient adInfo_WebServiceSoapClient = new AdInfo_WebServiceSoapClient(EndpointConfiguration.AdInfo_WebServiceSoap);

                var           key           = "nrjmR4wjLNliD5dS";
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("EncryptText=");
                stringBuilder.Append(malldate.ToString());
                stringBuilder.Append("sign=");
                stringBuilder.Append(key);

                UMParam data = new UMParam()
                {
                    Date       = malldate.ToString(),
                    Ciphertext = MD5Helper.MD5Encrypt(stringBuilder.ToString())//加密
                };
                var          param        = JsonConvert.SerializeObject(data);
                var          mallData     = adInfo_WebServiceSoapClient.GetCustomerInfoAsync(param).Result;
                UMDataSource uMDataSource = JsonConvert.DeserializeObject <UMDataSource>(mallData.ToString());
                if (uMDataSource.Result)
                {
                    _distributionRepository.DistributionDataSiurce(uMDataSource.Data, false);
                    _sysLogAppService.Log("", "系统", "192.168.1.106", "从商城获取客户数据成功,并导入数据库", Entity.LogType.System);
                }
                else
                {
                    _sysLogAppService.Log("", "系统", "192.168.1.106", "从商城获取客户数据失败,错误信息:" + uMDataSource.Msg, Entity.LogType.System);
                }
            }
            catch (Exception e)
            {
                _sysLogAppService.Log("", "系统", "192.168.1.106", "同步失败,错误信息:" + e.Message, Entity.LogType.Error);
            }
        }
Esempio n. 2
0
 public SysLogController(ISysLogAppService SysLogAppService)
 {
     _SysLogAppService = SysLogAppService;
 }
 public AccountAppService(IAccountRepository accountRepository, ISysLogAppService sysLogAppService)
 {
     _accountRepository = accountRepository;
     _sysLogAppService  = sysLogAppService;
 }