Esempio n. 1
0
        protected override void OnStart(string[] args)
        {
            if (!OtherConfig.init())
            {
                return;
            }

            LogUtil.getInstance().start(OtherConfig.s_logPath + "TLJ_LoginServiceLog");

            if (!NetConfig.init())
            {
                return;
            }

            m_serverUtil      = new HPServerUtil();
            m_mySqlServerUtil = new MySqlServerUtil();
            m_logicServerUtil = new LogicServerUtil();
            //m_playServerUtil = new PlayServerUtil();

            LogUtil.getInstance().addDebugLog("服务开启");

            // 开启TCP服务组件与客户端通信
            m_serverUtil.startTCPService();

            // 开启TCP客户端组件与数据库服务器通信
            m_mySqlServerUtil.start();

            // 开启TCP客户端组件与逻辑服务器通信
            m_logicServerUtil.start();

            //// 开启TCP客户端组件与游戏服务器通信
            //m_playServerUtil.start();
        }
Esempio n. 2
0
        public IActionResult AttachConfig(AttachConfigEntity model)
        {
            if (!string.IsNullOrWhiteSpace(model.WaterMarkImg))
            {
                string imgPath = _env.WebRootPath + model.WaterMarkImg.Replace("/", "\\");
                NewLife.Log.XTrace.WriteLine(_env.WebRootPath + "|" + Path.Combine(_env.WebRootPath, model.WaterMarkImg) + "|" + imgPath);
                if (!System.IO.File.Exists(imgPath))
                {
                    tip.Message = "水印图片不存在,请重新上传!";
                    return(Json(tip));
                }
            }
            string json = JsonConvert.SerializeObject(model);

            OtherConfig oc = OtherConfig.Find(OtherConfig._.ConfigName == "attach");

            if (oc == null)//如果不存在
            {
                oc                = new OtherConfig();
                oc.ConfigName     = "attach";
                oc.ConfigValue    = json;
                oc.LastUpdateTime = DateTime.Now;
                oc.Insert();
            }
            else
            {
                oc.ConfigValue    = json;
                oc.LastUpdateTime = DateTime.Now;
                oc.Update();
            }
            Admin.WriteLogActions("修改附件配置;");
            tip.Status  = JsonTip.SUCCESS;
            tip.Message = "修改附件配置成功";
            return(Json(tip));
        }
Esempio n. 3
0
        protected override void OnStart(string[] args)
        {
            if (!OtherConfig.init())
            {
                return;
            }

            // 日志
            LogUtil.getInstance().start(OtherConfig.s_logPath + "TLJ_PlayServiceLog");

            // 全局定时器
            GlobalTimer.getInstance().start();

            if (!NetConfig.init())
            {
                return;
            }

            //log4net.Config.XmlConfigurator.Configure();
            //log = LogManager.GetLogger(TAG);
            //log.Info("日志开启");

            m_serverUtil      = new HPServerUtil();
            m_mySqlServerUtil = new MySqlServerUtil();

            LogUtil.getInstance().addDebugLog("服务开启");

            // 开启TCP服务组件与客户端通信
            m_serverUtil.startTCPService();

            // 开启TCP客户端组件与数据库服务器通信
            m_mySqlServerUtil.start();
        }
        public AttachConfig GetByOrgId(string orgId)
        {
            //return _attachConfigRepository.Single(a=>a.OrgId==orgId);
            AttachConfig config = null;
            OtherConfig  ac     = _otherConfigRepository.Single(a => a.OrgId == orgId && a.ConfigName == "attach");

            if (ac != null)
            {
                if (!string.IsNullOrEmpty(ac.ConfigValue))
                {
                    config = JsonConvert.DeserializeObject <AttachConfig>(ac.ConfigValue);
                }
                else
                {
                    config = new AttachConfig();
                }
            }
            else
            {
                config = new AttachConfig();
                OtherConfig newac = new OtherConfig();
                newac.ConfigName     = "attach";
                newac.ConfigValue    = JsonConvert.SerializeObject(config);
                newac.LastUpdateTime = DateTime.Now;
                _otherConfigRepository.Add(newac);
            }
            return(config);
        }
Esempio n. 5
0
    protected override void Awake()
    {
        base.Awake();
        AddEventListenerTarget(GlobalEvent.inst, eEvent.UPDATE_GOLDS, OnGoldUpdate);
        OtherConfig con = ConfigManager.GetConfigs <OtherConfig>()[0] as OtherConfig;

        mMinNum = con.tixianMinNum;
    }
Esempio n. 6
0
    private ServiceConfig mData; //数据

    protected override void Start()
    {
        base.Start();
        //oinNum.text = PlayerModel.Inst.UserInfo.gold.ToString();
        OtherConfig con = ConfigManager.GetConfigs <OtherConfig>()[0] as OtherConfig;

        mMinNum = con.tixianMinNum;
        //赠送最低提示
        mGiveTip.text = string.Format("赠送数量(最低{0}金币)", mMinNum);
    }
Esempio n. 7
0
    /// <summary>
    /// 打开登录界面
    /// </summary>
    private void OpenLogin()
    {
        mProgressValue  = 1;
        mProgress.value = mProgressValue;
        OtherConfig config = ConfigManager.GetConfigs <OtherConfig>()[0] as OtherConfig;

        if (config.isOpen != 1)
        {
            Global.Inst.GetController <CommonTipsController>().ShowTips("服务器维护中", "确定");
            return;
        }
        Global.Inst.GetController <LoginController>().OpenWindow();
        Close();
    }
Esempio n. 8
0
    /// <summary>
    /// 打开登录界面
    /// </summary>
    private void OpenLogin()
    {
        OtherConfig config = ConfigManager.GetConfigs <OtherConfig>()[0] as OtherConfig;

        if (config.isOpen != 1)
        {
            Global.Inst.GetController <CommonTipsController>().ShowTips("服务器维护中", "确定");
            return;
        }
        mLoadingTips.SetActive(false);
        mLoginBtn.SetActive(true);                  //加载完才显示登录按钮
        Debug.Log("退出");
        PlayerPrefs.DeleteKey("wechat_login_data"); //清除登录信息
        if (Application.platform != RuntimePlatform.WindowsEditor)
        {
            SixqinSDKManager.Inst.CanelLogin(cn.sharesdk.unity3d.PlatformType.WeChat);
        }
    }
Esempio n. 9
0
        public IActionResult SmtpConfig(SMTPConfigEntity model)
        {
            //验证
            if (!Utils.IsValidEmail(model.SmtpEmail))
            {
                tip.Message = "SMTP帐号格式错误!请输入正确的Email!";
                return(Json(tip));
            }
            if (string.IsNullOrEmpty(model.SmtpHost))
            {
                tip.Message = "请输入SMTP服务器地址!";
                return(Json(tip));
            }
            if (!Utils.IsInt(model.SmtpProt))
            {
                tip.Message = "请输入正确的端口号!";
                return(Json(tip));
            }
            string json = JsonConvert.SerializeObject(model);

            OtherConfig oc = OtherConfig.Find(OtherConfig._.ConfigName == "smtp");

            if (oc == null)//如果不存在
            {
                oc                = new OtherConfig();
                oc.ConfigName     = "smtp";
                oc.ConfigValue    = JsonConvert.SerializeObject(model);
                oc.LastUpdateTime = DateTime.Now;
                oc.Insert();
            }
            else
            {
                oc.ConfigValue    = JsonConvert.SerializeObject(model);
                oc.LastUpdateTime = DateTime.Now;
                oc.Update();
            }
            Admin.WriteLogActions("修改SMTP设置;");

            tip.Status  = JsonTip.SUCCESS;
            tip.Message = "修改站点SMTP配置成功";

            return(Json(tip));
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            App.Instance = app.ApplicationServices;
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            if (Configuration.GetValue <bool>("Swagger:Enabled"))
            {
                app.UseSwagger();
                app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "样例系统 API");
                });
            }

            app.UseStaticFiles();
            app.UseHttpsRedirection();

            app.UseRouting();
            app.UseSession();
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseQuartz(app.ApplicationServices, lifetime);

            app.UseTheReuestOperation();
            app.UseCulture();
            app.UseRoutePermission <RoutePermissionMiddleware>();
            app.UseRequestLog();
            app.UseIdentityAuth <int>();

            app.UseApiExceptionHandle();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            OtherConfig.Init();
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            ServiceProviderTool.Instance = app.ApplicationServices;
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles();
            app.UseHttpsRedirection();

            app.UseRouting();
            app.UseSession();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseRequestLog();
            app.UseIdentityAuth <int>();

            app.UseApiExceptionHandle();
            //app.UseHttpClientForBreakerWrapPolicy(); // 使用断路器时才需要

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            if (Configuration.GetValue <bool>("Swagger:Enabled"))
            {
                app.UseSwagger();
                app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebDemo API");
                });
            }

            OtherConfig.Init();
        }
Esempio n. 12
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseSession();
            app.UseAuthentication();
            app.UseStaticFiles();

            app.UseHttpsRedirection();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            if (PlatformCodeTool.Config.GetValue <bool>("Swagger:Enabled"))
            {
                app.UseSwagger();
                app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebDemo API");
                });
            }

            UserConfig.Init();
            OtherConfig.Init();

            PrgramConfigManager.ProgramConfigReader = new ProgramStartConfigJson();
            PrgramConfigManager.Start();
        }
        public OtherConfig AddOrUpdateOtherConfig(AddOrUpdateOtherConfigInput input)
        {
            OtherConfig oc = _otherConfigRepository.Single(a => a.OrgId == input.OrgId && a.ConfigName == "attach");

            if (oc == null)//如果不存在
            {
                oc                = new OtherConfig();
                oc.OrgId          = input.OrgId;
                oc.CreationTime   = DateTime.Now;
                oc.ConfigName     = "attach";
                oc.ConfigValue    = input.ConfigValue;
                oc.LastUpdateTime = DateTime.Now;
                _otherConfigRepository.Add(oc);
            }
            else
            {
                oc.ConfigValue    = input.ConfigValue;
                oc.LastUpdateTime = DateTime.Now;
                _otherConfigRepository.Update(oc);
            }
            return(oc);
        }
Esempio n. 14
0
        public async void Awake()
        {
            // 获取配置文件
            {
                string fileName = "otherConfig-" + PlatformHelper.GetVersionName() + ".json";
                await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/" + fileName, OtherConfig.getInstance().init);
            }

            ToastScript.clear();
            Instance = this;
            initData();
            CommonUtil.SetTextFont(panel_start.transform.parent.gameObject);
        }