update deposit all

This commit is contained in:
shoopea 2019-08-27 12:40:12 +08:00
parent 94e0752b5f
commit 79f23ccf4c
2 changed files with 15 additions and 7 deletions

19
job.go
View File

@ -763,36 +763,42 @@ func jobGDeposit(j Job) {
} }
} }
if res || alch || misc || craft || equip {
p.Status = 1
b, _ = json.Marshal(&p)
}
if res { if res {
clientSendCWMsgDelay(p.ChatID64, `📦Resources`, delay) clientSendCWMsgDelay(p.ChatID64, `📦Resources`, delay)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay) p.Status = objSubTypeMessageStockAck
b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageStockAck, b, delay)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
if alch { if alch {
clientSendCWMsgDelay(p.ChatID64, `Alchemy`, delay) clientSendCWMsgDelay(p.ChatID64, `Alchemy`, delay)
p.Status = 1
b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay) err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
if misc { if misc {
clientSendCWMsgDelay(p.ChatID64, `🗃Misc`, delay) clientSendCWMsgDelay(p.ChatID64, `🗃Misc`, delay)
p.Status = 1
b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay) err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
if craft { if craft {
clientSendCWMsgDelay(p.ChatID64, `⚒Crafting`, delay) clientSendCWMsgDelay(p.ChatID64, `⚒Crafting`, delay)
p.Status = 1
b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay) err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
if equip { if equip {
clientSendCWMsgDelay(p.ChatID64, `🏷Equipment`, delay) clientSendCWMsgDelay(p.ChatID64, `🏷Equipment`, delay)
p.Status = 1
b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay) err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, delay)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
@ -800,7 +806,10 @@ func jobGDeposit(j Job) {
return return
} else if p.Status == 1 { /* handle that one resource from the objSubTypeMessageOrderbookAck msg */ } else if p.Status == 1 { /* handle that one resource from the objSubTypeMessageOrderbookAck msg */
log.Printf("jobGDeposit : objSubTypeMessageStockAck : %d\n.", j.Trigger)
} else if p.Status == objSubTypeMessageStockAck {
log.Printf("jobGDeposit : objSubTypeMessageStockAck : %d\n.", j.Trigger)
} }
err = setJobDone(j.ID64) err = setJobDone(j.ID64)

View File

@ -324,7 +324,6 @@ func SQLCWMsgWorker(id int, msgs <-chan ChatWarsMessage, objIds chan<- int64) {
} }
func SQLIdentifyMsgWorker(id int, objIds <-chan int64) { func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
var i int
//log.Printf("SQLIdentifyMsgWorker[" + strconv.Itoa(id) + "] : Starting.") //log.Printf("SQLIdentifyMsgWorker[" + strconv.Itoa(id) + "] : Starting.")
for objId := range objIds { for objId := range objIds {
m, err := getObjMsg(objId) m, err := getObjMsg(objId)
@ -466,7 +465,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
_, err := parseSubTypeMessageStockAck(m, rule.re) _, err := parseSubTypeMessageStockAck(m, rule.re)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageStockAck.") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageStockAck.")
default: default:
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknwon message type in rule %d : %d (%d)\n%s\n", msgParsingRules[i].ID, msgParsingRules[i].MsgTypeID, objId, m.Text) //log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknwon message type in rule %d : %d (%d)\n%s\n", msgParsingRules[i].ID, msgParsingRules[i].MsgTypeID, objId, m.Text)
} }
muxCallbacks.Lock() muxCallbacks.Lock()
if mc1, mok1 := callbacks[m.TGUserID64]; mok1 { if mc1, mok1 := callbacks[m.TGUserID64]; mok1 {