From ef8ed54ce5116951eb579fa0bc693062cf7f109b Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 27 May 2019 11:47:13 +0800 Subject: [PATCH] test --- job.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/job.go b/job.go index d06bf25..42558cb 100644 --- a/job.go +++ b/job.go @@ -239,10 +239,20 @@ func jobPillage(j Job) { and omx.user_id = oj.user_id and omx.sender_user_id = ` + strconv.Itoa(userID64ChtWrsBot) + ` and omx.obj_id = ox.id - and ox.obj_sub_type_id in (` + strconv.Itoa(objSubTypeMessagePillageGo) + `, ` + strconv.Itoa(objSubTypeMessagePillageTimeout) + `) + and ox.obj_sub_type_id in (` + strconv.Itoa(objSubTypeMessagePillageGo) + + `, ` + strconv.Itoa(objSubTypeMessagePillageTimeout) + + `, ` + strconv.Itoa(objSubTypeMessagePillageLoss) + + `, ` + strconv.Itoa(objSubTypeMessagePillageWin) + `) and op.id = ` + strconv.FormatInt(r.ObjID64, 10) + ` and omp.obj_id = op.id - and omx.date between omp.date and addtime(omp.date, '0 0:3:30.000000');`) + and omx.date between omp.date and addtime(omp.date, '0 0:3:30.000000') + order by case ox.obj_sub_type_id when ` + strconv.Itoa(objSubTypeMessagePillageWin) + ` then 0 + when ` + strconv.Itoa(objSubTypeMessagePillageLoss) + ` then 1 + when ` + strconv.Itoa(objSubTypeMessagePillageTimeout) + ` then 2 + when ` + strconv.Itoa(objSubTypeMessagePillageGo) + ` then 3 + else 4 end asc + limit 1;`) + if len(ids) > 1 { // issue there ? s := TGCommand{ Type: commandSendMsg, @@ -265,6 +275,20 @@ func jobPillage(j Job) { ToUserID64: j.UserID64, } TGCmdQueue <- s + } else if msgTypeID64 == objSubTypeMessagePillageWin { + s := TGCommand{ + Type: commandSendMsg, + Text: fmt.Sprintf("We avoided a pillage (%s))", m.Date.Format(time.RFC3339)), + ToUserID64: j.UserID64, + } + TGCmdQueue <- s + } else if msgTypeID64 == objSubTypeMessagePillageLoss { + s := TGCommand{ + Type: commandSendMsg, + Text: fmt.Sprintf("We got pillaged (%s)", m.Date.Format(time.RFC3339)), + ToUserID64: j.UserID64, + } + TGCmdQueue <- s } else if msgTypeID64 == objSubTypeMessagePillageTimeout { s := TGCommand{ Type: commandSendMsg,