예제 #1
0
        /// <summary>
        /// 获取游戏记录
        /// </summary>
        /// <param name="context"></param>
        private void GetUserGameRecord(HttpContext context)
        {
            //验证权限
            int             moduleID = 809;
            AdminPermission adminPer = new AdminPermission(userExt, moduleID);

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

            int drawID = GameRequest.GetQueryInt("drawID", 0);

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

            //获取数据
            DataSet ds = FacadeManage.aideTreasureFacade.GetRecordDrawScoreByDrawID(drawID);

            if (ds.Tables[0].Rows.Count > 0)
            {
                //复制表结构
                DataTable dt = ds.Tables[0].Clone();

                //修改表列数据类型
                dt.Columns["IsAndroid"].DataType = typeof(string);
                dt.Columns["Score"].DataType     = typeof(string);
                dt.Columns["Revenue"].DataType   = typeof(string);

                for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                {
                    DataRow dw = dt.NewRow();
                    dw = ds.Tables[0].Rows[i];
                    dt.Rows.Add(dw.ItemArray);

                    //修改是否机器人数据项
                    if (Convert.ToInt32(dt.Rows[i]["IsAndroid"]) == 0)
                    {
                        dt.Rows[i]["IsAndroid"] = "否";
                    }
                    else
                    {
                        dt.Rows[i]["IsAndroid"] = "是";
                    }

                    //格式化输赢积分
                    dt.Rows[i]["Score"] = Convert.ToInt64(dt.Rows[i]["Score"]).ToString("N0");

                    //格式化税收
                    dt.Rows[i]["Revenue"] = Convert.ToInt32(dt.Rows[i]["Revenue"]).ToString("N0");
                }

                Game.Utils.Template            tm       = new Game.Utils.Template("/Template/UserGameRecord.html");
                Dictionary <string, DataTable> dicTable = new Dictionary <string, DataTable>();
                dicTable.Add("UserGameRecord", dt);
                tm.ForDataScoureList = dicTable;

                string html = tm.OutputHTML();
                ajv.AddDataItem("html", html);
            }

            //返回数据
            ajv.SetValidDataValue(true);
            context.Response.Write(ajv.SerializeToJson());
        }
예제 #2
0
        public string Logon(string userName, string userPass, string code)
        {
            string result;

            if (TextUtility.EmptyTrimOrNull(userName) || TextUtility.EmptyTrimOrNull(userPass))
            {
                string str = "抱歉!您输入的帐号或密码错误了。";
                result = "{success:'error',msg:'" + str + "'}";
            }
            else
            {
                if (!code.Equals(Fetch.GetVerifyCode(), System.StringComparison.InvariantCultureIgnoreCase))
                {
                    string str = "抱歉!您输入的验证码错误了。";
                    result = "{success:'error',msg:'" + str + "'}";
                }
                else
                {
                    Message message = FacadeManage.aideAccountsFacade.Logon(userName, userPass);
                    if (message.Success)
                    {
                        UserInfo userInfo = message.EntityList[0] as UserInfo;
                        Fetch.SetUserCookie(userInfo.ToUserTicketInfo());
                        var template = new Game.Utils.Template("/Template/UserInfo.html");
                        template.VariableDataScoureList = new System.Collections.Generic.Dictionary <string, object>
                        {
                            {
                                "accounts",
                                userInfo.Accounts
                            },

                            {
                                "gameID",
                                userInfo.GameID
                            },

                            {
                                "userType",
                                (userInfo.MemberOrder == 0) ? "普通会员" : ((userInfo.MemberOrder == 1) ? "蓝钻会员" : ((userInfo.MemberOrder == 2) ? "黄钻会员" : ((userInfo.MemberOrder == 3) ? "白钻会员" : ((userInfo.MemberOrder == 4) ? "红钻会员" : "VIP"))))
                            },

                            {
                                "loveLiness",
                                userInfo.LoveLiness
                            },

                            {
                                "faceUrl",
                                FacadeManage.aideAccountsFacade.GetUserFaceUrl((int)userInfo.FaceID, userInfo.CustomID)
                            }
                        };
                        System.Collections.Generic.Dictionary <string, object> dictionary = new System.Collections.Generic.Dictionary <string, object>();
                        dictionary.Add("success", "success");
                        dictionary.Add("html", template.OutputHTML());
                        result = new JavaScriptSerializer().Serialize(dictionary);
                    }
                    else
                    {
                        result = "{success:'error',msg:'" + message.Content + "'}";
                    }
                }
            }
            return(result);
        }