This commit is contained in:
shoopea 2020-02-01 19:17:43 +08:00
parent ab0a7928b4
commit 560894b96b

7
job.go
View File

@ -1179,16 +1179,12 @@ 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)
@ -1212,14 +1208,11 @@ 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 {
args[i+1] = id args[i+1] = id
} }
log.Printf("jobVaultItemStatus : args\n%v\n", args)
rows, err := db.Query(stmt, args...) rows, err := db.Query(stmt, args...)
logOnError(err, "jobVaultItemStatus : Get rows") logOnError(err, "jobVaultItemStatus : Get rows")