test
This commit is contained in:
parent
79d0b01723
commit
109f38e470
31
job.go
31
job.go
@ -1568,6 +1568,16 @@ func jobGWithdraw(j Job) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var stock string
|
||||||
|
for _, i := range p.Items {
|
||||||
|
if i.Available > i.Required {
|
||||||
|
stock = fmt.Sprintf("%s\n%d x %s", stock, i.Required, i.Name)
|
||||||
|
} else if i.Available > 0 {
|
||||||
|
stock = fmt.Sprintf("%s\n%d x %s", stock, i.Available, i.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(stock) > 0 {
|
||||||
b, _ := json.Marshal(p)
|
b, _ := json.Marshal(p)
|
||||||
id, err := createJob(cacheObjSubType[`job_gwithdraw`], objJobPriority, j.UserID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), b)
|
id, err := createJob(cacheObjSubType[`job_gwithdraw`], objJobPriority, j.UserID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), b)
|
||||||
logOnError(err, "jobGWithdraw : createJob")
|
logOnError(err, "jobGWithdraw : createJob")
|
||||||
@ -1590,16 +1600,7 @@ func jobGWithdraw(j Job) {
|
|||||||
b, err = json.Marshal(p)
|
b, err = json.Marshal(p)
|
||||||
fmt.Printf("jobGWithdraw : %s\n", string(b))
|
fmt.Printf("jobGWithdraw : %s\n", string(b))
|
||||||
|
|
||||||
var stock string
|
msg := fmt.Sprintf("Click to validate @%s's withdrawal of<code>%s</code>\n/withdraw_%s", p.User, stock, string(ref))
|
||||||
for _, i := range p.Items {
|
|
||||||
if i.Available > i.Required {
|
|
||||||
stock = fmt.Sprintf("%s\n%d x %s", stock, i.Required, i.Name)
|
|
||||||
} else {
|
|
||||||
stock = fmt.Sprintf("%s\n%d x %s", stock, i.Available, i.Name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
msg := fmt.Sprintf("To validate @%s withdrawal of<code>%s</code>\nClick /withdraw_%s", p.User, stock, string(ref))
|
|
||||||
|
|
||||||
cmd := TGCommand{
|
cmd := TGCommand{
|
||||||
Type: commandReplyMsg,
|
Type: commandReplyMsg,
|
||||||
@ -1609,6 +1610,16 @@ func jobGWithdraw(j Job) {
|
|||||||
ParseMode: cmdParseModeHTML,
|
ParseMode: cmdParseModeHTML,
|
||||||
}
|
}
|
||||||
TGCmdQueue <- cmd
|
TGCmdQueue <- cmd
|
||||||
|
} else {
|
||||||
|
cmd := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: "No stock available whatsoever",
|
||||||
|
FromMsgID64: p.MsgID64,
|
||||||
|
FromChatID64: p.ChatID64,
|
||||||
|
ParseMode: cmdParseModeHTML,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- cmd
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = setJobDone(j.ID64)
|
err = setJobDone(j.ID64)
|
||||||
|
Loading…
Reference in New Issue
Block a user