From 0f0c63972f59f3373022f75ad6fff94efd2a1b1a Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Fri, 10 Jan 2025 20:00:54 +0800 Subject: [PATCH] [qyweixin] --- conf/server.conf.prod | 16 +++++++++++++++- server/service/qyweixin_approve.go | 3 +++ worker/checkin.go | 8 ++++++++ worker/worker.go | 5 +++-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/conf/server.conf.prod b/conf/server.conf.prod index 992ca25..52e61f4 100644 --- a/conf/server.conf.prod +++ b/conf/server.conf.prod @@ -23,7 +23,21 @@ addr="127.0.0.1:6379" db=0 password="" - +[qyweixin] +corpid = "ww43c49db2e88a17f8" +hr_agent = "3010185" +hr_secret = "Ko2UQWZPbdM9N1snukp_1CT_3J7CcReyPAzl3ww2xoo" +enterprise_agent = "1000009" +enterprise_secret = "oMB24UhKe50-XPTg7vhnwoTuhEXaq5XeiHPAUtF4hOs" +approve_secret = "xJOClC5V2pPon1azgrAzf5kq1TB72xZ3ScR7O5G3lQo" +approve_agent = "3010040" +checkin_agent = "3010011" +checkin_secret = "6ljYNGt4DonZLmr9SCtgkTlOvtqmsOchBrTWwGl_GpU" +checkin_group = "1,2" +checkin_pay_thresold = 11 +checkin_onduty_pay_day = "" +pay_secret = "JCGsxntR4E7wrEEQvWGr8_wdKtRlw48n-W6zd8lbwc4" +pay_agent = "3010046" [wxpay] pay_key_pem = "conf/wxpay/apiclient_key.pem" diff --git a/server/service/qyweixin_approve.go b/server/service/qyweixin_approve.go index 2effb09..d9d058b 100644 --- a/server/service/qyweixin_approve.go +++ b/server/service/qyweixin_approve.go @@ -83,6 +83,9 @@ func (a *Approve) handleApprovalChange(msg *message.MixMessage) { log.Errorf("get spn detail error :%s", err.Error()) return } + if detail == nil { + + } log.Infof("spno: %s detail: %s", spNo, goutil.EncodeJSON(detail)) if templateId == a.corpConfig.TplIdRefund { diff --git a/worker/checkin.go b/worker/checkin.go index 3219091..8bcbd80 100644 --- a/worker/checkin.go +++ b/worker/checkin.go @@ -14,8 +14,16 @@ import ( ) type Checkin struct { + corp *model.Corp + corpConfig *model.CorpConfig } +func NewCheckin(corp *model.Corp) *Checkin { + return &Checkin{ + corp: corp, + corpConfig: corp.GetConfig(), + } +} func (c *Checkin) SyncCheckinMonth(month string) error { if month == "" { month = time.Now().AddDate(0, -1, 0).Format("200601") diff --git a/worker/worker.go b/worker/worker.go index e66267f..b51d66c 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -8,10 +8,12 @@ import ( ) func Init() error { + + corp, _ := dao.NewCorpDao().Get(1000) timezone, _ := time.LoadLocation("Asia/Shanghai") cron := gocron.NewScheduler(timezone) staff := new(Staff) - checkIn := new(Checkin) + checkIn := NewCheckin(corp) // 每天同步企业人事信息 cron.Every(1).Day().At("01:00").Do(func() { @@ -34,7 +36,6 @@ func Init() error { lastMonth := time.Now().AddDate(0, -1, 0).Format("200601") checkIn.SyncCheckinMonth("") - corp, _ := dao.NewCorpDao().Get(1000) approve := NewApproval(corp) approve.Sync(lastMonth, model.ApprovalTypeCheckin) approve.Sync(lastMonth, model.ApprovalTypeVacation)