debug vault item

This commit is contained in:
shoopea 2020-02-01 18:52:15 +08:00
parent 7d38a0329b
commit 5f1984e327

14
job.go
View File

@ -1179,12 +1179,16 @@ func jobVaultItemStatus(j Job) {
userList, depositList, withdrawList []int64 userList, depositList, withdrawList []int64
) )
log.Printf("jobVaultItemStatus : starting\n")
err := setJobStart(j.ID64) err := setJobStart(j.ID64)
logOnError(err, "jobVaultItemStatus : setJobStart") logOnError(err, "jobVaultItemStatus : setJobStart")
err = json.Unmarshal(j.Payload, &p) err = json.Unmarshal(j.Payload, &p)
logOnError(err, "jobVaultItemStatus : Unmarshal payload") logOnError(err, "jobVaultItemStatus : Unmarshal payload")
log.Printf("jobVaultItemStatus : payload unmarshaled\n")
stmt := `SELECT x.item_id stmt := `SELECT x.item_id
,x.user_id ,x.user_id
,(SELECT COALESCE(SUM(omv.quantity), 0) ,(SELECT COALESCE(SUM(omv.quantity), 0)
@ -1208,6 +1212,8 @@ func jobVaultItemStatus(j Job) {
AND omv.item_id in (?` + strings.Repeat(",?", len(p.ItemListID64)-1) + `)) x AND omv.item_id in (?` + strings.Repeat(",?", len(p.ItemListID64)-1) + `)) x
ORDER BY x.user_id ASC;` ORDER BY x.user_id ASC;`
log.Printf("jobVaultItemStatus : stmt\n%s\n", stmt)
args := make([]interface{}, len(p.ItemListID64)+1) args := make([]interface{}, len(p.ItemListID64)+1)
args[0] = p.DepositChatID64 args[0] = p.DepositChatID64
for i, id := range p.ItemListID64 { for i, id := range p.ItemListID64 {
@ -1271,6 +1277,14 @@ func jobVaultItemStatus(j Job) {
ParseMode: cmdParseModeHTML, ParseMode: cmdParseModeHTML,
} }
TGCmdQueue <- c TGCmdQueue <- c
} else {
c := TGCommand{
Type: commandSendMsg,
Text: "Nothing to report",
ToChatID64: p.UserID64,
ParseMode: cmdParseModeHTML,
}
TGCmdQueue <- c
} }
err = rows.Err() err = rows.Err()