Beispiel #1
0
        public IActionResult func_active(string aid, string ip)
        {
            string    uavGUID = aid;
            Hashtable htb     = new Hashtable();

            if (uavGUID.IsNullOrEmpty() || uavGUID.Length != 32)
            {
                htb.Add("gate", "sw");
                return(this.FuncResult(new APIReturn(10302, "帐号格式错误", htb)));
            }
            D2unactiveInfo gua = D2unactive.GetItem(uavGUID);

            if (gua == null)
            {
                htb.Add("gate", "sw");
                return(this.FuncResult(new APIReturn(10300, "帐号不存在", htb)));
            }
            TimeSpan ts1 = DateTime.Now - gua.UavTime1.Value;

            if (ts1.TotalHours >= 48)
            {
                htb.Add("gate", gua.UavGate);
                return(this.FuncResult(new APIReturn(10354, "超过48小时未激活", htb)));
            }

            string gateSrc;
            bool   rc         = this.Func_SetAV2(gua, out gateSrc);
            string gatesrcurl = string.Empty;

            try
            {
                if (rc && !string.IsNullOrEmpty(gateSrc))
                {
                    string gatesrc = gateSrc;
                    gatesrcurl = DC2Conf.GetGateSrcUrl(gateSrc);
                    if (gatesrc == "025")
                    {
                        gatesrcurl += (gatesrcurl.IndexOf("?") == -1 ? "?" : "&") + string.Format("{0}={1}&tid={2}", "email", gua.UavEMail, gua.UavGUID);
                    }
                    gatesrcurl = gatesrcurl.Replace("=", "%3d");
                    gatesrcurl = gatesrcurl.Replace("&", "%26");
                }
            }
            catch (Exception e)
            {
                gatesrcurl = null;
            }
            htb.Add("gate", gua.UavGate);
            htb.Add("gatesrcurl", gatesrcurl);
            if (rc)
            {
                return(this.FuncResult(new APIReturn(0, string.Empty, htb)));
            }
            else
            {
                return(this.FuncResult(new APIReturn(0, "激活帐号失败", htb)));
            }
        }
Beispiel #2
0
        public static string Lib_Friend_GetName(string acct)
        {
            string[] acctspt = acct.Split('@');
            if (acctspt.Length != 2)
            {
                return(string.Empty);
            }
            string domain = acctspt[1].ToLower();

            string[] fFirendListExt = DC2Conf.FirendAcctExt();

            int index = Array.IndexOf(fFirendListExt, domain);

            return(index == -1 ? string.Empty : fFirendListExt[index]);
        }
Beispiel #3
0
        public IActionResult func_getshareid(int number, int userid, string gate, int server)
        {
            if (number < 10000 || userid < 10000 || string.IsNullOrEmpty(gate) || server <= 0)
            {
                Hashtable htb = new Hashtable();
                htb.Add("gate", gate);
                htb.Add("number", number);
                htb.Add("server", server);
                htb.Add("userid", userid);
                return(this.FuncResult(new APIReturn(10000, "参数错误", htb)));
            }
            ShareInfo shareinfo = Share.hasShareInfo(number, userid, gate, server);

            if (shareinfo == null)
            {
                string shareid = DC2016.Admin.DC2.Lib.D2lib.Lib_BuildCdKey(Share.getCount(), 6);

                ShareInfo share = new ShareInfo();
                share.Gate    = gate;
                share.Number  = number;
                share.Server  = server;
                share.Userid  = userid;
                share.Shareid = shareid;
                share         = Share.Insert(share);
                if (share == null)
                {
                    return(this.FuncResult(new APIReturn(10031, "获取分享id失败"))); //获取分享id失败
                }
                else
                {
                    Hashtable htb = new Hashtable();
                    htb.Add("shareid", DC2Conf.getshareUrl(gate) + shareid);
                    return(this.FuncResult(new APIReturn(0, "获取分享id成功", htb)));
                }
            }
            else
            {
                Hashtable htb = new Hashtable();
                htb.Add("shareid", DC2Conf.getshareUrl(gate) + shareinfo.Shareid);
                return(this.FuncResult(new APIReturn(0, "获取分享id成功", htb)));
            }
        }
Beispiel #4
0
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            this.Configuration = builder.Build();
            AppConf.Initialize(this.Configuration);

            string basePath = GetConfigPath.GetWebConfigPath();

            //DC2配置文件
            builder = new ConfigurationBuilder()
                      .SetBasePath(basePath)
                      .AddJsonFile("dc2.json", optional: true, reloadOnChange: true);
            DC2Conf.Initialize(builder.Build());

            // 配置MySQL连接
            DAL.SqlHelper.ConnectionString = DC2Conf.MySqlConnection;
            // 配置redis连接
            RedisHelper.ConnectionString = DC2Conf.RedisConnection;
        }
Beispiel #5
0
        public static bool Func_SendMail(D2unactiveInfo unactiveInfo, ViewRenderService viewRender)
        {
            string pName   = DC2Conf.GetPName(unactiveInfo.UavGate);
            string srcname = DC2Conf.GetGateSrcUrl(unactiveInfo.UavGateSrc);

            string title = string.Format("请确认您的{0}帐号", pName);
            string url   = string.Format(DC2Conf.AvUrlFormat, unactiveInfo.UavGUID, unactiveInfo.UavGate);

            if (unactiveInfo.UavFlag == 11 || unactiveInfo.UavFlag == 12)
            {
                url = string.Format(DC2Conf.AvNPUrlFormat, unactiveInfo.UavGUID, unactiveInfo.UavGate);
            }

            Hashtable cht_data = new Hashtable();

            cht_data["来源产品名"] = srcname;
            if (!string.IsNullOrWhiteSpace(srcname) && srcname.IndexOf("多益通") == -1)
            {
                title += string.Format("[{0}]", srcname);
            }
            cht_data["产品名"]   = pName;
            cht_data["用户帐号名"] = unactiveInfo.UavEMail;
            cht_data["链接地址"]  = url;
            string viewName = "letter_active";
            string fromName = "多益网络";

            if (IsTW(unactiveInfo.UavFlag ?? 0) && unactiveInfo.UavGateSrc == "dw")
            {
                title             = string.Format("请确认您的{0}帐号[夢想帝王]", "英雄通行證");
                cht_data["来源产品名"] = "夢想帝王";
                cht_data["产品名"]   = "英雄通行證";
                viewName          = "letter_active_tw";
                fromName          = "英雄網路";
                string urltw = url.Replace("hi.duoyi.com", "hi.herojoys.com");
                cht_data["链接地址"] = urltw;
            }
            if (DC2Conf.IsHerojoys)
            {
                title             = title.Replace("多益", "英雄");
                cht_data["产品名"]   = "英雄通行证";
                cht_data["来源产品名"] = cht_data["来源产品名"].ToString().Replace("多益", "英雄");
                fromName          = "英雄网络";
            }
            if (unactiveInfo.UavGate.ToLower() == "dw" || unactiveInfo.UavGate.ToLower() == "mx")//这些是确认邮件
            {
                viewName = "letter_confirmemail";
                title    = string.Format("请确认您在[{0}]使用的邮箱帐号", pName);
            }
            string viewPath = UrsHelper.GetTPLViewPath(viewName);
            string content  = viewRender.Render <Hashtable>(viewPath, cht_data);

            //this.EndFor(sw.ToString());
            bool rc = false;

            try
            {
                rc = D2lib.SendMail_Henhaoji(unactiveInfo, fromName, unactiveInfo.UavEMail, unactiveInfo.UavEMail, title, content, true);

                if (rc)
                {
                    D2unactive.Func_SetState(unactiveInfo.UavGUID, (int)EUAS.已发送);
                }
            }
            catch (Exception es)
            {
                if (es is FormatException)
                {
                    rc = true;
                    D2unactive.Func_SetState(unactiveInfo.UavGUID, (int)EUAS.异常);
                }
            }
            return(rc);
        }
Beispiel #6
0
        public static bool Func_SendMail(D2getpassInfo passInfo, string lang, ViewRenderService viewRender)
        {
            string pName = DC2Conf.GetPName(passInfo.GtpsGate);

            string title = string.Format("{0}-密码找回", pName);
            string url   = string.Format(DC2Conf.AgpUrlFormat, passInfo.GtpsGUID, passInfo.GtpsGate);

            string    viewName = "letter_getpass";
            Hashtable cht_data = new Hashtable();

            cht_data["产品名"]  = pName;
            cht_data["链接地址"] = url;
            string fromName = "多益网络";

            if (string.IsNullOrWhiteSpace(lang) || lang.ToLower() == "zh-tw")
            {
                title           = string.Format("{0}-密碼找回", "英雄通行證");
                viewName        = "letter_getpass_tw";
                cht_data["产品名"] = "英雄通行證";
                fromName        = "英雄網絡";
                string urltw = url.Replace("hi.duoyi.com", "hi.herojoys.com");
                cht_data["链接地址"] = urltw;
            }
            else if (DC2Conf.IsHerojoys)
            {
                title           = string.Format("{0}-密码找回", "英雄通行证");
                cht_data["产品名"] = "英雄通行证";
                fromName        = "英雄网络";
                string urltw = url.Replace("hi.duoyi.com", "dy.herojoys.com");
                cht_data["链接地址"] = urltw;
            }
            string viewPath     = UrsHelper.GetTPLViewPath(viewName);
            string content      = viewRender.Render <Hashtable>(viewPath, cht_data);
            string emailaddress = passInfo.GtpsEMail.ToLower();

            /*
             * TODO: 这里需要确认一下逻辑
             * if (emailaddress.EndsWith("@old.2980.com"))
             * {
             *  //old.2980.com的帐号进行特殊处理
             *  //发到该手机号@old.2980.com帐号原先登录游戏时的那个邮箱
             *  string mobile = emailaddress.Split('@')[0];
             *  URSOld2980 uold = new URSOld2980(Operator, mobile);
             *  if (URSOld2980.IsFill(uold))
             *      emailaddress = string.Format("{0}@2980.com", uold.UO_Account);
             * }
             */

            bool rc = false;

            try
            {
                rc = D2lib.SendMail_Henhaoji(null, fromName, emailaddress, emailaddress, title, content, true);

                if (rc)
                {
                    D2getpass.SetState(passInfo.GtpsGUID, (int)EGST.已发送);
                }
            }
            catch (Exception es)
            {
                if (es is FormatException)
                {
                    D2getpass.SetState(passInfo.GtpsGUID, (int)EGST.异常);
                }
                Log.Logger.LogCritical(es.ToString());
            }
            return(rc);
        }