Esempio n. 1
0
        public void Initialized(InitializedContext context)
        {
            var settingJsonPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data", "setting.json");
            var options         = new SystemOptions();

            if (File.Exists(settingJsonPath))
            {
                options = JsonConvert.DeserializeObject <SystemOptions>(File.ReadAllText(settingJsonPath));
            }
            SystemOptions.Instance = options;
            // 在本地地址上启动Web服务,可以根据需求改变端口
            _webHost.StartAsync(options.HangdireDashboardUri, _mahuaApi.GetSourceContainer());

            // 定时记录资产
            RecurringJob.AddOrUpdate(nameof(IUserAssetTracer), () => _userAssetTracer.Recode(), Cron.MinuteInterval(10));

            // 定时检测订单成交变化
            RecurringJob.AddOrUpdate(nameof(OrderTracer), () => _orderTracer.ReportFinishedOrders(), () => Cron.MinuteInterval(5));

            // 定时报告资产变化
            foreach (var hour in HoursInChina)
            {
                RecurringJob.AddOrUpdate(nameof(IUserAssetTracer) + hour,
                                         () => _userAssetTracer.Report(), () => Cron.Daily((hour - 8 + 24) % 24));
            }

            Process.Start($"{options.HangdireDashboardUri}/hangfire/recurring");
        }
 public void Initialized(InitializedContext context)
 {
     // 在本地地址上启动Web服务,可以根据需求改变端口
     _webhost.StartAsync("http://localhost:65238", _mahuaApi.GetSourceContainer());
     //初始化数据库
     _dbHelper.InitDbAsync();
     // 不要忘记在MahuaModule中注册
 }
        public void Initialized(InitializedContext context)
        {
            _logger.Info("插件初始化完成!");

            _webHost.StartAsync("http://localhost:65271", _mahuaApi.GetSourceContainer());

            // todo 填充处理逻辑
            //throw new NotImplementedException();

            // 不要忘记在MahuaModule中注册
        }
Esempio n. 4
0
        public async Task Handle()
        {
            return;

            Logger.Info("开始初始化mqp插件");

            try
            {
                //var apiGetQQlist = _mpqApi.Api_GetQQlist();

                //Logger.Debug("当前登录的qq列表:" + apiGetQQlist);

                //if (_mpqApi.Api_AddQQ("2758938447", "study2018/", true))
                //{
                //    Logger.Debug("添加默认账号成功!");
                //} 测试失败...

                await _webHost.StartAsync(ConfigConst.HangFireBaseUrl, _mahuaApi.GetSourceContainer());

                Logger.Debug("开启hangfire成功!");

                //await new TestJob().StartAsync();

                //await new AutoCloseGroupActivityJob(null, null).StartAsync();
                //await new AutoOutGroupMsg(null).StartAsync(context.FromGroup, loginQq);

                var list = await _jobConfigService.GetListAsync();

                foreach (var item in list)
                {
                    await _customerJob.StartJob(item);
                }

                Logger.Debug("添加job成功");
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }

            Logger.Info("mqp插件初始化完毕"); // 测试成功
        }
Esempio n. 5
0
 public void Initialized(InitializedContext context)
 {
     // 在本地地址上启动Web服务,可以根据需求改变端口
     _webHost.StartAsync("http://localhost:8080", _mahuaApi.GetSourceContainer());
 }
 public void Initialized(InitializedContext context)
 {
     _webHost.StartAsync("http://localhost:65238", _mahuaApi.GetSourceContainer());
 }