diff --git a/common/common.go b/common/common.go index 52bd155c1d3e8c682242be77aa41bea9a39d5004..a6742f429b9eb522960e94a50c2b5e91958fa97a 100644 --- a/common/common.go +++ b/common/common.go @@ -425,13 +425,16 @@ func TimeConverStr(timeStr string) string { func GetSpecialDate(beforeDate int) string { year, month, date := time.Now().Date() thisMonth := time.Date(year, month, beforeDate, 0, 0, 0, 0, time.Local) - startDate := "" + var startDate time.Time + var curTime string if date > beforeDate { - startDate = thisMonth.AddDate(0, 0, 0).Format(DATE_FORMAT) + startDate = thisMonth.AddDate(0, 0, 0) } else { - startDate = thisMonth.AddDate(0, -1, 0).Format(DATE_FORMAT) + startDate = thisMonth.AddDate(0, -1, 0) } - return startDate + h, _ := time.ParseDuration("-1h") + curTime = startDate.Add(8 * h).Format(DATE_FORMAT) + return curTime } func CreateDir(Dir string) error{ diff --git a/controllers/hook.go b/controllers/hook.go index 1554bb206026f525061b89d6d6044dccb3eca3db..e08963ff517eb52404cfed3eba736602d9e38b4f 100644 --- a/controllers/hook.go +++ b/controllers/hook.go @@ -92,7 +92,6 @@ func (c *HookEventControllers) Post() { eventType := c.Ctx.Request.Header.Get(XGIteeEventType) c.Ctx.ResponseWriter.WriteHeader(200) c.Ctx.WriteString("Event received: " + eventType) - logs.Info("Event received: ", eventType) switch eventType { case NoteHookType: //handle comment hook data c.handleNoteDate() @@ -126,6 +125,7 @@ func (c *HookEventControllers) isLegitimateHookEvent() (ok bool) { } func (c *HookEventControllers) handleNoteDate() { + logs.Info(string(c.Ctx.Input.RequestBody)) var hookNote models.CommentPayload err := json.Unmarshal(c.Ctx.Input.RequestBody, &hookNote) if err != nil { @@ -134,8 +134,11 @@ func (c *HookEventControllers) handleNoteDate() { } hookPwd := beego.AppConfig.String("hook::hookpwd") hookNote.Password = util.TrimString(hookNote.Password) + logs.Info("hookNote.Password: ", hookNote.Password, ",hookPwd: ", hookPwd, + ", hookNote.Action: ", hookNote.Action, ",hookNote.NoteableType: ", hookNote.NoteableType) + hookPwd = util.TrimString(hookPwd) if hookNote.Action == "comment" && hookNote.NoteableType == "Issue" && hookNote.Password == hookPwd { - //logs.Info(string(c.Ctx.Input.RequestBody)) + logs.Info(string(c.Ctx.Input.RequestBody)) //handle issue comment go handleIssueComment(hookNote) } diff --git a/go.mod b/go.mod index 20e1f359bce26e9884f49669439871165266fa89..879795c80a0f586626f2488c8c89317d9cc2f1f9 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module cvevulner go 1.14 require ( + gitee.com/openeuler/go-gitee v0.0.0-20210201095646-fd9179920723 github.com/360EntSecGroup-Skylar/excelize/v2 v2.3.0 github.com/astaxie/beego v1.12.3 github.com/beego/bee v1.12.3 // indirect diff --git a/task/issuestatistics.go b/task/issuestatistics.go index 6a3da432922ec1afe744cd1e2eacf936b66c7e58..34da85b0d19285a2286e43c34a8513919b106e2b 100644 --- a/task/issuestatistics.go +++ b/task/issuestatistics.go @@ -14,7 +14,7 @@ func IssueStatistics() error { // The number of days the issue counts the mailing list beforeDate, beErr := beego.AppConfig.Int("cve::cve_statistics_date") if beErr != nil { - beforeDate = 30 + beforeDate = 20 } prnum, prErr := beego.AppConfig.Int("crontab::prcnum") if prErr != nil {