update withdraw rcv

This commit is contained in:
shoopea 2019-10-11 09:56:02 +08:00
parent 5faba3da4e
commit f85b095cd5
2 changed files with 14 additions and 15 deletions

6
msg.go
View File

@ -183,6 +183,7 @@ func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
func parseSubTypeMessageOrderbookAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageOrderbookAck, error) {
cwm := ChatWarsMessageOrderbookAck{}
/*
log.Printf("parseSubTypeMessageOrderbookAck : Orderbook identified\n")
log.Printf("parseSubTypeMessageOrderbookAck : Name : %s\n", r.ReplaceAllString(m.Text, "${Name}"))
log.Printf("parseSubTypeMessageOrderbookAck : Code : %s\n", r.ReplaceAllString(m.Text, "${Code}"))
@ -194,6 +195,7 @@ func parseSubTypeMessageOrderbookAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha
log.Printf("parseSubTypeMessageOrderbookAck : Price2 : %s\n", r.ReplaceAllString(m.Text, "${Price2}"))
log.Printf("parseSubTypeMessageOrderbookAck : Qty3 : %s\n", r.ReplaceAllString(m.Text, "${Qty3}"))
log.Printf("parseSubTypeMessageOrderbookAck : Price3 : %s\n", r.ReplaceAllString(m.Text, "${Price3}"))
*/
return &cwm, nil
}
@ -223,8 +225,7 @@ func parseSubTypeMessageWithdrawRcv(m *ChatWarsMessage, r *regexp.Regexp) (*Chat
cwm := ChatWarsMessageWithdrawRcv{}
items := []ChatWarsItems{}
re := regexp.MustCompile(`(.*) x (.*)`)
for _, l := range re.FindAllStringSubmatch(m.Text, -1) {
log.Printf("parseSubTypeMessageWithdrawRcv : search : %s x %s\n", l[1], l[2])
for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Items}"), -1) {
i := getObjItemID(``, l[1])
q, _ := strconv.ParseInt(l[2], 10, 64)
if i != 0 {
@ -233,7 +234,6 @@ func parseSubTypeMessageWithdrawRcv(m *ChatWarsMessage, r *regexp.Regexp) (*Chat
Quantity: q,
}
items = append(items, item)
log.Printf("parseSubTypeMessageWithdrawRcv : found : %d x %d\n", i, q)
}
}
cwm.ItemList = items

View File

@ -365,7 +365,6 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
cwm, err := parseSubTypeMessageWithdrawRcv(m, rule.re)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageWithdrawRcv.")
for _, i := range cwm.ItemList {
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : pushing %d x %d\n", i.ItemID64, i.Quantity)
err = insertMsgItem(cwm.Msg.ObjID64, i.ItemID64, i.Quantity)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Inserting objSubTypeMessageWithdrawRcv.")
}