예제 #1
0
        public JsonResult JinyongNews()
        {
            int formInt  = GameRequest.GetFormInt("id", 0);
            int formInt2 = GameRequest.GetFormInt("value", -1);

            if (formInt > 0 && formInt2 >= 0)
            {
                try
                {
                    FacadeManage.aideNativeWebFacade.JinyongNews(formInt, formInt2);
                    return(Json(new
                    {
                        IsOk = true,
                        Msg = "操作成功"
                    }));
                }
                catch
                {
                    return(Json(new
                    {
                        IsOk = false,
                        Msg = "操作失败"
                    }));
                }
            }
            return(Json(new
            {
                IsOk = false,
                Msg = "参数错误"
            }));
        }
예제 #2
0
        public string Save(HttpRequest req)
        {
            string module = GetModuleName(Convert.ToInt32(req["moduleType"] ?? "0"));

            try
            {
                Base_Users user = new Base_Users();
                user.UserID          = Convert.ToInt32(req["AdminID"] ?? "0");
                user.Username        = GameRequest.GetFormString("UserName");
                user.canHasSubAgent  = Convert.ToByte(req.Form["canHasSub"]);
                user.AgentLevelLimit = Convert.ToInt32(req.Form["AgentLevelLimit"]);
                user.RoleID          = Convert.ToInt32(req.Form["RoleID"]);
                user.GradeID         = Convert.ToInt32(req.Form["GradeID"]);
                user.Nullity         = byte.Parse(GameRequest.GetFormString("AgentStatus"));
                user.Percentage      = GameRequest.GetFormInt("Revenue", 0);

                Message msg = aidePlatformManagerFacade.ModifyUserInfo(user);
                if (msg.Success)
                {
                    LogHelper2.SaveSuccessLog("修改[" + req.Form["UserName"] + "]", userExt.UserID, (int)LogOperationEnum.EditAgent, GameRequest.GetUserIP(), module);
                    return(JsonResultHelper.GetSuccessJson("保存成功"));
                }
                else
                {
                    LogHelper2.SaveErrLog("修改[" + req.Form["UserName"] + "]", msg.Content, userExt.UserID, (int)LogOperationEnum.EditAgent, GameRequest.GetUserIP(), module);
                    return(JsonResultHelper.GetErrorJson(msg.Content));
                }
            }
            catch (Exception ex)
            {
                LogHelper2.SaveErrLog("修改[" + req.Form["UserName"] + "]", ex.Message, userExt.UserID, (int)LogOperationEnum.EditAgent, GameRequest.GetUserIP(), module);
                return(JsonResultHelper.GetErrorJson(ex.Message));
            }
        }
예제 #3
0
        /// <summary>
        /// 通过游戏ID获取游戏信息
        /// </summary>
        /// <param name="context"></param>
        private void GetUserInfo(HttpContext context)
        {
            int gameID = GameRequest.GetFormInt("GameID", 0);

            if (gameID == 0)
            {
                ajv.msg = "游戏ID输入非法";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            AccountsInfo info = FacadeManage.aideAccountsFacade.GetAccountInfoByGameID(gameID);

            if (info.UserID != 0)
            {
                ajv.SetValidDataValue(true);
                ajv.AddDataItem("UserID", info.UserID);
                ajv.AddDataItem("Accounts", info.Accounts);
            }
            else
            {
                ajv.msg = "未找到该用户信息";
            }
            context.Response.Write(ajv.SerializeToJson());
        }
예제 #4
0
        /// <summary>
        /// 更新转账返利配置
        /// </summary>
        /// <param name="context"></param>
        private void UpdateTransferReturnConfig(HttpContext context)
        {
            //验证权限
            int             moduleID = 313;
            AdminPermission adminPer = new AdminPermission(userExt, moduleID);

            if (!adminPer.GetPermission((long)Permission.Edit))
            {
                ajv.msg = "非法操作,无操作权限";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            int    id      = GameRequest.GetFormInt("id", 0);
            string type    = GameRequest.GetFormString("ReturnType");
            string percent = GameRequest.GetFormString("ReturnPercent");

            //验证ID
            if (id == 0)
            {
                ajv.msg = "非法操作,无效的配置标识";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证类型
            if (!Utils.Validate.IsPositiveInt(type))
            {
                ajv.msg = "输入的类型格式不正确";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }
            //验证数量
            if (!Utils.Validate.IsPositiveInt(percent))
            {
                ajv.msg = "输入的返利比例格式不正确";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            TransferReturnConfig model = new TransferReturnConfig();

            model.ConfigID      = id;
            model.ReturnType    = Convert.ToByte(type);
            model.ReturnPercent = Convert.ToInt32(percent);

            int result = FacadeManage.aideTreasureFacade.UpdateTransferReturnConfig(model);

            if (result > 0)
            {
                ajv.msg = "修改成功";
                ajv.SetValidDataValue(true);
            }
            else
            {
                ajv.msg = "修改失败";
            }
            context.Response.Write(ajv.SerializeToJson());
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //定义变量
            userName = GameRequest.GetFormString("txtPayAccounts");
            string reUserName = GameRequest.GetFormString("txtPayReAccounts");

            money     = GameRequest.GetFormInt("hdfSalePrice", 0);
            sendUrl   = System.Configuration.ConfigurationSettings.AppSettings["DaySendUrl"];    //导向地址
            notifyUrl = System.Configuration.ConfigurationSettings.AppSettings["DayNotifyUrl"];  //同步回调地址
            string key = System.Configuration.ConfigurationSettings.AppSettings["DayKey"];       //密钥

            merId = System.Configuration.ConfigurationSettings.AppSettings["DayMerId"];          //商户ID


            //验证参数
            if (userName != reUserName)
            {
                ShowAndRedirect("两次输入的用户名不一致", "/Pay/PayDay.aspx");
                return;
            }
            if (money == 0)
            {
                ShowAndRedirect("金额输入有误", "/Pay/PayDay.aspx");
                return;
            }

            //生成订单
            orderID = PayHelper.GetOrderIDByPrefix("Day");      //订单号
            OnLineOrder onlineOrder = new OnLineOrder( );

            onlineOrder.ShareID = 2;
            onlineOrder.OrderID = orderID;
            if (Fetch.GetUserCookie( ) == null)
            {
                onlineOrder.OperUserID = 0;
            }
            else
            {
                onlineOrder.OperUserID = Fetch.GetUserCookie( ).UserID;
            }
            onlineOrder.Accounts    = userName;
            onlineOrder.CardTotal   = 1;
            onlineOrder.CardTypeID  = money < 30 ? 1 : money < 60 ? 2 : money < 120 ? 3 : 4;
            onlineOrder.OrderAmount = money;
            onlineOrder.IPAddress   = GameRequest.GetUserIP( );
            TreasureFacade treasureFacade = new TreasureFacade( );
            Message        umsg           = treasureFacade.RequestOrder(onlineOrder);

            if (!umsg.Success)
            {
                RenderAlertInfo(true, umsg.Content, 2);
                return;
            }

            //生成sign签名
            string signStr = merId + "|" + orderID + "|" + money + "|" + sendUrl + "|" + userName + "|" + key;

            sign = EncryptMD5(signStr, false, 32);
        }
예제 #6
0
        /// <summary>
        /// 获取用户昵称
        /// </summary>
        /// <param name="context"></param>
        protected void GetNickNameByGameID(HttpContext context)
        {
            AjaxJsonValid ajv = new AjaxJsonValid();

            int gameid = GameRequest.GetFormInt("gameid", 0);

            string account = FacadeManage.aideAccountsFacade.GetAccountsByGameID(gameid);

            ajv.AddDataItem("account", account);
            ajv.SetValidDataValue(true);
            context.Response.Write(ajv.SerializeToJson());
        }
예제 #7
0
        /// <summary>
        /// 获取房卡总返利
        /// </summary>
        /// <param name="context"></param>
        protected void GetTotalRoomCardRebate(HttpContext context)
        {
            AjaxJsonValid ajv = new AjaxJsonValid();

            int userid = GameRequest.GetFormInt("userid", 0);

            string rebate = FacadeManage.aidePlatformFacade.GetTotalRoomCardRebate(userid);

            ajv.AddDataItem("rebate", rebate);
            ajv.SetValidDataValue(true);
            context.Response.Write(ajv.SerializeToJson());
        }
예제 #8
0
        public void RetrievePassword(HttpContext context)
        {
            Message       msg      = new Message();
            AjaxJsonValid ajaxJson = new AjaxJsonValid();

            string answer1    = GameRequest.GetFormString("Answer1");
            string answer2    = GameRequest.GetFormString("Answer2");
            string answer3    = GameRequest.GetFormString("Answer3");
            string password   = GameRequest.GetFormString("Password");
            string rePassword = GameRequest.GetFormString("RePassword");
            int    userID     = GameRequest.GetFormInt("UserID", 0);

            #region 参数验证
            if (string.IsNullOrEmpty(answer1) || string.IsNullOrEmpty(answer2) || string.IsNullOrEmpty(answer3))
            {
                ajaxJson.msg = "抱歉,密保答案不能为空";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (string.IsNullOrEmpty(password))
            {
                ajaxJson.msg = "抱歉,新密码不能为空";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (password != rePassword)
            {
                ajaxJson.msg = "抱歉,两次密码输入不一致";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (userID <= 0)
            {
                ajaxJson.msg = "抱歉,找回密码用户不存在";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            #endregion 参数验证

            AccountsProtect protect = new AccountsProtect();
            protect.UserID      = userID;
            protect.LogonPass   = TextEncrypt.EncryptPassword(password);
            protect.Response1   = answer1;
            protect.Response2   = answer2;
            protect.Response3   = answer3;
            protect.LastLogonIP = GameRequest.GetUserIP();

            Message umsg = FacadeManage.aideAccountsFacade.ResetLogonPasswd(protect);
            ajaxJson.SetValidDataValue(umsg.Success);
            ajaxJson.msg = umsg.Content;
            context.Response.Write(ajaxJson.SerializeToJson());
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int    typeid  = GameRequest.GetFormInt("typeid", 0);
                string content = GameRequest.GetFormString("content");

                if (typeid <= 0 || typeid > 2)
                {
                    lbTip.Text        = "抱歉,找回密码方式选择错误!";
                    fmStep2.Visible   = false;
                    fmStep3.Visible   = true;
                    btnSubmit.Visible = false;
                    return;
                }
                if (typeid == 2 && !Utils.Validate.IsPositiveInt(content))
                {
                    lbTip.Text        = "抱歉,输入的游戏ID格式错误!";
                    fmStep2.Visible   = false;
                    fmStep3.Visible   = true;
                    btnSubmit.Visible = false;
                    return;
                }

                Message msg = typeid == 1 ? FacadeManage.aideAccountsFacade.GetUserSecurityByAccounts(content)
                    : FacadeManage.aideAccountsFacade.GetUserSecurityByGameID(Convert.ToInt32(content));

                if (msg.Success)
                {
                    AccountsProtect protect = msg.EntityList[0] as AccountsProtect;
                    if (protect != null)
                    {
                        lbQuestion1.Text = protect.Question1;
                        lbQuestion2.Text = protect.Question2;
                        lbQuestion3.Text = protect.Question3;
                        hfUser.Value     = protect.UserID.ToString();
                    }
                    else
                    {
                        fmStep2.Visible = false;
                        fmStep3.Visible = true;
                    }
                }
                else
                {
                    lbTip.Text        = msg.Content;
                    fmStep2.Visible   = false;
                    fmStep3.Visible   = true;
                    btnSubmit.Visible = false;
                }
            }
        }
예제 #10
0
        /// <summary>
        /// 获取用户昵称
        /// </summary>
        /// <param name="context"></param>
        protected void GetNickNameByGameID(HttpContext context)
        {
            AjaxJsonValid ajv = new AjaxJsonValid();

            int gameid = GameRequest.GetFormInt("gameid", 0);

            AccountsInfo info = FacadeManage.aideAccountsFacade.GetAccountsInfoByGameID(gameid);

            ajv.SetDataItem("nickname", info != null ? info.NickName : "");
            ajv.SetDataItem("compellation", info != null ? info.Compellation : "");
            ajv.SetValidDataValue(true);
            context.Response.Write(ajv.SerializeToJson());
        }
예제 #11
0
        protected void UserSpreadInfo()
        {
            UserTicketInfo userCookie = Fetch.GetUserCookie();

            if (userCookie == null)
            {
                base.Response.Write("{\"code\":-1,\"msg\":\"由于长时间未操作,请重新从大厅操作\"}");
                base.Response.End();
            }
            else
            {
                int formInt             = GameRequest.GetFormInt("dtype", 0);
                System.Data.DataTable o = FacadeManage.aideAccountsFacade.MySpreadInfo(userCookie.UserID, formInt);
                string str = JsonHelper.SerializeObject(o);
                base.Response.Write("{\"code\":0,\"data\":" + str + "}");
                base.Response.End();
            }
        }
예제 #12
0
        public JsonResult GetOnlineCountTimeList()
        {
            int formInt = GameRequest.GetFormInt("ServerID", 0);

            if (formInt <= 0)
            {
                return(Json(new
                {
                    IsOk = false,
                    Msg = "参数错误"
                }));
            }
            DataTable onlineCount = FacadeManage.aidePlatformFacade.GetOnlineCount(formInt);

            return(Json(new
            {
                IsOk = true,
                Msg = "",
                Total = onlineCount.Rows.Count,
                Data = JsonHelper.SerializeObject(onlineCount)
            }));
        }
예제 #13
0
        protected void MySpreadCheck()
        {
            int formInt = GameRequest.GetFormInt("id", 0);

            if (formInt <= 0)
            {
                base.Response.Write("{\"code\":-1,\"msg\":\"推广码只能为数字\"}");
                base.Response.End();
            }
            Message message = FacadeManage.aideAccountsFacade.MySpreadCheck(formInt);

            if (message.Success)
            {
                System.Data.DataSet dataSet = message.EntityList[0] as System.Data.DataSet;
                base.Response.Write("{\"code\":0,\"data\":" + JsonHelper.SerializeObject(dataSet.Tables[0]) + "}");
                base.Response.End();
            }
            else
            {
                base.Response.Write("{\"code\":-1,\"msg\":\"" + message.Content + "\"}");
                base.Response.End();
            }
        }
예제 #14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("ry");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string text4 = text;

            switch (text4)
            {
            case "alipay":
                text = "36";
                onLineOrder.ShareID = 2;
                goto IL_240;

            case "weixin":
                text = "33";
                onLineOrder.ShareID = 3;
                goto IL_240;

            case "alipay-scan":
                text                = "2";
                this.paytype        = "支付宝";
                onLineOrder.ShareID = 4;
                goto IL_240;

            case "weixin-scan":
                text                = "21";
                this.paytype        = "微信";
                onLineOrder.ShareID = 5;
                goto IL_240;

            case "qq":
                text = "92";
                onLineOrder.ShareID = 6;
                goto IL_240;

            case "qq-scan":
                text                = "89";
                this.paytype        = "QQ";
                onLineOrder.ShareID = 8;
                goto IL_240;

            case "kuaijie":
                text = "32";
                onLineOrder.ShareID = 7;
                goto IL_240;
            }
            text = "1";
            onLineOrder.ShareID = 1;
IL_240:
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string str   = ApplicationSettings.Get("url_ruyi");
            string value = ApplicationSettings.Get("parter_ruyi");
            string text2 = ApplicationSettings.Get("key_ruyi");
            string text3 = ApplicationSettings.Get("pay_url");

            if (text3 == "")
            {
                text3 = "http://" + base.Request.Url.Host;
            }
            string orderID = onLineOrder.OrderID;
            string value2  = text3 + "/pay/ruyi/notify_url.aspx";

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["P_UserID"]     = value;
            dictionary["P_OrderID"]    = orderID;
            dictionary["P_FaceValue"]  = formInt.ToString("#0.00");
            dictionary["P_Price"]      = formInt.ToString("#0.00");
            dictionary["P_ChannelID"]  = text;
            dictionary["P_Result_URL"] = value2;
            dictionary["P_Notify_URL"] = value2;
            string password = string.Format("{0}|{1}|||{2}|{3}|{4}", new object[]
            {
                dictionary["P_UserID"],
                dictionary["P_OrderID"],
                dictionary["P_FaceValue"],
                dictionary["P_ChannelID"],
                text2
            });
            string value3 = TextEncrypt.EncryptPassword(password).ToLower();

            dictionary["P_PostKey"] = value3;
            string url = str + "?" + PayHelper.PrepareSign(dictionary);

            base.Response.Redirect(url);
        }
예제 #15
0
        protected void btnPay_Click(object sender, EventArgs e)
        {
            string strAccounts   = CtrlHelper.GetText(txtPayAccounts);
            string strReAccounts = CtrlHelper.GetText(txtPayReAccounts);
            int    salePrice     = GameRequest.GetFormInt("rbSaleType", 0);

            if (strAccounts == "")
            {
                RenderAlertInfo(true, "抱歉,请输入充值帐号。", 2);
                return;
            }
            if (strReAccounts != strAccounts)
            {
                RenderAlertInfo(true, "抱歉,两次输入的帐号不一致。", 2);
                return;
            }
            if (salePrice < 10)
            {
                RenderAlertInfo(true, "抱歉,充值金额必须大于10元", 2);
                return;
            }

            OnLineOrder onlineOrder = new OnLineOrder();

            onlineOrder.ShareID = 12;
            onlineOrder.OrderID = PayHelper.GetOrderIDByPrefix("SX");

            #region 订单处理

            if (Fetch.GetUserCookie() == null)
            {
                onlineOrder.OperUserID = 0;
            }
            else
            {
                onlineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onlineOrder.Accounts    = strAccounts;
            onlineOrder.CardTotal   = 1;
            onlineOrder.CardTypeID  = salePrice < 30 ? 1 : salePrice < 60 ? 2 : salePrice < 120 ? 3 : 4;
            onlineOrder.OrderAmount = salePrice;
            onlineOrder.IPAddress   = GameRequest.GetUserIP();

            //生成订单
            Message umsg = treasureFacade.RequestOrder(onlineOrder);
            if (!umsg.Success)
            {
                RenderAlertInfo(true, umsg.Content, 2);
                return;
            }

            #endregion

            #region 提交给V币网关

            string spid      = ApplicationSettings.Get("spId");                                                  //换成商户sp号码 长度5位
            string sppwd     = ApplicationSettings.Get("spKeyValue");                                            //换成商户sp校验密钥  长度18位
            string spreq     = "http://" + HttpContext.Current.Request.Url.Authority + "/Pay/PayVB.aspx";        //换成商户请求地址
            string sprec     = "http://" + HttpContext.Current.Request.Url.Authority + "/Pay/PayVBReceive.aspx"; //换成商户接收地址
            string spname    = Server.UrlEncode(ApplicationSettings.Get("spName"));                              //需要 Server.UrlEncode编码
            string spcustom  = onlineOrder.CardTotal.ToString("f0");                                             //需要 Server.UrlEncode编码  '客户自定义 30字符内 只能是数字、字母或数字字母的组合。不能用汉字。
            string spversion = "vpay1001";                                                                       //此接口的版本号码 此版本是"vpay1001"
            string money     = onlineOrder.OrderAmount.ToString("f0");                                           //接参数面值元
            string userid    = Server.UrlEncode(onlineOrder.Accounts);                                           //接参数用户ID 需要 Server.UrlEncode编码
            string urlcode   = "utf-8";                                                                          //编码  gbk  gb2312   utf-8  unicode   big5(注意不能一个繁体和简体字交叉写)  你程序的编码
            string orderId   = onlineOrder.OrderID;                                                              //客户订单 请妥善管理客户的订单  长度:30字符以内(只能是数字、字母或数字字母的组合。不能用汉字订单)
            string post_key  = orderId + spreq + sprec + spid + sppwd + spversion + money;
            // '网站订单号码+ 请求地址+ 接收地址 + 5位spid+ 18位SP密码+支付的版本号+面值
            //'LCase函数是将字符转换为小写; Ucase函数是将字符转换为大写
            //'全国声讯支付联盟全国声讯电话支付接口对MD5值只认大写字符串,所以小写的MD5值得转换为大写
            string md5password = TextEncrypt.EncryptPassword(post_key).ToUpper();//  '先MD532 然后转大写
            md5password = md5(post_key, 32).ToUpper( );
            string IpAddress = (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null &&
                                HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != String.Empty)
              ? HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]
              : HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

            #endregion

            #region 整理参数

            RenderAlertInfo(false, "页面正跳转到支付平台,请稍候。。。", 2);

            HtmlGenericControl pnlSubmit = this.FindControl("pnlSubmit") as HtmlGenericControl;
            if (pnlSubmit != null)
            {
                pnlSubmit.Visible = true;
            }

            StringBuilder builder = new StringBuilder();
            builder.AppendLine(CreateInputHidden("spid", spid));
            builder.AppendLine(CreateInputHidden("spname", spname));
            builder.AppendLine(CreateInputHidden("spoid", orderId));
            builder.AppendLine(CreateInputHidden("spreq", spreq));
            builder.AppendLine(CreateInputHidden("sprec", sprec));
            builder.AppendLine(CreateInputHidden("userid", userid));
            builder.AppendLine(CreateInputHidden("userip", IpAddress));
            builder.AppendLine(CreateInputHidden("spmd5", md5password));
            builder.AppendLine(CreateInputHidden("spcustom", spcustom));
            builder.AppendLine(CreateInputHidden("spversion", spversion));
            builder.AppendLine(CreateInputHidden("money", money));
            builder.AppendLine(CreateInputHidden("urlcode", urlcode));

            litVB.Text = builder.ToString();

            #endregion

            //this.Page.ClientScript.RegisterStartupScript( this.GetType( ) , "message" , "window.onload = function() {  document.forms[1].submit(); }" , true );
        }
예제 #16
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!IsValid)
            {
                return;
            }

            #region 验证
            string strAccount    = TextFilter.FilterAll(CtrlHelper.GetText(txtAccount));
            string strNickName   = TextFilter.FilterAll(CtrlHelper.GetText(txtNickName));
            string strLogonPass  = CtrlHelper.GetText(txtLogonPass);
            string strLogonPass2 = CtrlHelper.GetText(txtLogonPass2);

            int accountsLength = System.Text.Encoding.Default.GetBytes(strAccount).Length;
            if (accountsLength > 32 || accountsLength < 6)
            {
                MessageBox("游戏帐号的长度为6-32位,中文算两位");
                return;
            }

            if (string.IsNullOrEmpty(strNickName))
            {
                strNickName = strAccount;
            }
            else
            {
                int nickNameLength = System.Text.Encoding.Default.GetBytes(strNickName).Length;
                if (nickNameLength > 32 || nickNameLength < 6)
                {
                    MessageBox("昵称的的长度为6-32位,中文算两位");
                    return;
                }
            }


            //计算用户权限
            int intUserRight = 0;
            if (ckbUserRight.Items.Count > 0)
            {
                foreach (ListItem item in ckbUserRight.Items)
                {
                    if (item.Selected)
                    {
                        intUserRight |= int.Parse(item.Value);
                    }
                }
            }
            //计算管理权限
            int intMasterRight = 0;
            if (ckbMasterRight.Items.Count > 0)
            {
                foreach (ListItem item in ckbMasterRight.Items)
                {
                    if (item.Selected)
                    {
                        intMasterRight |= int.Parse(item.Value);
                    }
                }
            }
            #endregion

            AccountsInfo    account = new AccountsInfo();
            IndividualDatum datum   = new IndividualDatum();

            account.Accounts    = strAccount;
            account.NickName    = strNickName;
            account.LogonPass   = Utility.MD5(strLogonPass);
            account.InsurePass  = string.IsNullOrEmpty(CtrlHelper.GetText(txtInsurePass)) ? Utility.MD5(strLogonPass) : Utility.MD5(CtrlHelper.GetText(txtInsurePass));
            account.DynamicPass = TextUtility.CreateRandom(32, 1, 1, 1, 0, "");
            account.UnderWrite  = TextFilter.FilterAll(CtrlHelper.GetText(txtUnderWrite));

            account.Present     = CtrlHelper.GetInt(txtPresent, 0);
            account.LoveLiness  = CtrlHelper.GetInt(txtLoveLiness, 0);
            account.Experience  = CtrlHelper.GetInt(txtExperience, 0);
            account.Gender      = byte.Parse(ddlGender.SelectedValue);
            account.FaceID      = (short)GameRequest.GetFormInt("inFaceID", 0);
            account.Nullity     = (byte)(ckbNullity.Checked ? 1 : 0);
            account.StunDown    = (byte)(ckbStunDown.Checked ? 1 : 0);
            account.MoorMachine = byte.Parse(rdoMoorMachine.SelectedValue);

            account.IsAndroid   = (byte)(chkIsAndroid.Checked ? 1 : 0);
            account.UserRight   = intUserRight;
            account.MasterRight = intMasterRight;
            account.MasterOrder = Convert.ToByte(ddlMasterOrder.SelectedValue.Trim());

            account.Compellation     = TextFilter.FilterAll(CtrlHelper.GetText(txtCompellation));
            account.MemberOrder      = byte.Parse(ddlMemberOrder.SelectedValue);
            account.MemberOverDate   = string.IsNullOrEmpty(CtrlHelper.GetText(txtMemberOverDate)) ? Convert.ToDateTime("1980-01-01") : Convert.ToDateTime(CtrlHelper.GetText(txtMemberOverDate));
            account.MemberSwitchDate = string.IsNullOrEmpty(CtrlHelper.GetText(txtMemberOverDate)) ? Convert.ToDateTime("1980-01-01") : Convert.ToDateTime(CtrlHelper.GetText(txtMemberOverDate));
            account.RegisterIP       = GameRequest.GetUserIP();

            datum.QQ            = TextFilter.FilterAll(CtrlHelper.GetText(txtQQ));
            datum.EMail         = TextFilter.FilterAll(CtrlHelper.GetText(txtEMail));
            datum.SeatPhone     = TextFilter.FilterAll(CtrlHelper.GetText(txtSeatPhone));
            datum.MobilePhone   = TextFilter.FilterAll(CtrlHelper.GetText(txtMobilePhone));
            datum.PostalCode    = TextFilter.FilterAll(CtrlHelper.GetText(txtPostalCode));
            datum.DwellingPlace = TextFilter.FilterAll(CtrlHelper.GetText(txtDwellingPlace));
            datum.UserNote      = TextFilter.FilterAll(CtrlHelper.GetText(txtUserNote));

            Message msg = FacadeManage.aideAccountsFacade.AddAccount(account, datum);
            if (msg.Success)
            {
                Page.ClientScript.RegisterStartupScript(typeof(Page), "", string.Format("alert(\"{0}\");location.href='{1}';", "添加成功", Request.Url.AbsoluteUri), true);
            }
            else
            {
                MessageBox(msg.Content);
            }
        }
예제 #17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("lf");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string text4 = text;

            switch (text4)
            {
            case "alipay":
                text = "alipaywap";
                onLineOrder.ShareID = 2;
                goto IL_240;

            case "weixin":
                text = "wxh5";
                onLineOrder.ShareID = 3;
                goto IL_240;

            case "alipay-scan":
                text                = "alipay";
                this.paytype        = "支付宝";
                onLineOrder.ShareID = 4;
                goto IL_240;

            case "weixin-scan":
                text                = "weixin";
                this.paytype        = "微信";
                onLineOrder.ShareID = 5;
                goto IL_240;

            case "qq":
                text = "qqwallet";
                onLineOrder.ShareID = 6;
                goto IL_240;

            case "qq-scan":
                text                = "QQZF";
                this.paytype        = "QQ";
                onLineOrder.ShareID = 8;
                goto IL_240;

            case "kuaijie":
                text = "bank";
                onLineOrder.ShareID = 7;
                goto IL_240;
            }
            text = "bank";
            onLineOrder.ShareID = 1;
IL_240:
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string str   = ApplicationSettings.Get("url_lf");
            string value = ApplicationSettings.Get("parter_lf");
            string text2 = ApplicationSettings.Get("key_lf");
            string text3 = ApplicationSettings.Get("pay_url");

            if (text3 == "")
            {
                text3 = "http://" + base.Request.Url.Host;
            }
            string orderID = onLineOrder.OrderID;
            string value2  = text3 + "/pay/laifu/notify_url.aspx";

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["version"]    = "1.0";
            dictionary["customerid"] = value;
            dictionary["sdorderno"]  = orderID;
            dictionary["total_fee"]  = formInt.ToString("#0.00");
            dictionary["paytype"]    = text;
            dictionary["notifyurl"]  = value2;
            dictionary["returnurl"]  = value2;
            string password = string.Format("version={0}&customerid={1}&total_fee={2}&sdorderno={3}&notifyurl={4}&returnurl={5}&{6}", new object[]
            {
                dictionary["version"],
                dictionary["customerid"],
                dictionary["total_fee"],
                dictionary["sdorderno"],
                dictionary["notifyurl"],
                dictionary["returnurl"],
                text2
            });
            string value3 = TextEncrypt.EncryptPassword(password).ToLower();

            dictionary["bankcode"] = "";
            dictionary["remark"]   = "";
            dictionary["sign"]     = value3;
            string url = str + "?" + PayHelper.PrepareSign(dictionary);

            base.Response.Redirect(url);
        }
예제 #18
0
        /// <summary>
        /// 更新等级配置
        /// </summary>
        private void UpdateLevelConfig(HttpContext context)
        {
            //验证权限
            int             moduleID = 408;
            AdminPermission adminPer = new AdminPermission(userExt, moduleID);

            if (!adminPer.GetPermission((long)Permission.Delete))
            {
                ajv.msg = "非法操作,无操作权限";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            int    levelID    = GameRequest.GetFormInt("id", 0);
            string experience = GameRequest.GetFormString("experience");
            string gold       = GameRequest.GetFormString("gold");
            string medal      = GameRequest.GetFormString("medal");
            string remark     = GameRequest.GetFormString("remark");

            //验证ID
            if (levelID == 0)
            {
                ajv.msg = "非法操作,无效的等级标识";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证经验值
            if (!Utils.Validate.IsNumeric(experience))
            {
                ajv.msg = "请输入正确的经验值";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证金币
            if (!Utils.Validate.IsNumeric(gold))
            {
                ajv.msg = "请输入正确的金币";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证元宝
            if (!Utils.Validate.IsNumeric(medal))
            {
                ajv.msg = "请输入正确的元宝";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证备注
            if (remark.Length > 64)
            {
                ajv.msg = "备注的最大长度不能超过64";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            GrowLevelConfig glc = new GrowLevelConfig();

            glc.LevelID     = levelID;
            glc.Experience  = Convert.ToInt32(experience);
            glc.RewardGold  = Convert.ToInt32(gold);
            glc.RewardMedal = Convert.ToInt32(medal);
            glc.LevelRemark = remark;

            int result = FacadeManage.aidePlatformFacade.UpdateGrowLevelConfig(glc);

            if (result > 0)
            {
                ajv.msg = "修改成功";
                ajv.SetValidDataValue(true);
            }
            else
            {
                ajv.msg = "修改失败";
            }
            context.Response.Write(ajv.SerializeToJson());
        }
예제 #19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            #region 验证
            string strAccount    = TextFilter.FilterAll(CtrlHelper.GetText(txtAccount));
            string strNickName   = TextFilter.FilterAll(CtrlHelper.GetText(txtNickName));
            string strLogonPass  = CtrlHelper.GetText(txtLogonPass);
            string strLogonPass2 = CtrlHelper.GetText(txtLogonPass2);

            if (string.IsNullOrEmpty(strAccount))
            {
                MessageBox("用户名不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(strLogonPass))
            {
                MessageBox("登录密码不能为空!");
                return;
            }
            if (!strLogonPass.Equals(strLogonPass2))
            {
                MessageBox("两次输入的登录密码不一样!");
                return;
            }
            if (string.IsNullOrEmpty(strNickName))
            {
                strNickName = strAccount;
            }


            //计算用户权限
            int intUserRight = 0;
            if (ckbUserRight.Items.Count > 0)
            {
                foreach (ListItem item in ckbUserRight.Items)
                {
                    if (item.Selected)
                    {
                        intUserRight |= int.Parse(item.Value);
                    }
                }
            }
            //计算管理权限
            int intMasterRight = 0;
            if (ckbMasterRight.Items.Count > 0)
            {
                foreach (ListItem item in ckbMasterRight.Items)
                {
                    if (item.Selected)
                    {
                        intMasterRight |= int.Parse(item.Value);
                    }
                }
            }
            #endregion
            AccountsInfo    account = new AccountsInfo( );
            IndividualDatum datum   = new IndividualDatum( );

            account.Accounts   = strAccount;
            account.NickName   = strNickName;
            account.LogonPass  = Utility.MD5(strLogonPass);
            account.InsurePass = string.IsNullOrEmpty(CtrlHelper.GetText(txtInsurePass)) ? Utility.MD5(strLogonPass) : Utility.MD5(CtrlHelper.GetText(txtInsurePass));
            account.UnderWrite = TextFilter.FilterAll(CtrlHelper.GetText(txtUnderWrite));

            account.Present     = CtrlHelper.GetInt(txtPresent, 0);
            account.LoveLiness  = CtrlHelper.GetInt(txtLoveLiness, 0);
            account.Experience  = CtrlHelper.GetInt(txtExperience, 0);
            account.Gender      = byte.Parse(ddlGender.SelectedValue);
            account.FaceID      = ( short )GameRequest.GetFormInt("inFaceID", 0);
            account.Nullity     = ( byte )(ckbNullity.Checked ? 1 : 0);
            account.StunDown    = ( byte )(ckbStunDown.Checked ? 1 : 0);
            account.MoorMachine = byte.Parse(rdoMoorMachine.SelectedValue);

            account.IsAndroid   = ( byte )(chkIsAndroid.Checked ? 1 : 0);
            account.UserRight   = intUserRight;
            account.MasterRight = intMasterRight;
            account.MasterOrder = Convert.ToByte(ddlMasterOrder.SelectedValue.Trim( ));

            account.Compellation     = TextFilter.FilterAll(CtrlHelper.GetText(txtCompellation));
            account.MemberOrder      = byte.Parse(ddlMemberOrder.SelectedValue);
            account.MemberOverDate   = string.IsNullOrEmpty(CtrlHelper.GetText(txtMemberOverDate)) ? Convert.ToDateTime("1980-01-01") : Convert.ToDateTime(CtrlHelper.GetText(txtMemberOverDate));
            account.MemberSwitchDate = string.IsNullOrEmpty(CtrlHelper.GetText(txtMemberOverDate)) ? Convert.ToDateTime("1980-01-01") : Convert.ToDateTime(CtrlHelper.GetText(txtMemberOverDate));
            account.RegisterIP       = GameRequest.GetUserIP( );

            datum.QQ            = TextFilter.FilterAll(CtrlHelper.GetText(txtQQ));
            datum.EMail         = TextFilter.FilterAll(CtrlHelper.GetText(txtEMail));
            datum.SeatPhone     = TextFilter.FilterAll(CtrlHelper.GetText(txtSeatPhone));
            datum.MobilePhone   = TextFilter.FilterAll(CtrlHelper.GetText(txtMobilePhone));
            datum.PostalCode    = TextFilter.FilterAll(CtrlHelper.GetText(txtPostalCode));
            datum.DwellingPlace = TextFilter.FilterAll(CtrlHelper.GetText(txtDwellingPlace));
            datum.UserNote      = TextFilter.FilterAll(CtrlHelper.GetText(txtUserNote));


            Message msg = aideAccountsFacade.AddAccount(account, datum);
            if (msg.Success)
            {
                //MessageBox( "添加成功" );
                Page.ClientScript.RegisterStartupScript(typeof(Page), "", string.Format("alert(\"{0}\");location.href='{1}';", "添加成功", Request.Url.AbsoluteUri), true);
                //Redirect( Request.Url.AbsoluteUri );
            }
            else
            {
                string strMessage = "";
                int    intMsgID   = msg.MessageID;
                switch (intMsgID)
                {
                case -5:
                    strMessage = "帐号已存在,请重新输入!";    //您所输入的帐号名含有限制字符串
                    break;

                case -4:
                    strMessage = "昵称已存在,请重新输入!";
                    break;

                case -3:
                    strMessage = "帐号已存在,请重新输入!";
                    break;

                case -2:
                    strMessage = "参数有误!";
                    break;

                case -1:
                    strMessage = "抱歉,未知服务器错误!";
                    break;

                case 1:
                    strMessage = "用户添加成功,但未成功获取游戏 ID 号码!";
                    break;

                default:
                    strMessage = "抱歉,未知服务器错误!";
                    break;
                }

                MessageBox(strMessage);
            }
        }
예제 #20
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("ruiyun");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string text6 = text;

            switch (text6)
            {
            case "alipay":
                text = "1006";
                onLineOrder.ShareID = 2;
                goto IL_240;

            case "weixin":
                text = "1005";
                onLineOrder.ShareID = 3;
                goto IL_240;

            case "alipay-scan":
                text                = "992";
                this.paytype        = "支付宝";
                onLineOrder.ShareID = 4;
                goto IL_240;

            case "weixin-scan":
                text                = "1004";
                this.paytype        = "微信";
                onLineOrder.ShareID = 5;
                goto IL_240;

            case "qq":
                text = "1594";
                onLineOrder.ShareID = 6;
                goto IL_240;

            case "qq-scan":
                text                = "1593";
                this.paytype        = "QQ";
                onLineOrder.ShareID = 8;
                goto IL_240;

            case "kuaijie":
                text = "2088";
                onLineOrder.ShareID = 7;
                goto IL_240;
            }
            text = "1";
            onLineOrder.ShareID = 1;
IL_240:
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string arg   = ApplicationSettings.Get("url_ruiyun");
            string text2 = ApplicationSettings.Get("parter_ruiyun");
            string str   = ApplicationSettings.Get("key_ruiyun");
            string text3 = ApplicationSettings.Get("pay_url");

            if (text3 == "")
            {
                text3 = "http://" + base.Request.Url.Host;
            }
            string arg_29A_0 = onLineOrder.OrderID;
            string text4     = text3 + "/pay/ruiyun/notify_url.aspx";
            string text5     = string.Format("parter={0}&type={1}&value={2}&orderid={3}&callbackurl={4}", new object[]
            {
                text2,
                text,
                onLineOrder.OrderAmount,
                onLineOrder.OrderID,
                text4
            });
            string url = string.Format("{0}?{1}&sign={2}", arg, text5, System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text5 + str, "MD5").ToLower());

            base.Response.Redirect(url);
        }
예제 #21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("gf");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string text3 = text;

            switch (text3)
            {
            case "alipay":
                text = "1006";
                onLineOrder.ShareID = 2;
                goto IL_240;

            case "weixin":
                text = "1007";
                onLineOrder.ShareID = 3;
                goto IL_240;

            case "alipay-scan":
                text                = "992";
                this.paytype        = "支付宝";
                onLineOrder.ShareID = 4;
                goto IL_240;

            case "weixin-scan":
                text                = "1004";
                this.paytype        = "微信";
                onLineOrder.ShareID = 5;
                goto IL_240;

            case "qq":
                text = "92";
                onLineOrder.ShareID = 6;
                goto IL_240;

            case "qq-scan":
                text                = "993";
                this.paytype        = "QQ";
                onLineOrder.ShareID = 8;
                goto IL_240;

            case "kuaijie":
                text = "1005";
                onLineOrder.ShareID = 7;
                goto IL_240;
            }
            text = "1";
            onLineOrder.ShareID = 1;
IL_240:
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string str   = ApplicationSettings.Get("url_gf");
            string value = ApplicationSettings.Get("parter_gf");
            string str2  = ApplicationSettings.Get("key_gf");
            string text2 = ApplicationSettings.Get("pay_url");

            if (text2 == "")
            {
                text2 = "http://" + base.Request.Url.Host;
            }
            string orderID = onLineOrder.OrderID;
            string value2  = text2 + "/pay/guifu/notify_url.aspx";

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["parter"]      = value;
            dictionary["type"]        = text;
            dictionary["value"]       = formInt.ToString("#0.00");
            dictionary["orderid"]     = orderID;
            dictionary["callbackurl"] = value2;
            string str3   = PayHelper.PrepareSign(dictionary);
            string value3 = TextEncrypt.EncryptPassword(str3 + str2).ToLower();

            dictionary["hrefbackurl"] = value2;
            dictionary["sign"]        = value3;
            string url = str + "?" + PayHelper.PrepareSign(dictionary);

            base.Response.Redirect(url);
        }
예제 #22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 20)
            {
                base.Response.Write("充值金额不能低于20");
                base.Response.End();
            }
            GameRequest.GetFormString("type");
            string str             = "http://pay.cffsye.top";
            string text            = "UTF-8";
            string text2           = "V3.0";
            string text3           = ApplicationSettings.Get("parter_zhifu");
            string text4           = str + "/pay/zhifubank/notify_url.aspx";
            string text5           = formInt.ToString();
            string orderIDByPrefix = PayHelper.GetOrderIDByPrefix("zf");
            string text6           = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string text7           = "RSA-S";
            string text8           = "";
            string text9           = "";
            string text10          = "test";
            string text11          = "";
            string text12          = str + "/pay/zhifubank/notify_url.aspx";
            string text13          = "direct_pay";
            string text14          = "";
            string text15          = "";
            string text16          = "";
            string text17          = "";
            string text18          = "";
            string text19          = "";
            string text20          = "";
            string text21          = "";
            string text22          = "";

            if (text17 != "")
            {
                text22 = text22 + "bank_code=" + text17 + "&";
            }
            if (text18 != "")
            {
                text22 = text22 + "client_ip=" + text18 + "&";
            }
            if (text19 != "")
            {
                text22 = text22 + "client_ip_check=" + text19 + "&";
            }
            if (text15 != "")
            {
                text22 = text22 + "extend_param=" + text15 + "&";
            }
            if (text16 != "")
            {
                text22 = text22 + "extra_return_param=" + text16 + "&";
            }
            if (text != "")
            {
                text22 = text22 + "input_charset=" + text + "&";
            }
            if (text2 != "")
            {
                text22 = text22 + "interface_version=" + text2 + "&";
            }
            if (text3 != "")
            {
                text22 = text22 + "merchant_code=" + text3 + "&";
            }
            if (text4 != "")
            {
                text22 = text22 + "notify_url=" + text4 + "&";
            }
            if (text5 != "")
            {
                text22 = text22 + "order_amount=" + text5 + "&";
            }
            if (orderIDByPrefix != "")
            {
                text22 = text22 + "order_no=" + orderIDByPrefix + "&";
            }
            if (text6 != "")
            {
                text22 = text22 + "order_time=" + text6 + "&";
            }
            if (text21 != "")
            {
                text22 = text22 + "pay_type=" + text21 + "&";
            }
            if (text8 != "")
            {
                text22 = text22 + "product_code=" + text8 + "&";
            }
            if (text9 != "")
            {
                text22 = text22 + "product_desc=" + text9 + "&";
            }
            if (text10 != "")
            {
                text22 = text22 + "product_name=" + text10 + "&";
            }
            if (text11 != "")
            {
                text22 = text22 + "product_num=" + text11 + "&";
            }
            if (text20 != "")
            {
                text22 = text22 + "redo_flag=" + text20 + "&";
            }
            if (text12 != "")
            {
                text22 = text22 + "return_url=" + text12 + "&";
            }
            if (text13 != "")
            {
                text22 = text22 + "service_type=" + text13;
            }
            if (text14 != "")
            {
                text22 = text22 + "&show_url=" + text14;
            }
            if (text7 == "RSA-S")
            {
                string privateKey = ApplicationSettings.Get("merPriKey_zhifu");
                privateKey = HttpHelp.RSAPrivateKeyJava2DotNet(privateKey);
                string value = HttpHelp.RSASign(text22, privateKey);
                this.sign.Value = value;
            }
            this.merchant_code.Value      = text3;
            this.bank_code.Value          = text17;
            this.order_no.Value           = orderIDByPrefix;
            this.order_amount.Value       = text5;
            this.service_type.Value       = text13;
            this.input_charset.Value      = text;
            this.notify_url.Value         = text4;
            this.interface_version.Value  = text2;
            this.sign_type.Value          = text7;
            this.order_time.Value         = text6;
            this.product_name.Value       = text10;
            this.client_ip.Value          = text18;
            this.client_ip_check.Value    = text19;
            this.extend_param.Value       = text15;
            this.extra_return_param.Value = text16;
            this.product_code.Value       = text8;
            this.product_desc.Value       = text9;
            this.product_num.Value        = text11;
            this.return_url.Value         = text12;
            this.show_url.Value           = text14;
            this.redo_flag.Value          = text20;
            this.pay_type.Value           = text21;
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = orderIDByPrefix;
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            onLineOrder.ShareID     = 1;
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
        }
예제 #23
0
        /// <summary>
        /// 移动购买奖品
        /// </summary>
        /// <param name="context"></param>
        public void MobileBuyAward(HttpContext context)
        {
            Message       msg      = new Message();
            AjaxJsonValid ajaxJson = new AjaxJsonValid();

            int    userID    = GameRequest.GetFormInt("userID", 0);          //用户标识
            string signature = GameRequest.GetFormString("signature");       //签名
            string time      = GameRequest.GetFormString("time");            //过期时间

            //验证签名
            Message message = FacadeManage.aideAccountsFacade.CheckUserSignature(userID, time, signature);

            if (!message.Success)
            {
                ajaxJson.msg = message.Content;
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //获取参数
            int    awardID       = GameRequest.GetFormInt("awardID", 0);                          //商品ID
            int    counts        = GameRequest.GetFormInt("counts", 0);                           //购买数量
            string compellation  = TextFilter.FilterScript(GameRequest.GetFormString("name"));    //真实姓名
            string mobilePhone   = TextFilter.FilterScript(GameRequest.GetFormString("phone"));   //移动电话
            int    province      = GameRequest.GetFormInt("province", -1);                        //省份
            int    city          = GameRequest.GetFormInt("city", -1);                            //城市
            int    area          = GameRequest.GetFormInt("area", -1);                            //地区
            string dwellingPlace = TextFilter.FilterScript(GameRequest.GetFormString("address")); //详细地址

            //验证奖品
            if (awardID == 0)
            {
                ajaxJson.msg = "非常抱歉,你所选购的商品不存在!";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //验证数量
            if (counts <= 0)
            {
                ajaxJson.msg = "请输入正确的兑换数量!";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (counts > 99)
            {
                ajaxJson.msg = "每次兑换的数量最多为 99 件";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            AwardInfo awardInfo = FacadeManage.aideNativeWebFacade.GetAwardInfo(awardID);

            //验证真实姓名
            msg = CheckingRealNameFormat(compellation, false);
            if (!msg.Success)
            {
                ajaxJson.msg = "请输入正确的收件人";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //验证手机号
            msg = CheckingMobilePhoneNumFormat(mobilePhone, false);
            if (!msg.Success)
            {
                ajaxJson.msg = "请输入正确的手机号码";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //验证地址
            if (province == -1)
            {
                ajaxJson.msg = "请选择省份";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (city == -1)
            {
                ajaxJson.msg = "请选择城市";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (area == -1)
            {
                ajaxJson.msg = "请选择地区";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (string.IsNullOrEmpty(dwellingPlace))
            {
                ajaxJson.msg = "请输入详细地址";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //  防止数据溢出,商品单价不能超过2000万
            if (awardInfo.Price > 20000000)
            {
                ajaxJson.msg = "很抱歉,该商品暂停兑换!";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //验证用户
            UserInfo userInfo = FacadeManage.aideAccountsFacade.GetUserGlobalInfo(userID, 0, "").EntityList[0] as UserInfo;

            //验证余额
            int totalAmount = awardInfo.Price * counts;     //总金额

            if (totalAmount > userInfo.UserMedal)
            {
                ajaxJson.msg = "很抱歉!您的元宝数不足,不能兑换该奖品";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //验证库存
            if (awardInfo.Inventory <= counts)
            {
                ajaxJson.msg = "很抱歉!奖品的库存数不足,请更新其他奖品或者等待补充库存";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //扣除奖牌
            userInfo.UserMedal = userInfo.UserMedal - totalAmount;

            //更新奖牌
            AwardOrder awardOrder = new AwardOrder();

            awardOrder.UserID        = userInfo.UserID;
            awardOrder.AwardID       = awardID;
            awardOrder.AwardPrice    = awardInfo.Price;
            awardOrder.AwardCount    = counts;
            awardOrder.TotalAmount   = totalAmount;
            awardOrder.Compellation  = compellation;
            awardOrder.MobilePhone   = mobilePhone;
            awardOrder.QQ            = "";
            awardOrder.Province      = province;
            awardOrder.City          = city;
            awardOrder.Area          = area;
            awardOrder.DwellingPlace = dwellingPlace;
            awardOrder.PostalCode    = "";
            awardOrder.BuyIP         = Utility.UserIP;

            msg = FacadeManage.aideNativeWebFacade.BuyAward(awardOrder);
            if (msg.Success)
            {
                ajaxJson.SetValidDataValue(true);
                ajaxJson.msg = "恭喜您!兑换成功";
                awardOrder   = msg.EntityList[0] as AwardOrder;
                context.Response.Write(ajaxJson.SerializeToJson());
            }
            else
            {
                ajaxJson.msg = msg.Content;
                context.Response.Write(ajaxJson.SerializeToJson());
            }
        }
예제 #24
0
        protected void btnPay_Click(object sender, EventArgs e)
        {
            string strAccounts   = CtrlHelper.GetText(txtPayAccounts);
            string strReAccounts = CtrlHelper.GetText(txtPayReAccounts);
            int    salePrice     = GameRequest.GetFormInt("rbSaleType", 0);
            string gamePayType   = GameRequest.GetFormString("rbPayGType");

            if (strAccounts == "")
            {
                RenderAlertInfo(true, "抱歉,请输入充值帐号。", 2);
                return;
            }
            if (strReAccounts != strAccounts)
            {
                RenderAlertInfo(true, "抱歉,两次输入的帐号不一致。", 2);
                return;
            }
            if (salePrice < 30)
            {
                RenderAlertInfo(true, "抱歉,充值金额必须大于30元", 2);
                return;
            }

            OnLineOrder onlineOrder = new OnLineOrder();

            onlineOrder.ShareID = gamePayType == "C" ? 7 : gamePayType == "D" ? 8 : gamePayType == "M" ? 9 : gamePayType == "N" ? 10 : 11;
            onlineOrder.OrderID = gamePayType == "C" ? PayHelper.GetOrderIDByPrefix("SD") : gamePayType == "D" ? PayHelper.GetOrderIDByPrefix("ZT") : gamePayType == "M" ? PayHelper.GetOrderIDByPrefix("WY") : gamePayType == "N" ? PayHelper.GetOrderIDByPrefix("SH") : PayHelper.GetOrderIDByPrefix("WM");

            #region 订单处理

            if (Fetch.GetUserCookie() == null)
            {
                onlineOrder.OperUserID = 0;
            }
            else
            {
                onlineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onlineOrder.Accounts    = strAccounts;
            onlineOrder.CardTotal   = 1;
            onlineOrder.CardTypeID  = salePrice < 30 ? 1 : salePrice < 60 ? 2 : salePrice < 120 ? 3 : 4;
            onlineOrder.OrderAmount = salePrice;
            onlineOrder.IPAddress   = GameRequest.GetUserIP();

            //生成订单
            Message umsg = treasureFacade.RequestOrder(onlineOrder);
            if (!umsg.Success)
            {
                RenderAlertInfo(true, umsg.Content, 2);
                return;
            }

            #endregion

            #region 提交给快钱支付网关

            //商户号
            string merchantAcctId = ApplicationSettings.Get("merchantIdGame");

            //人民币网关密钥
            ///区分大小写.请与快钱联系索取
            string key = ApplicationSettings.Get("keyValueGame");

            //商户订单号
            string orderId = onlineOrder.OrderID.Trim();

            //支付金额
            string orderAmount = onlineOrder.OrderAmount.ToString();
            //string orderAmount = "1.00";

            //充值卡类型c 盛大一卡通d 征途游戏卡m网易一卡通n 搜狐一卡通u 完美一卡通
            string payType = gamePayType;

            //前台接收并显示页面,公网地址
            string pageUrl = "http://" + HttpContext.Current.Request.Url.Authority + "/Pay/PayShow.aspx";

            //支付结果底层发送的接收页面 后台接收页面
            string bgUrl = "http://" + HttpContext.Current.Request.Url.Authority + "/Pay/PayGameReceive.aspx";

            //扩展字段1
            string ext1 = "0";
            //扩展字段2
            string ext2 = "";

            //MD5签名 MD5签名:把请求支付的部分参数与KEY(商户后台可自行修改)拼凑成字符串经过国际标准32位MD5加密转换成大写

            String signMsgVal = "";
            signMsgVal = AppendParam(signMsgVal, "merchantAcctId", merchantAcctId);
            signMsgVal = AppendParam(signMsgVal, "orderId", orderId);
            signMsgVal = AppendParam(signMsgVal, "orderAmount", orderAmount);
            signMsgVal = AppendParam(signMsgVal, "payType", payType);
            signMsgVal = AppendParam(signMsgVal, "pageUrl", pageUrl);
            signMsgVal = AppendParam(signMsgVal, "bgUrl", bgUrl);
            signMsgVal = AppendParam(signMsgVal, "ext1", HttpUtility.UrlEncode(ext1, Encoding.GetEncoding("gb2312")).Trim());
            signMsgVal = AppendParam(signMsgVal, "ext2", HttpUtility.UrlEncode(ext2, Encoding.GetEncoding("gb2312")).Trim());
            signMsgVal = AppendParam(signMsgVal, "key", key);
            string signMsg = TextEncrypt.EncryptPassword(signMsgVal).ToUpper();
            #endregion

            RenderAlertInfo(false, "页面正跳转到支付平台,请稍候。。。", 2);

            #region 整理参数

            string getData = "";
            getData = AppendAllParam(getData, "merchantAcctId", merchantAcctId);
            getData = AppendAllParam(getData, "orderId", orderId);
            getData = AppendAllParam(getData, "orderAmount", orderAmount);
            getData = AppendAllParam(getData, "payType", payType);
            getData = AppendAllParam(getData, "pageUrl", HttpUtility.UrlEncode(pageUrl, Encoding.GetEncoding("gb2312")).Trim());
            getData = AppendAllParam(getData, "bgUrl", HttpUtility.UrlEncode(bgUrl, Encoding.GetEncoding("gb2312")).Trim());
            getData = AppendAllParam(getData, "ext1", HttpUtility.UrlEncode(ext1, Encoding.GetEncoding("gb2312")).Trim());
            getData = AppendAllParam(getData, "ext2", HttpUtility.UrlEncode(ext2, Encoding.GetEncoding("gb2312")).Trim());
            getData = AppendAllParam(getData, "signMsg", signMsg);

            string posturl = this.Page.Form.Action + "?" + getData;

            #endregion

            Response.Redirect(posturl);
        }
예제 #25
0
        /// <summary>
        /// 上传自定义头像
        /// </summary>
        /// <param name="context"></param>
        public void UploadFace(HttpContext context)
        {
            Message       msg = new Message();
            AjaxJsonValid ajv = new AjaxJsonValid();

            int    userID    = GameRequest.GetFormInt("userID", 0);         // 用户标识
            string signature = GameRequest.GetFormString("signature");      // 签名数据
            string time      = GameRequest.GetFormString("time");           // 过期时间
            string clientIP  = GameRequest.GetFormString("clientIP");       // 客户端IP
            string machineID = GameRequest.GetFormString("machineID");      // 机器码ID

            // 验证签名
            //Message message = FacadeManage.aideAccountsFacade.CheckUserSignature(userID, time, signature);
            //if (!message.Success)
            //{
            //    ajv.msg = message.Content;
            //    context.Response.Write(ajv.SerializeToJson());
            //    return;
            //}

            //// 验证数据
            //if (string.IsNullOrEmpty(clientIP))
            //{
            //    ajv.msg = "请传入IP地址!";
            //    context.Response.Write(ajv.SerializeToJson());
            //    return;
            //}
            //if (string.IsNullOrEmpty(machineID))
            //{
            //    ajv.msg = "请传入机器码ID!";
            //    context.Response.Write(ajv.SerializeToJson());
            //    return;
            //}

            // 最大上传 1M
            int maxSize = 1048576;

            // 验证文件格式
            if (context.Request.Files.Count == 0)
            {
                ajv.msg = "请选择一个头像!";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }
            HttpPostedFile file = context.Request.Files[0];

            if (file.InputStream == null || file.InputStream.Length == 0)
            {
                ajv.msg = "请上传有效的头像!";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }
            // 验证头像大小
            if (file.InputStream.Length > maxSize)
            {
                msg.Content = string.Format("头像不能超过 {0} M!", 1);
                context.Response.Write(ajv.SerializeToJson());
                return;
            }
            // 尝试转化为图片
            System.Drawing.Image image = null;
            try
            {
                image = System.Drawing.Image.FromStream(file.InputStream);
            }
            catch
            {
                image.Dispose();
                msg.Content = string.Format("非法文件,目前只支持图片格式文件,对您使用不便感到非常抱歉。");
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //缩放图片
            Bitmap   bitmap = new Bitmap(48, 48);
            Graphics g      = Graphics.FromImage(bitmap);

            g.DrawImage(image, 0, 0, 48, 48);

            //获取像素
            int x, y, site = 0;

            byte[] b = new byte[48 * 48 * 4];
            for (y = 0; y < 48; y++)
            {
                for (x = 0; x < 48; x++)
                {
                    Color pixelColor = bitmap.GetPixel(x, y);
                    b[site]     = pixelColor.B;
                    b[site + 1] = pixelColor.G;
                    b[site + 2] = pixelColor.R;
                    b[site + 3] = 0;
                    site        = site + 4;
                }
            }

            //保存图片
            AccountsFace accountsFace = new AccountsFace();

            accountsFace.UserID     = userID;
            accountsFace.CustomFace = b;
            accountsFace.InsertAddr = GameRequest.GetUserIP();
            accountsFace.InsertTime = DateTime.Now;
            msg = FacadeManage.aideAccountsFacade.InsertCustomFace(accountsFace);
            if (msg.Success)
            {
                AccountsInfo model = msg.EntityList[0] as AccountsInfo;
                ajv.AddDataItem("CustomID", model.CustomID);
            }
            ajv.msg = "上传成功!";
            ajv.SetValidDataValue(true);
            context.Response.Write(ajv.SerializeToJson());

            //释放资源
            image.Dispose();
            bitmap.Dispose();
            g.Dispose();
        }
예제 #26
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            decimal num = GameRequest.GetFormInt("amount", 0);

            if (num < 6m)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("hyf");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = num;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            if (text == "alipay-scan")
            {
                text = "4";
                onLineOrder.ShareID = 4;
            }
            else
            {
                if (text == "weixin-scan")
                {
                    onLineOrder.ShareID = 5;
                }
                else
                {
                    if (text == "kuaijie")
                    {
                        text = "10";
                        onLineOrder.ShareID = 7;
                    }
                }
            }
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string gateway = ApplicationSettings.Get("url_heyifu");
            string value   = ApplicationSettings.Get("partner_heyifu");
            string str     = ApplicationSettings.Get("key_heyifu");
            string text2   = ApplicationSettings.Get("pay_url");

            this.ordernumber = onLineOrder.OrderID;
            this.paymoney    = num.ToString();
            if (text2 == "")
            {
                text2 = "http://" + base.Request.Url.Host;
            }
            string value2 = text2 + "/pay/heyifu/notify_url.aspx";

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["apiName"]      = "WEB_PAY_B2C";
            dictionary["apiVersion"]   = "1.0.0.0";
            dictionary["platformID"]   = value;
            dictionary["merchNo"]      = value;
            dictionary["orderNo"]      = this.ordernumber;
            dictionary["tradeDate"]    = System.DateTime.Now.ToString("yyyyMMdd");
            dictionary["amt"]          = this.paymoney;
            dictionary["merchUrl"]     = value2;
            dictionary["merchParam"]   = "";
            dictionary["tradeSummary"] = "1|1";
            string str2   = PayHelper.PrepareSign(dictionary);
            string value3 = TextEncrypt.EncryptPassword(str2 + str);

            dictionary["bankCode"]      = "";
            dictionary["choosePayType"] = text;
            dictionary["signMsg"]       = value3;
            dictionary["overTime"]      = "";
            dictionary["customerIP"]    = GameRequest.GetUserIP();
            base.Response.Write(PayHelper.BuildForm(dictionary, gateway));
            base.Response.End();
        }
예제 #27
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      formString2 = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("45");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string value = "";

            if (formString2 == "alipay")
            {
                value = "";
                onLineOrder.ShareID = 2;
                this.paytype        = "支付宝";
            }
            if (formString2 == "weixin")
            {
                value = "";
                onLineOrder.ShareID = 3;
                this.paytype        = "微信";
            }
            if (formString2 == "weixin-scan")
            {
                value = "";
                onLineOrder.ShareID = 5;
                this.paytype        = "微信";
            }
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string url    = ApplicationSettings.Get("url_45");
            string value2 = ApplicationSettings.Get("parter_45");
            string text   = ApplicationSettings.Get("key_45");
            string text2  = ApplicationSettings.Get("pay_url");

            if (text2 == "")
            {
                text2 = "http://" + base.Request.Url.Host;
            }
            string value3 = text2 + "/pay/45/notify_url.aspx";

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["v"]          = "1.0";
            dictionary["uid"]        = value2;
            dictionary["orderid"]    = onLineOrder.OrderID;
            dictionary["title"]      = "shop";
            dictionary["note"]       = "";
            dictionary["istype"]     = value;
            dictionary["amount"]     = formInt.ToString();
            dictionary["userpara"]   = "";
            dictionary["receiveurl"] = value3;
            dictionary["userIP "]    = GameRequest.GetUserIP();
            dictionary["returnurl"]  = value3;
            string password = string.Concat(new object[]
            {
                dictionary["uid"],
                dictionary["orderid"],
                formInt,
                dictionary["receiveurl"],
                text
            });
            string value4 = TextEncrypt.EncryptPassword(password).ToLower();

            dictionary["sign"] = value4;
            string param = PayHelper.PrepareSign(dictionary);
            string json  = HttpHelper.HttpRequest(url, param);

            System.Collections.Generic.Dictionary <string, string> dictionary2 = JsonHelper.DeserializeJsonToObject <System.Collections.Generic.Dictionary <string, string> >(json);
            if (!dictionary2.ContainsKey("result"))
            {
                base.Response.Write("接口正在维护中...");
            }
            else
            {
                if (dictionary2["result"].ToString() == "ok")
                {
                    base.Response.Redirect(dictionary2["data"]);
                }
                else
                {
                    base.Response.Write(dictionary2["msg"].ToString());
                }
            }
        }
예제 #28
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("dd");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string text4 = text;

            switch (text4)
            {
            case "alipay":
                text = "010008";
                onLineOrder.ShareID = 2;
                goto IL_289;

            case "weixin":
                text = "010007";
                onLineOrder.ShareID = 3;
                goto IL_289;

            case "alipay-scan":
                text                = "010002";
                this.paytype        = "支付宝";
                onLineOrder.ShareID = 4;
                goto IL_289;

            case "weixin-scan":
                text                = "010001";
                this.paytype        = "微信";
                onLineOrder.ShareID = 5;
                goto IL_289;

            case "qq":
                text = "7";
                onLineOrder.ShareID = 6;
                goto IL_289;

            case "kuaijie":
                text = "010010";
                onLineOrder.ShareID = 7;
                goto IL_289;

            case "qq-scan":
                text                = "010000";
                this.paytype        = "QQ";
                onLineOrder.ShareID = 8;
                goto IL_289;

            case "jd":
                text = "6";
                onLineOrder.ShareID = 9;
                goto IL_289;

            case "baidu":
                text = "5";
                onLineOrder.ShareID = 10;
                goto IL_289;
            }
            text = "4";
            onLineOrder.ShareID = 1;
IL_289:
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string url   = ApplicationSettings.Get("url_dd");
            string value = ApplicationSettings.Get("parter_dd");
            string str   = ApplicationSettings.Get("key_dd");
            string text2 = ApplicationSettings.Get("pay_url");

            if (text2 == "")
            {
                text2 = "http://" + base.Request.Url.Host;
            }
            string orderID = onLineOrder.OrderID;
            string value2  = text2 + "/pay/diandian/notify_url.aspx";
            string str2    = "{\"mch_app_id\":\"http://www.qp137.com\",\"device_info\":\"AND_WAP\",\"ua\":\"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36\",\"mch_app_name\":\"支付测试\",\"cashier_desk\":\"1\"}";
            string s       = System.Web.HttpUtility.UrlEncode(str2);

            byte[] bytes  = System.Text.Encoding.UTF8.GetBytes(s);
            string value3 = System.Convert.ToBase64String(bytes);

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["version"]      = "1.0";
            dictionary["charset"]      = "utf-8";
            dictionary["merchant_id"]  = value;
            dictionary["out_trade_no"] = orderID;
            dictionary["user_ip"]      = GameRequest.GetUserIP();
            dictionary["subject"]      = "支付测试";
            dictionary["body"]         = "支付测试";
            dictionary["user_id"]      = formString;
            dictionary["total_fee"]    = formInt.ToString("#0.00");
            dictionary["notify_url"]   = value2;
            dictionary["return_url"]   = value2;
            dictionary["nonce_str"]    = TextUtility.CreateAuthStr(20, false);
            dictionary["biz_content"]  = value3;
            dictionary["trade_type"]   = text;
            dictionary = (
                from p in dictionary
                orderby p.Key
                select p).ToDictionary((System.Collections.Generic.KeyValuePair <string, string> p) => p.Key, (System.Collections.Generic.KeyValuePair <string, string> o) => o.Value);
            string str3 = PayHelper.PrepareSign(dictionary) + "&key=" + str;

            dictionary["sign"] = Jiami.MD5(str3).ToUpper();
            string param = PayHelper.ToXml(dictionary);
            string text3 = HttpHelper.HttpRequest(url, param, "post", "utf-8", "text/xml");

            System.Collections.Generic.Dictionary <string, string> dictionary2 = PayHelper.XmlToDic(text3);
            if (!dictionary2.ContainsKey("status"))
            {
                base.Response.Write(text3);
                base.Response.End();
            }
            else
            {
                string a = dictionary2["status"];
                if (a == "0")
                {
                    this.order_no     = orderID;
                    this.order_amount = formInt.ToString();
                    this.qrcode       = dictionary2["pay_info"];
                    base.Response.Redirect(this.qrcode);
                }
                else
                {
                    base.Response.Write(dictionary2["message"]);
                    base.Response.End();
                }
            }
        }
예제 #29
0
        /// <summary>
        /// 购买商品
        /// </summary>
        /// <param name="context"></param>
        public void BuyAward(HttpContext context)
        {
            Message       msg      = new Message();
            AjaxJsonValid ajaxJson = new AjaxJsonValid();

            //判断登录
            if (!Fetch.IsUserOnline())
            {
                ajaxJson.code = 1;
                ajaxJson.msg  = "请先登录";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //获取参数
            int    typeID        = GameRequest.GetQueryInt("TypeID", 0);
            int    awardID       = GameRequest.GetFormInt("awardID", 0);                          //商品ID
            int    counts        = GameRequest.GetFormInt("counts", 0);                           //购买数量
            string compellation  = TextFilter.FilterScript(GameRequest.GetFormString("name"));    //真实姓名
            string mobilePhone   = TextFilter.FilterScript(GameRequest.GetFormString("phone"));   //移动电话
            int    province      = GameRequest.GetFormInt("province", -1);                        //省份
            int    city          = GameRequest.GetFormInt("city", -1);                            //城市
            int    area          = GameRequest.GetFormInt("area", -1);                            //地区
            string dwellingPlace = TextFilter.FilterScript(GameRequest.GetFormString("address")); //详细地址

            //验证奖品
            if (awardID == 0)
            {
                ajaxJson.msg = "非常抱歉,你所选购的商品不存在!";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //验证数量
            if (counts <= 0)
            {
                ajaxJson.msg = "请输入正确的兑换数量!";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }
            if (counts > 100)
            {
                ajaxJson.msg = "兑换数量不能超过100!";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            AwardInfo awardInfo    = FacadeManage.aideNativeWebFacade.GetAwardInfo(awardID);
            int       needInfo     = awardInfo.NeedInfo;
            int       qqValue      = (int)AppConfig.AwardNeedInfoType.QQ号码;
            int       nameValue    = (int)AppConfig.AwardNeedInfoType.真实姓名;
            int       phoneValue   = (int)AppConfig.AwardNeedInfoType.手机号码;
            int       addressValue = (int)AppConfig.AwardNeedInfoType.收货地址及邮编;

            //验证真实姓名
            if ((needInfo & nameValue) == nameValue)
            {
                msg = CheckingRealNameFormat(compellation, false);
                if (!msg.Success)
                {
                    ajaxJson.msg = "请输入正确的收件人";
                    context.Response.Write(ajaxJson.SerializeToJson());
                    return;
                }
            }

            //验证手机号
            if ((needInfo & phoneValue) == phoneValue)
            {
                msg = CheckingMobilePhoneNumFormat(mobilePhone, false);
                if (!msg.Success)
                {
                    ajaxJson.msg = "请输入正确的手机号码";
                    context.Response.Write(ajaxJson.SerializeToJson());
                    return;
                }
            }

            //验证地址邮编
            if ((needInfo & addressValue) == addressValue)
            {
                if (province == -1)
                {
                    ajaxJson.msg = "请选择省份";
                    context.Response.Write(ajaxJson.SerializeToJson());
                    return;
                }
                if (city == -1)
                {
                    ajaxJson.msg = "请选择城市";
                    context.Response.Write(ajaxJson.SerializeToJson());
                    return;
                }
                if (area == -1)
                {
                    ajaxJson.msg = "请选择地区";
                    context.Response.Write(ajaxJson.SerializeToJson());
                    return;
                }
                if (string.IsNullOrEmpty(dwellingPlace))
                {
                    ajaxJson.msg = "请输入详细地址";
                    context.Response.Write(ajaxJson.SerializeToJson());
                    return;
                }
            }

            //验证用户
            UserInfo userInfo = FacadeManage.aideAccountsFacade.GetUserGlobalInfo(Fetch.GetUserCookie().UserID, 0, "").EntityList[0] as UserInfo;

            //验证余额
            int totalAmount = awardInfo.Price * counts;     //总金额

            if (totalAmount > userInfo.UserMedal)
            {
                ajaxJson.msg = "很抱歉!您的元宝数不足,不能兑换该奖品";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //验证库存
            if (awardInfo.Inventory <= 0)
            {
                ajaxJson.msg = "很抱歉!奖品的库存数不足,请更新其他奖品或者等待补充库存";
                context.Response.Write(ajaxJson.SerializeToJson());
                return;
            }

            //扣除奖牌
            userInfo.UserMedal = userInfo.UserMedal - totalAmount;

            //更新奖牌
            AwardOrder awardOrder = new AwardOrder();

            awardOrder.UserID        = userInfo.UserID;
            awardOrder.AwardID       = awardID;
            awardOrder.AwardPrice    = awardInfo.Price;
            awardOrder.AwardCount    = counts;
            awardOrder.TotalAmount   = totalAmount;
            awardOrder.Compellation  = compellation;
            awardOrder.MobilePhone   = mobilePhone;
            awardOrder.QQ            = "";
            awardOrder.Province      = province;
            awardOrder.City          = city;
            awardOrder.Area          = area;
            awardOrder.DwellingPlace = dwellingPlace;
            awardOrder.PostalCode    = "";
            awardOrder.BuyIP         = Utility.UserIP;

            msg = FacadeManage.aideNativeWebFacade.BuyAward(awardOrder);
            if (msg.Success)
            {
                ajaxJson.SetValidDataValue(true);
                ajaxJson.msg = "恭喜您!兑换成功";
                awardOrder   = msg.EntityList[0] as AwardOrder;
                if (typeID == 0)
                {
                    ajaxJson.AddDataItem("uri", "/Shop/Order.aspx?param=" + awardOrder.AwardID);
                }
                else
                {
                    ajaxJson.AddDataItem("uri", "/Mobile/Shop/Order.aspx?param=" + awardOrder.AwardID);
                }
                context.Response.Write(ajaxJson.SerializeToJson());
            }
            else
            {
                ajaxJson.msg = msg.Content;
                context.Response.Write(ajaxJson.SerializeToJson());
            }
        }
예제 #30
0
        /// <summary>
        /// 更新奖品配置
        /// </summary>
        /// <param name="context"></param>
        private void UpdateLotteryItem(HttpContext context)
        {
            //验证权限
            int             moduleID = 312;
            AdminPermission adminPer = new AdminPermission(userExt, moduleID);

            if (!adminPer.GetPermission((long)Permission.Edit))
            {
                ajv.msg = "非法操作,无操作权限";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            int    itemIndex = GameRequest.GetFormInt("id", 0);
            string itemType  = GameRequest.GetFormString("ItemType");
            string itemQuota = GameRequest.GetFormString("ItemQuota");
            string itemRate  = GameRequest.GetFormString("ItemRate");

            //验证ID
            if (itemIndex == 0)
            {
                ajv.msg = "非法操作,无效的奖品索引";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证类型
            if (!Utils.Validate.IsPositiveInt(itemType))
            {
                ajv.msg = "请输入正确的奖品类型";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }
            //验证数量
            if (!Utils.Validate.IsPositiveInt(itemQuota))
            {
                ajv.msg = "请输入正确的奖品数量";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }
            //验证中奖几率
            if (!Utils.Validate.IsPositiveInt(itemRate))
            {
                ajv.msg = "请输入正确的中奖几率";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            LotteryItem model = new LotteryItem();

            model.ItemIndex = itemIndex;
            model.ItemType  = Convert.ToInt32(itemType);
            model.ItemQuota = Convert.ToInt32(itemQuota);
            model.ItemRate  = Convert.ToInt32(itemRate);
            int result = FacadeManage.aideTreasureFacade.UpdateLotteryItem(model);

            if (result > 0)
            {
                ajv.msg = "修改成功";
                ajv.SetValidDataValue(true);
            }
            else
            {
                ajv.msg = "修改失败";
            }
            context.Response.Write(ajv.SerializeToJson());
        }