This commit is contained in:
shoopea 2019-05-13 11:48:14 +08:00
parent 2815816a54
commit de49bc0f4a

View File

@ -103,7 +103,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : objSubTypeMessageMiniWar parsing time : "+r.ReplaceAllString(m.Text, "${Time}"))
cwm := ChatWarsMessageMiniWar{
Time: t,
Report: make(map[string]ChatWarsMessageMiniWarCastle),
Report: make(map[string]*ChatWarsMessageMiniWarCastle),
}
g, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold1}"))
s, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock1}"))
@ -113,7 +113,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Gold: int32(g),
Stock: int32(s),
}
cwm.Report[r.ReplaceAllString(m.Text, "${Loot1}")] = rep
cwm.Report[r.ReplaceAllString(m.Text, "${Loot1}")] = &rep
g, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold2}"))
s, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock2}"))
rep = ChatWarsMessageMiniWarCastle{
@ -122,7 +122,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Gold: int32(g),
Stock: int32(s),
}
cwm.Report[r.ReplaceAllString(m.Text, "${Loot2}")] = rep
cwm.Report[r.ReplaceAllString(m.Text, "${Loot2}")] = &rep
g, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold3}"))
s, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock3}"))
rep = ChatWarsMessageMiniWarCastle{
@ -131,7 +131,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Gold: int32(g),
Stock: int32(s),
}
cwm.Report[r.ReplaceAllString(m.Text, "${Loot3}")] = rep
cwm.Report[r.ReplaceAllString(m.Text, "${Loot3}")] = &rep
g, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold4}"))
s, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock4}"))
rep = ChatWarsMessageMiniWarCastle{
@ -140,7 +140,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Gold: int32(g),
Stock: int32(s),
}
cwm.Report[r.ReplaceAllString(m.Text, "${Loot4}")] = rep
cwm.Report[r.ReplaceAllString(m.Text, "${Loot4}")] = &rep
g, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold5}"))
s, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock5}"))
rep = ChatWarsMessageMiniWarCastle{
@ -149,7 +149,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Gold: int32(g),
Stock: int32(s),
}
cwm.Report[r.ReplaceAllString(m.Text, "${Loot5}")] = rep
cwm.Report[r.ReplaceAllString(m.Text, "${Loot5}")] = &rep
g, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold6}"))
s, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock6}"))
rep = ChatWarsMessageMiniWarCastle{
@ -158,7 +158,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Gold: int32(g),
Stock: int32(s),
}
cwm.Report[r.ReplaceAllString(m.Text, "${Loot6}")] = rep
cwm.Report[r.ReplaceAllString(m.Text, "${Loot6}")] = &rep
g, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold7}"))
s, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock7}"))
rep = ChatWarsMessageMiniWarCastle{
@ -167,50 +167,50 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Gold: int32(g),
Stock: int32(s),
}
cwm.Report[r.ReplaceAllString(m.Text, "${Loot7}")] = rep
cwm.Report[r.ReplaceAllString(m.Text, "${Loot7}")] = &rep
/*
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score1}")]
p, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Points1}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points1 : "+r.ReplaceAllString(m.Text, "$(Points1)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score1}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score1}")]
p, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Points1}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points1 : "+r.ReplaceAllString(m.Text, "$(Points1)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score1}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score2}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points2}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points2 : "+r.ReplaceAllString(m.Text, "$(Points2)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score2}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score2}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points2}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points2 : "+r.ReplaceAllString(m.Text, "$(Points2)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score2}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score3}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points3}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points3 : "+r.ReplaceAllString(m.Text, "$(Points3)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score3}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score3}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points3}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points3 : "+r.ReplaceAllString(m.Text, "$(Points3)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score3}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score4}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points4}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points4 : "+r.ReplaceAllString(m.Text, "$(Points4)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score4}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score4}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points4}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points4 : "+r.ReplaceAllString(m.Text, "$(Points4)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score4}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score5}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points5}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points5 : "+r.ReplaceAllString(m.Text, "$(Points5)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score5}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score5}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points5}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points5 : "+r.ReplaceAllString(m.Text, "$(Points5)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score5}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score6}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points6}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points6 : "+r.ReplaceAllString(m.Text, "$(Points6)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score6}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score7}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points7}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points7 : "+r.ReplaceAllString(m.Text, "$(Points7)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score7}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score6}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points6}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points6 : "+r.ReplaceAllString(m.Text, "$(Points6)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score6}")] = rep
rep = cwm.Report[r.ReplaceAllString(m.Text, "${Score7}")]
p, err = strconv.Atoi(r.ReplaceAllString(m.Text, "${Points7}"))
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : convert Points7 : "+r.ReplaceAllString(m.Text, "$(Points7)"))
rep.Points = int32(p)
cwm.Report[r.ReplaceAllString(m.Text, "${Score7}")] = rep
*/
//b, err := json.Marshal(cwm)
/*
if len(r.ReplaceAllString(m.Text, "${Loot1}")) < 6 || len(r.ReplaceAllString(m.Text, "${Loot1}")) > 11 {