From bf052bdc6b73d09f0c3bfe94a36b8363f4fcc678 Mon Sep 17 00:00:00 2001 From: jiangyong Date: Sat, 12 Apr 2025 23:29:01 +0800 Subject: [PATCH] messagelog --- common/global/message.go | 3 +++ worker/worker.go | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/global/message.go b/common/global/message.go index b979c77..eba7919 100644 --- a/common/global/message.go +++ b/common/global/message.go @@ -97,6 +97,8 @@ func SendMessage(user []string, content string) error { log.Errorf("send message [%s] error : %s", goutil.EncodeJSON(message), err) return err } + log.Infof("send [%s] message :%s", strings.Join(user, ","), content) + return nil } @@ -118,5 +120,6 @@ func SendCorpMessage(corpId int64, user []string, content string) error { log.Errorf("send message [%s] error : %s", goutil.EncodeJSON(message), err) return err } + log.Infof("send corp [%d][%s] message :%s", corpId, strings.Join(user, ","), content) return nil } diff --git a/worker/worker.go b/worker/worker.go index 545d79d..8d451df 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -1,8 +1,10 @@ package worker import ( + "enterprise/common/dao" "enterprise/common/model" "github.com/go-co-op/gocron" + "github.com/spf13/cast" "time" ) @@ -17,6 +19,7 @@ func InitCorp() { func InitCorp1002(cron *gocron.Scheduler) { corpId := int64(1002) + corp, _ := dao.NewCorpDao().Get(corpId) staff := new(Staff) cron.Every(1).Day().At("09:00").Do(func() { @@ -51,7 +54,7 @@ func InitCorp1002(cron *gocron.Scheduler) { }) //10号晚上8点发送工资单 - cron.Every(1).Month(14).At("20:00").Do(func() { + cron.Every(1).Month(cast.ToInt(corp.GetConfig().SalaryDay)).At("20:00").Do(func() { staff.PayStaffSalary(corpId, time.Now().AddDate(0, -1, 0).Format("200601")) staff.SendStaffSalaryBill(corpId, time.Now().AddDate(0, -1, 0).Format("200601")) }) @@ -59,6 +62,7 @@ func InitCorp1002(cron *gocron.Scheduler) { func InitCorp1000(cron *gocron.Scheduler) { corpId := int64(1000) + corp, _ := dao.NewCorpDao().Get(corpId) cron.Every(1).Day().At("09:00").Do(func() { go NewStaff().MontorWorkAge(corpId) }) @@ -92,7 +96,7 @@ func InitCorp1000(cron *gocron.Scheduler) { }) //10号晚上8点发送工资单 - cron.Every(1).Month(11).At("20:00").Do(func() { + cron.Every(1).Month(cast.ToInt(corp.GetConfig().SalaryDay)).At("20:00").Do(func() { NewStaff().PayStaffSalary(corpId, time.Now().AddDate(0, -1, 0).Format("200601")) NewStaff().SendStaffSalaryBill(corpId, time.Now().AddDate(0, -1, 0).Format("200601")) })