protected void Page_Load(object sender, EventArgs e)
        {
            ParamQueryPlayerMoneyChange param = new ParamQueryPlayerMoneyChange();

            param.m_gmAccount        = Request.QueryString["gmAcc"];
            param.m_gmPwd            = Request.QueryString["gmPwd"];
            param.m_playerAcc        = Request.QueryString["playerAcc"];
            param.m_curPageStr       = Request.QueryString["curPage"];
            param.m_countEachPageStr = Request.QueryString["countEachPage"];
            param.m_startTime        = Request.QueryString["startTime"];
            param.m_endTime          = Request.QueryString["endTime"];
            param.m_sign             = Request.QueryString["sign"];

            if (!param.isParamValid())
            {
                Dictionary <string, object> data = new Dictionary <string, object>();
                data.Add("result", RetCode.RET_PARAM_NOT_VALID);
                Response.Write(Helper.genJsonStr(data));
                return;
            }

            QueryPlayerMoneyChangeInGame query = new QueryPlayerMoneyChangeInGame();
            string retStr = query.doQuery(param);

            Response.Write(retStr);
        }
    // 构造查询条件
    bool createCond(ParamQueryPlayerMoneyChange p, ref IMongoQuery imq)
    {
        DateTime startT, endT;

        if (!DateTime.TryParseExact(p.m_startTime, CONST.DATE_TIME_FORMAT, CONST.DATE_PROVIDER, DateTimeStyles.None, out startT))
        {
            m_retData.Add("result", RetCode.RET_PARAM_NOT_VALID);
            return(false);
        }
        if (!DateTime.TryParseExact(p.m_endTime, CONST.DATE_TIME_FORMAT, CONST.DATE_PROVIDER, DateTimeStyles.None, out endT))
        {
            m_retData.Add("result", RetCode.RET_PARAM_NOT_VALID);
            return(false);
        }

        List <IMongoQuery> queryList = new List <IMongoQuery>();

        if (!string.IsNullOrEmpty(p.m_playerAcc))
        {
            Dictionary <string, object> data = Helper.getPlayerPropertyByAcc(p.m_playerAcc, new string[] { "player_id" });
            if (data == null)
            {
                m_retData.Add("result", RetCode.RET_NO_PLAYER);
                return(false);
            }
            if (!data.ContainsKey("player_id"))
            {
                m_retData.Add("result", RetCode.RET_NO_PLAYER);
                return(false);
            }

            queryList.Add(Query.EQ("playerId", BsonValue.Create(data["player_id"])));
        }
        else
        {
            Regex reg = new Regex("^" + transCode(m_gmUser.m_createCode) + ".*", RegexOptions.IgnoreCase);
            BsonRegularExpression regexp = new BsonRegularExpression(reg);
            IMongoQuery           tmp    = Query.Matches("creator", regexp);
            queryList.Add(tmp);
        }
        IMongoQuery imq1 = Query.LT("genTime", BsonValue.Create(endT));
        IMongoQuery imq2 = Query.GTE("genTime", BsonValue.Create(startT));

        queryList.Add(Query.And(imq1, imq2));
        imq = Query.And(queryList);

        return(true);
    }
    public override string doQuery(object param)
    {
        ParamQueryPlayerMoneyChange p = (ParamQueryPlayerMoneyChange)param;

        bool cres = createGMUser(p);

        if (!cres)
        {
            return(Helper.genJsonStr(m_retData));
        }
        if (!p.checkSign(m_gmUser))
        {
            m_retData.Add("result", RetCode.RET_SIGN_ERROR);
            return(Helper.genJsonStr(m_retData));
        }

        if (!string.IsNullOrEmpty(p.m_playerAcc))
        {
            Player player = new Player(p.m_playerAcc, m_gmUser);
            if (!player.m_isExists)
            {
                m_retData.Add("result", RetCode.RET_NO_PLAYER);
                return(Helper.genJsonStr(m_retData));
            }

            if (!player.isOwner(m_gmUser.m_acc))
            {
                m_retData.Add("result", RetCode.RET_NO_RIGHT);
                return(Helper.genJsonStr(m_retData));
            }
        }

        IMongoQuery imq  = null;
        bool        code = createCond(p, ref imq);

        if (!code)
        {
            return(Helper.genJsonStr(m_retData));
        }

        m_retData.Add("result", RetCode.RET_SUCCESS);

        if (!string.IsNullOrEmpty(p.m_playerAcc))
        {
            m_retData.Add("playerAcc", p.m_playerAcc);
        }

        if (p.m_countEachPage == 0) // 返回条数
        {
            long count = MongodbLog.Instance.ExecuteGetCount(TableName.LOG_PLAYER_INFO, imq);
            m_retData.Add("totalCount", count);  // 记录的总条数
        }
        else
        {
            long count = MongodbLog.Instance.ExecuteGetCount(TableName.LOG_PLAYER_INFO, imq);
            // m_retData.Add("totalCount", count);  // 记录的总条数
            // m_retData.Add("curPage", p.m_curPage);
            // 单位
            m_retData.Add("moneyBase", CONST.MONEY_BASE);

            List <Dictionary <string, object> > dataList =
                MongodbLog.Instance.ExecuteGetListByQuery(TableName.LOG_PLAYER_INFO, imq, s_fields, "genTime", false,
                                                          (p.m_curPage - 1) * p.m_countEachPage, p.m_countEachPage);

            m_retData.Add("record", dataList);

            Dictionary <string, object> pageInfo = new Dictionary <string, object>();
            m_retData.Add("pagination", pageInfo);
            pageInfo.Add("currentPage", p.m_curPage);
            pageInfo.Add("totalPages", (int)Math.Ceiling((double)count / p.m_countEachPage));
            pageInfo.Add("itemsPerPage", p.m_countEachPage);
            pageInfo.Add("totalCount", count);
        }

        return(Helper.genJsonStr(m_retData, true));
    }