messagelog

This commit is contained in:
jiangyong 2025-04-12 23:29:01 +08:00
parent 8ab41cc0db
commit bf052bdc6b
2 changed files with 9 additions and 2 deletions

View File

@ -97,6 +97,8 @@ func SendMessage(user []string, content string) error {
log.Errorf("send message [%s] error : %s", goutil.EncodeJSON(message), err) log.Errorf("send message [%s] error : %s", goutil.EncodeJSON(message), err)
return err return err
} }
log.Infof("send [%s] message :%s", strings.Join(user, ","), content)
return nil 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) log.Errorf("send message [%s] error : %s", goutil.EncodeJSON(message), err)
return err return err
} }
log.Infof("send corp [%d][%s] message :%s", corpId, strings.Join(user, ","), content)
return nil return nil
} }

View File

@ -1,8 +1,10 @@
package worker package worker
import ( import (
"enterprise/common/dao"
"enterprise/common/model" "enterprise/common/model"
"github.com/go-co-op/gocron" "github.com/go-co-op/gocron"
"github.com/spf13/cast"
"time" "time"
) )
@ -17,6 +19,7 @@ func InitCorp() {
func InitCorp1002(cron *gocron.Scheduler) { func InitCorp1002(cron *gocron.Scheduler) {
corpId := int64(1002) corpId := int64(1002)
corp, _ := dao.NewCorpDao().Get(corpId)
staff := new(Staff) staff := new(Staff)
cron.Every(1).Day().At("09:00").Do(func() { cron.Every(1).Day().At("09:00").Do(func() {
@ -51,7 +54,7 @@ func InitCorp1002(cron *gocron.Scheduler) {
}) })
//10号晚上8点发送工资单 //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.PayStaffSalary(corpId, time.Now().AddDate(0, -1, 0).Format("200601"))
staff.SendStaffSalaryBill(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) { func InitCorp1000(cron *gocron.Scheduler) {
corpId := int64(1000) corpId := int64(1000)
corp, _ := dao.NewCorpDao().Get(corpId)
cron.Every(1).Day().At("09:00").Do(func() { cron.Every(1).Day().At("09:00").Do(func() {
go NewStaff().MontorWorkAge(corpId) go NewStaff().MontorWorkAge(corpId)
}) })
@ -92,7 +96,7 @@ func InitCorp1000(cron *gocron.Scheduler) {
}) })
//10号晚上8点发送工资单 //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().PayStaffSalary(corpId, time.Now().AddDate(0, -1, 0).Format("200601"))
NewStaff().SendStaffSalaryBill(corpId, time.Now().AddDate(0, -1, 0).Format("200601")) NewStaff().SendStaffSalaryBill(corpId, time.Now().AddDate(0, -1, 0).Format("200601"))
}) })