protected void Page_Load(object sender, EventArgs e) { ParamQueryPlayerTrade param = new ParamQueryPlayerTrade(); 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_opTypeStr = Request.QueryString["opType"]; 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; } QueryPlayerTradeInfo query = new QueryPlayerTradeInfo(); string retStr = query.doQuery(param); Response.Write(retStr); }
private string getOpCond(ParamQueryPlayerTrade p) { if (p.m_opType == 0 || p.m_opType == 1) { return(string.Format(SQL_OP_COND, p.m_opType)); } return(""); }
public override string doQuery(object param) { ParamQueryPlayerTrade p = (ParamQueryPlayerTrade)param; 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(Helper.genJsonStr(m_retData)); } 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(Helper.genJsonStr(m_retData)); } 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)); } m_retData.Add("result", RetCode.RET_SUCCESS); m_retData.Add("playerAcc", p.m_playerAcc); if (p.m_countEachPage == 0) // 返回条数 { string cond = string.Format(SQL_COUNT_COND, p.m_playerAcc, startT.ToString(ConstDef.DATE_TIME24), endT.ToString(ConstDef.DATE_TIME24), getOpCond(p)); long count = m_gmUser.sqlDb.getRecordCount(TableName.GM_SCORE, cond, MySqlDbName.DB_XIANXIA); m_retData.Add("recordCount", count); } else { string cmd = string.Format(SQL_RECORD, TableName.GM_SCORE, p.m_playerAcc, startT.ToString(ConstDef.DATE_TIME24), endT.ToString(ConstDef.DATE_TIME24), getOpCond(p), (p.m_curPage - 1) * p.m_countEachPage, p.m_countEachPage); List <Dictionary <string, object> > dataList = m_gmUser.sqlDb.queryList(cmd, MySqlDbName.DB_XIANXIA); m_retData.Add("record", dataList); } return(Helper.genJsonStr(m_retData)); }