mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-28 02:23:37 +01:00
refactor(channelserver): migrate remaining guild SQL into GuildRepository
Move ~39 inline SQL queries from six handler files into repo_guild.go, consolidating all guild-related DB access (posts, alliances, adventures, treasure hunts, meals, kill logs, scouts) behind GuildRepository methods. Handler files now contain only packet serialization, business logic, and ACK responses with no direct database calls.
This commit is contained in:
@@ -134,7 +134,7 @@ func handleMsgMhfInfoGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(0) // Ignored
|
||||
|
||||
if guild.AllianceID > 0 {
|
||||
alliance, err := GetAllianceData(s, guild.AllianceID)
|
||||
alliance, err := s.server.guildRepo.GetAllianceByID(guild.AllianceID)
|
||||
if err != nil {
|
||||
bf.WriteUint32(0) // Error, no alliance
|
||||
} else {
|
||||
@@ -361,15 +361,7 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if pkt.Type > 8 {
|
||||
var tempAlliances []*GuildAlliance
|
||||
rows, queryErr := s.server.db.Queryx(allianceInfoSelectQuery)
|
||||
if queryErr != nil {
|
||||
err = queryErr
|
||||
} else {
|
||||
for rows.Next() {
|
||||
alliance, _ := buildAllianceObjectFromDbResult(rows, queryErr, s)
|
||||
tempAlliances = append(tempAlliances, alliance)
|
||||
}
|
||||
}
|
||||
tempAlliances, err = s.server.guildRepo.ListAlliances()
|
||||
switch pkt.Type {
|
||||
case mhfpacket.ENUMERATE_ALLIANCE_TYPE_ALLIANCE_NAME:
|
||||
searchName, _ := stringsupport.SJISToUTF8(pkt.Data2.ReadNullTerminatedBytes())
|
||||
|
||||
Reference in New Issue
Block a user