private ErrorCode DBAsynQueryUser(UserDBData userData, DBToCS.QueryUser queryUser, DBActiveWrapper db) { string sqlStr = $"select * from gameuser, gameuser_runne,gameuser_guide where gameuser.obj_id = {userData.usrDBData.un64ObjIdx} and " + $"gameuser_runne.user_id ={userData.usrDBData.un64ObjIdx} and gameuser_guide.obj_id = {userData.usrDBData.un64ObjIdx};"; ErrorCode errorCode = db.SqlExecQuery(sqlStr, dataReader => { if (!dataReader.Read()) { Logger.Warn("could not find user data"); return(ErrorCode.UserDataNotFound); } userData.szNickName = dataReader.GetString("obj_name"); userData.usrDBData.n16Sex = dataReader.GetInt16("obj_sex"); userData.usrDBData.userPlatform = ( UserPlatform )dataReader.GetInt32("sdk_id"); userData.usrDBData.un16HeaderID = dataReader.GetUInt16("obj_headid"); userData.usrDBData.n64Score = dataReader.GetInt64("obj_score"); userData.usrDBData.n64Diamond = dataReader.GetInt64("obj_diamond"); userData.usrDBData.n64Gold = dataReader.GetInt64("obj_gold"); userData.usrDBData.un32TotalGameInns = dataReader.GetUInt32("obj_game_inns"); userData.usrDBData.un32TotalWinInns = dataReader.GetUInt32("obj_game_winns"); userData.usrDBData.un32TotalHeroKills = dataReader.GetUInt32("obj_kill_hero_num"); userData.usrDBData.un32TotalAssist = dataReader.GetUInt32("obj_ass_kill_num"); userData.usrDBData.un32TotalDestoryBuildings = dataReader.GetUInt32("obj_dest_building_num"); userData.usrDBData.un32TotalDeadTimes = dataReader.GetUInt32("obj_dead_num"); userData.usrDBData.un32UserCurLvExp = dataReader.GetUInt32("obj_cur_lv_exp"); userData.usrDBData.un8UserLv = dataReader.GetByte("obj_lv"); userData.usrDBData.un16Cldays = dataReader.GetUInt16("obj_cldays"); userData.usrDBData.un16VipLv = dataReader.GetInt16("obj_vip_lv"); userData.usrDBData.un32LastGetLoginRewardDay = dataReader.GetInt32("obj_last_loginreward_time"); userData.usrDBData.tRegisteUTCMillisec = dataReader.GetInt64("obj_register_time"); userData.szTaskData = dataReader.GetString("obj_task_data"); queryUser.TaskData = userData.szTaskData; DBToCS.RuneInfo runedB = new DBToCS.RuneInfo { SlotStr = dataReader.GetString("runeslot_json"), BagStr = dataReader.GetString("runnebag_json") }; queryUser.Runeinfo.Add(runedB); queryUser.Guidestr = dataReader.GetString("obj_cs_guide_com_steps"); return(ErrorCode.Success); }); if (errorCode != ErrorCode.Success) { return(errorCode); } errorCode = this.GetUserHeros(db, userData.usrDBData.un64ObjIdx, queryUser); if (errorCode != ErrorCode.Success) { return(errorCode); } Dictionary <ulong, uint> t_map = new Dictionary <ulong, uint>(); errorCode = this.DBAsynQueryUserSNSList(db, userData.usrDBData.un64ObjIdx, t_map); if (errorCode == ErrorCode.Success) { foreach (KeyValuePair <ulong, uint> kv in t_map) { DBToCS.RSinfo info = new DBToCS.RSinfo { RelatedId = kv.Key, Relation = kv.Value }; queryUser.Rsinfo.Add(info); this.DBAsynQueryUserHeaderAndNickname(db, kv.Value, info); } } else { Logger.Error($"DBAsynQueryUserSNSList error:{errorCode}"); } errorCode = this.DBAsynQueryUserItems(db, userData.usrDBData.un64ObjIdx, queryUser); if (errorCode != ErrorCode.Success) { Logger.Error($"DBAsynQueryUserItems error:{errorCode}"); } errorCode = this.GetUserShortGiftMail(db, userData, queryUser); if (errorCode != ErrorCode.Success) { Logger.Error($"GetUserShortGiftMail error:{errorCode}"); } return(errorCode); }
private ErrorCode DBAsynQueryUserHeaderAndNickname(DBActiveWrapper db, ulong un64ObjIdx, DBToCS.RSinfo rs_info) { string sqlStr = $"select obj_name,obj_headid,obj_vip_lv from gameuser where obj_id={un64ObjIdx};"; ErrorCode errorCode = db.SqlExecQuery(sqlStr, dataReader => { if (dataReader.Read()) { rs_info.RelatedName = dataReader.GetString("obj_name"); rs_info.RelatedHeader = dataReader.GetUInt32("obj_headid"); rs_info.RelatedVip = dataReader.GetUInt32("obj_vip_lv"); } return(ErrorCode.Success); }); return(errorCode); }