update g deposit
This commit is contained in:
parent
5d34f764ec
commit
c22c44cca3
26
job.go
26
job.go
@ -823,7 +823,7 @@ func jobGDeposit(j Job) {
|
||||
clientSendCWMsgDelay(p.ChatID64, `⚒Crafting`, delay)
|
||||
p.Status = 1
|
||||
b, _ = json.Marshal(&p)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageOrderbookAck, b, 1*time.Minute)
|
||||
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, objSubTypeMessageStockAnyAck, b, 1*time.Minute)
|
||||
logOnError(err, "jobGDeposit : createJobCallback")
|
||||
delay = delay + 2*time.Second
|
||||
}
|
||||
@ -841,7 +841,7 @@ func jobGDeposit(j Job) {
|
||||
log.Printf("jobGDeposit : 1 : %d.\n", j.Trigger)
|
||||
|
||||
} else if p.Status == objSubTypeMessageStockAck {
|
||||
log.Printf("jobGDeposit : objSubTypeMessageStockAck : %d.\n", j.Trigger)
|
||||
//log.Printf("jobGDeposit : objSubTypeMessageStockAck : %d.\n", j.Trigger)
|
||||
msg, err := getObjMsg(j.Trigger)
|
||||
logOnError(err, "jobGDeposit : getObjMsg")
|
||||
rule, err := getMsgParsingRule(msg)
|
||||
@ -862,6 +862,28 @@ func jobGDeposit(j Job) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if p.Status == objSubTypeMessageStockAnyAck {
|
||||
log.Printf("jobGDeposit : objSubTypeMessageStockAnyAck : %d.\n", j.Trigger)
|
||||
msg, err := getObjMsg(j.Trigger)
|
||||
logOnError(err, "jobGDeposit : getObjMsg")
|
||||
rule, err := getMsgParsingRule(msg)
|
||||
logOnError(err, "jobGDeposit : getMsgParsingRule")
|
||||
cwm, err := parseSubTypeMessageStockAny(msg, rule.re)
|
||||
for stockIdx := range cwm.Stock {
|
||||
for resIdx := range p.ResObjID64 {
|
||||
if cwm.Stock[stockIdx].ItemID64 == p.ResObjID64[resIdx] {
|
||||
//log.Printf("jobGDeposit : objSubTypeMessageStockAck : Matching ItemID %d (%d).\n", p.ResObjID64[resIdx], cwm.Stock[stockIdx].Quantity)
|
||||
item, _ := getObjItem(p.ResObjID64[resIdx])
|
||||
clientSendCWMsg(p.ChatID64, fmt.Sprintf("/g_deposit %s %d", item.Code, cwm.Stock[stockIdx].Quantity))
|
||||
p2 := JobPayloadGDepositForward{
|
||||
ItemID64: p.ResObjID64[resIdx],
|
||||
Quantity: cwm.Stock[stockIdx].Quantity,
|
||||
}
|
||||
b2, _ := json.Marshal(p2)
|
||||
err = createJobCallback(objSubTypeJobGDepositForward, j.UserID64, objSubTypeMessageGDepositReq, b2, time.Duration(1*time.Minute))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = setJobDone(j.ID64)
|
||||
|
Loading…
Reference in New Issue
Block a user