浏览代码

feat:提交

fuwencai 1 年之前
父节点
当前提交
3de16ab46b

+ 4 - 1
src/jfw/modules/subscribepay/src/config.json

@@ -177,7 +177,10 @@
       ],
       "title": "视频会员权益码数据告警",
       "reTry": 3,
-      "threshold": 30
+      "threshold": {
+        "0": 30,
+        "1": 30
+      }
     },
     "sms": {
       "args": [

+ 4 - 4
src/jfw/modules/subscribepay/src/config/config.go

@@ -131,10 +131,10 @@ type config struct {
 			WeChatUrl    string `json:"weChatUrl"`
 		} `json:"siteMsg"` // 站内信内容配置
 		MailAlarm struct {
-			To        []string `json:"to"`
-			Title     string   `json:"title"`
-			ReTry     int      `json:"reTry"`
-			Threshold int      `json:"threshold"` // 库存剩余阈值
+			To        []string       `json:"to"`
+			Title     string         `json:"title"`
+			ReTry     int            `json:"reTry"`
+			Threshold map[string]int `json:"threshold"` // 库存剩余阈值
 		} `json:"mailAlarm"` // 库存告警
 		Sms struct {
 			Args []string `json:"args"` // 短信部分可配置参数

+ 2 - 1
src/jfw/modules/subscribepay/src/entity/equityActive.go

@@ -77,7 +77,8 @@ func (e *EquityActive) GiftVip() {
 		go e.sendAlarmMail(activeName, activeId, mold, 0)
 		return
 	}
-	if int(count)-1 <= config.Config.EquityActive.MailAlarm.Threshold {
+	threshold, b := config.Config.EquityActive.MailAlarm.Threshold[fmt.Sprintf("%v", mold)]
+	if b && int(count)-1 <= threshold {
 		// 发库存告警时这减去1是因为这一次马上会消耗一个
 		go e.sendAlarmMail(activeName, activeId, mold, int(count)-1)
 	}