This commit is contained in:
shoopea 2020-01-02 20:05:33 +08:00
parent 444eb64f2a
commit 014bcb7873

10
job.go
View File

@ -17,7 +17,7 @@ import (
tb "gopkg.in/tucnak/telebot.v2"
)
func createJob(jobTypeID int32, priority int32, userID64 int64, trigger int64, schedule time.Time, payload []byte) (int64, error) {
func createJob(jobTypeID64 int64, priority int32, userID64 int64, trigger int64, schedule time.Time, payload []byte) (int64, error) {
if len(payload) > 20000 {
return 0, errors.New("payload too long")
}
@ -30,8 +30,8 @@ func createJob(jobTypeID int32, priority int32, userID64 int64, trigger int64, s
}
defer stmt.Close()
res, err := stmt.Exec(objTypeJob, jobTypeID)
s := fmt.Sprintf("createJob, insert obj(%d, %d)", objTypeJob, jobTypeID)
res, err := stmt.Exec(objTypeJob, jobTypeID64)
s := fmt.Sprintf("createJob, insert obj(%d, %d)", objTypeJob, jobTypeID64)
logOnError(err, s)
if err != nil {
return 0, err
@ -60,9 +60,9 @@ func createJob(jobTypeID int32, priority int32, userID64 int64, trigger int64, s
return objId, nil
}
func createJobCallback(jobTypeID int32, userID64 int64, msgTypeID64 int64, payload []byte, timeout time.Duration) error {
func createJobCallback(jobTypeID64 int64, userID64 int64, msgTypeID64 int64, payload []byte, timeout time.Duration) error {
//t, err := time.Parse(time.RFC3339, "9999-12-31T00:00:00+00:00")
jobID64, err := createJob(jobTypeID, objJobPriority, userID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), payload)
jobID64, err := createJob(jobTypeID64, objJobPriority, userID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), payload)
if err != nil {
return err
}