bool createQueryCond(ParamQueryPlayerWinLose p, ref string sqlCmd, ref string condCmd) { DateTime startT, endT; if (!DateTime.TryParseExact(p.m_startTime, CONST.DATE_TIME_FORMAT_PART_DAY, 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_PART_DAY, CONST.DATE_PROVIDER, DateTimeStyles.None, out endT)) { m_retData.Add("result", RetCode.RET_PARAM_NOT_VALID); return(false); } condCmd = string.Format(SQL_COUNT_COND, p.m_playerAcc, startT.ToString(ConstDef.DATE_TIME24), endT.ToString(ConstDef.DATE_TIME24)); if (p.m_countEachPage > 0) { sqlCmd = string.Format(SQL_RECORD, TableName.PLAYER_WIN_LOSE, startT.ToString(ConstDef.DATE_TIME24), endT.ToString(ConstDef.DATE_TIME24), p.m_playerAcc, (p.m_curPage - 1) * p.m_countEachPage, p.m_countEachPage); } return(true); }
protected void Page_Load(object sender, EventArgs e) { ParamQueryPlayerWinLose param = new ParamQueryPlayerWinLose(); 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; } QueryPlayerWinLoseReport query = new QueryPlayerWinLoseReport(); string retStr = query.doQuery(param); Response.Write(retStr); }
public override string doQuery(object param) { ParamQueryPlayerWinLose p = (ParamQueryPlayerWinLose)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)); } 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)); } string sqlCmd = "", cond = ""; bool code = createQueryCond(p, ref sqlCmd, ref cond); if (code) { m_retData.Add("result", RetCode.RET_SUCCESS); m_retData.Add("playerAcc", p.m_playerAcc); if (p.m_countEachPage == 0) // 返回条数 { long count = m_gmUser.sqlDb.getRecordCount(TableName.PLAYER_WIN_LOSE, cond, MySqlDbName.DB_XIANXIA); m_retData.Add("totalCount", count); } else { long count = m_gmUser.sqlDb.getRecordCount(TableName.PLAYER_WIN_LOSE, cond, MySqlDbName.DB_XIANXIA); m_retData.Add("totalCount", count); m_retData.Add("curPage", p.m_curPage); // 单位 m_retData.Add("moneyBase", CONST.MONEY_BASE); List <Dictionary <string, object> > dataList = m_gmUser.sqlDb.queryList(sqlCmd, MySqlDbName.DB_XIANXIA); m_retData.Add("record", dataList); } } return(Helper.genJsonStr(m_retData)); }