private void UpdateMapServer(int mapid, PayRecInfo info) { PackPayRecInfo pack_info = new PackPayRecInfo(); pack_info.order = info.order; pack_info.account = info.account; pack_info.money = info.money; pack_info.id = info.id; SessionManager.Instance().SendMapServer(mapid, pack_info.GetBuffer()); }
//载入充值数据记录 public void DB_Load() { String sql = string.Format("select * from cq_payrec where state = 0"); MySqlCommand command = new MySqlCommand(sql, MysqlConn.GetConn()); MysqlConn.Conn_Open(); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { if (!reader.HasRows) { break; } int id = reader.GetInt32("id"); PayRecInfo info = null; //检测到相同的id就不发了 bool bfind = false; foreach (PayRecInfo baseinfo in mDicPayInfo.Values) { if (baseinfo.id == id) { bfind = true; break; } } if (bfind) { continue; } info = new PayRecInfo(); if (!reader.HasRows) { break; } info.id = reader.GetInt32("id"); info.money = reader.GetInt32("money"); info.order = reader.GetString("order"); info.account = reader.GetString("account"); if (mDicPayInfo.ContainsKey(info.account)) { mDicPayInfo[info.account].money += info.money; } else { mDicPayInfo[info.account] = info; } //发送到Mapserver子服务器更新- UpdateMapServer(0, mDicPayInfo[info.account]); } MysqlConn.Conn_Close(); command.Dispose(); }
//载入充值数据记录 public void DB_Load() { String sql = string.Format("select * from cq_payrec where state = 0"); MySqlCommand command = new MySqlCommand(sql, MysqlConn.GetConn()); MysqlConn.Conn_Open(); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { if (!reader.HasRows) break; int id = reader.GetInt32("id"); PayRecInfo info = null; //检测到相同的id就不发了 bool bfind = false; foreach( PayRecInfo baseinfo in mDicPayInfo.Values) { if (baseinfo.id == id) { bfind = true; break; } } if (bfind) continue; info = new PayRecInfo(); if (!reader.HasRows) break; info.id = reader.GetInt32("id"); info.money = reader.GetInt32("money"); info.order = reader.GetString("order"); info.account = reader.GetString("account"); if (mDicPayInfo.ContainsKey(info.account)) { mDicPayInfo[info.account].money += info.money; } else { mDicPayInfo[info.account] = info; } //发送到Mapserver子服务器更新- UpdateMapServer(0,mDicPayInfo[info.account]); } MysqlConn.Conn_Close(); command.Dispose(); }
private void UpdateMapServer(int mapid,PayRecInfo info) { PackPayRecInfo pack_info = new PackPayRecInfo(); pack_info.order = info.order; pack_info.account = info.account; pack_info.money = info.money; pack_info.id = info.id; SessionManager.Instance().SendMapServer(mapid, pack_info.GetBuffer()); }