Kaynağa Gözat

Merge branch 'feature/v4.9.56' into feature/v4.9.61

yuanyuan 9 ay önce
ebeveyn
işleme
874c559138

+ 1 - 1
src/jfw/modules/publicapply/src/activityday/config.json

@@ -20,7 +20,7 @@
       "18238182402@163.com"
     ],
     "title": "%v,%s库存还剩%d个",
-    "content": "%v,%s库存还剩%d个",
+    "content": "%v,%s库存还剩%d个,请注意",
     "reTry": 3
   },
   "webSiteParameter": {

+ 8 - 1
src/jfw/modules/publicapply/src/activityday/consts/consts.go

@@ -1,5 +1,7 @@
 package consts
 
+import "sync"
+
 const (
 	Steps0  = iota
 	Steps1  //更新奖品库存异常
@@ -52,6 +54,9 @@ var (
 	TableOrderInfo                    = "jyactivities.lottery_prize_order"  // 活动关联订单信息表
 	TableUserAccount                  = "jyactivities.lottery_user_account" // 用户中奖信息表
 	TableEquityInfo                   = "jyactivities.equity_info"          // 第三方权权益码表
+	TableProductInfo                  = "jyactivities.product_info"         // 剑鱼超级订阅产品表
+	TableProductRule                  = "jyactivities.product_rule"         // 剑鱼超级订阅产品表
+	TablePrizeBaseInfo                = "jyactivities.prize_base_info"      // 奖品基本信息 奖品图片及标签等
 	TableOrder                        = "jianyu.dataexport_order"           // 订单表
 	NotStarted                        = "当前活动未开始"
 	Ended                             = "当前活动已结束"
@@ -66,5 +71,7 @@ var (
 	ActivityCookieName                = "activityDay_%s"   // activityDay__年月日
 	ActivityCheckCookieName           = "cad%d_%d_%s"      //  key: cad%d_%d_用户id  value: 时间戳_step_用户id
 	OrderErrMsg                       = "您当前条件不符合参与该抽奖活动!" //非常抱歉,您暂不满足抽奖条件!
-	ErrUserMsg                        = "什么都没有抽到"          // 异常用户抽不到
+	ActivateRule                      = &sync.Map{}
+	ActivateName                      = &sync.Map{}
+	ErrUserMsg                        = "什么都没有抽到" // 异常用户抽不到
 )

+ 7 - 6
src/jfw/modules/publicapply/src/activityday/dao/dao.go

@@ -187,12 +187,12 @@ func GetLotteryActiveInfo(activeId int64, session *httpsession.Session, req *htt
 // GetLotteryUserAccount 我的奖品列表
 func GetLotteryUserAccount(positionId, activeId int64, platform string) *[]map[string]interface{} {
 	q := ` SELECT
-    b.name,
-    b.win_pic as pic,
+    pbi.name,
+    pbi.win_pic as pic,
+    pbi.attribute,
+    pbi.url,
+    pbi.notes,
     a.create_time,
-    b.attribute,
-    b.url,
-    b.notes,
     e.code,
     e.ex_end_time
 FROM
@@ -200,13 +200,14 @@ FROM
         LEFT JOIN
     %s b ON (a.active_id = b.active_id
         AND a.prize_id = b.id)
+        LEFT JOIN %s pbi ON b.pb_id = pbi.id
         LEFT JOIN
     %s e ON (a.equity_id = e.id)
 WHERE
     a.position_id = ?
     AND a.active_id = ?;`
 
-	query := fmt.Sprintf(q, consts.TableUserAccount, consts.TablePrizeInfo, consts.TableEquityInfo)
+	query := fmt.Sprintf(q, consts.TableUserAccount, consts.TablePrizeInfo, consts.TablePrizeBaseInfo, consts.TableEquityInfo)
 	rs := db.Mysql.SelectBySql(query, positionId, activeId)
 	if rs == nil || len(*rs) == 0 {
 		return &[]map[string]interface{}{}

+ 245 - 0
src/jfw/modules/publicapply/src/activityday/dao/exchange.go

@@ -0,0 +1,245 @@
+package dao
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"database/sql"
+	"encoding/json"
+	"fmt"
+	"jy/src/jfw/modules/publicapply/src/activityday/consts"
+	"jy/src/jfw/modules/publicapply/src/activityday/entity"
+	au "jy/src/jfw/modules/publicapply/src/activityday/util"
+	"jy/src/jfw/modules/publicapply/src/db"
+	"log"
+	"strings"
+	"sync"
+	"time"
+)
+
+type Ex struct {
+	Sess      map[string]interface{}
+	Platform  string
+	ActiveId  int64
+	Id        int64
+	AccountId int64
+}
+
+func NewEx(sess map[string]interface{}, platform string, activeId, id, accountId int64) *Ex {
+	return &Ex{
+		sess,
+		platform,
+		activeId,
+		id,
+		accountId,
+	}
+}
+
+var (
+	RedeemLock = &sync.Mutex{}
+)
+
+// 2
+func (e *Ex) Redeem() (r entity.Redeem, msg string) {
+	RedeemLock.Lock()
+	defer RedeemLock.Unlock()
+	db.BaseMysql.ExecTx("兑换", func(tx *sql.Tx) bool {
+		msg = "当前会员库存不足,请选择其他会员获取兑换码."
+		positionId := common.Int64All(e.Sess["positionId"])
+		prizeInfoSql := fmt.Sprintf(`SELECT  pbi.name,pbi.url   ,lpi.inventory ,lpi.alarm_switch ,lpi.alarm_threshold   FROM %s  lpi LEFT JOIN %s pbi  ON lpi.pb_id  = pbi.id  WHERE lpi.active_id  = ? AND  lpi.id  = ?  AND  lpi.state  = 0 AND lpi.inventory >0  FOR UPDATE;`, consts.TablePrizeInfo, consts.TablePrizeBaseInfo)
+		prizeInfos := db.BaseMysql.SelectBySqlByTx(tx, prizeInfoSql, e.ActiveId, e.Id)
+		if prizeInfos == nil || len(*prizeInfos) == 0 {
+			return false
+		}
+		pv := (*prizeInfos)[0]
+		prizeName := common.InterfaceToStr(pv["name"])         //三方会员
+		inventory := common.IntAll(pv["inventory"])            //库存
+		alarmSwitch := common.IntAll(pv["alarm_switch"])       //告警开关0:打开;1:关闭
+		alarmThreshold := common.IntAll(pv["alarm_threshold"]) //奖品告警阈值
+		if inventory <= 0 {
+			return false
+		}
+		address := ""
+		urlMap := common.ObjToMap(pv["url"])
+		if urlMap != nil && len(*urlMap) > 0 {
+			if urlMap != nil {
+				address = common.InterfaceToStr((*urlMap)[e.Platform])
+			}
+		}
+		//减少库存
+		updatePrizeInfoSql := fmt.Sprintf(`UPDATE %s lpi SET lpi.inventory = lpi.inventory -1 WHERE  lpi.id  =  ?`, consts.TablePrizeInfo)
+		if pid := db.BaseMysql.UpdateOrDeleteBySqlByTx(tx, updatePrizeInfoSql, e.Id); pid <= 0 {
+			return false
+		}
+		//分发兑换码 第一步 获取兑换码
+		equitySql := fmt.Sprintf(`SELECT  ei.id ,ei.code ,ei.ex_end_time  FROM %s ei  WHERE ei.active_id  =? AND  ei.prize_id  = ? AND ei.state =0 AND  ei.ex_end_time  > NOW() ORDER BY ei.ex_end_time ASC LIMIT 1  FOR UPDATE;`, consts.TableEquityInfo)
+		equityInfos := db.BaseMysql.SelectBySqlByTx(tx, equitySql, e.ActiveId, e.Id)
+		if equityInfos == nil || len(*equityInfos) == 0 {
+			return false
+		}
+		ev := (*equityInfos)[0]
+		equityId := common.Int64All(ev["id"])
+		equityCode := common.InterfaceToStr(ev["code"])
+		if equityCode == "" {
+			return false
+		}
+		//分发兑换码 第二步 更新账户表 奖品信息
+		accountSql := fmt.Sprintf(`SELECT lua.order_code ,lua.phone  FROM %s lua WHERE lua.id  = ? AND  lua.active_id  = ? AND  lua.position_id  = ? FOR UPDATE;`, consts.TableUserAccount)
+		accountInfos := db.BaseMysql.SelectBySqlByTx(tx, accountSql, e.AccountId, e.ActiveId, positionId)
+		if accountInfos == nil || len(*accountInfos) == 0 {
+			return false
+		}
+		av := (*accountInfos)[0]
+		orderCode := common.InterfaceToStr(av["order_code"])
+		phone := common.InterfaceToStr(av["phone"])
+		log.Println(orderCode, "--phone--", phone)
+		updateAccountSql := fmt.Sprintf(`UPDATE %s lua  SET lua.prize_id = ? ,lua.equity_id = ? , lua.update_time  =  NOW() WHERE lua.id  = ? `, consts.TableUserAccount)
+		if ai := db.BaseMysql.UpdateOrDeleteBySqlByTx(tx, updateAccountSql, e.Id, equityId, e.AccountId); ai <= 0 {
+			return false
+		}
+		//分发兑换码 第三步 更新兑换码 已被 使用
+		updateEquitySql := fmt.Sprintf(`UPDATE %s ei SET ei.state  = 1,ei.order_code = ?,ei.update_time  = NOW() WHERE ei.id  = ?`, consts.TableEquityInfo)
+		if ei := db.BaseMysql.UpdateOrDeleteBySqlByTx(tx, updateEquitySql, orderCode, equityId); ei <= 0 {
+			return false
+		}
+		//告警
+		if alarmSwitch == 0 && inventory-1 <= alarmThreshold {
+			name := func(activeId int64) (name string) {
+				name = "超级订阅赠送三方会员"
+				value, ok := consts.ActivateName.Load(activeId)
+				log.Printf("库存告警日志:  name:%v, consts.ActivateName:%v, activeId: %v,value:%v,ok:%v \n", name, consts.ActivateName, activeId, value, ok)
+				if ok {
+					name = value.(string)
+				}
+				return
+			}(e.ActiveId)
+			go au.SendAlarmMail(name, prizeName, inventory-1)
+		}
+		msg = ""
+		r = entity.Redeem{
+			Name:    prizeName,
+			Code:    equityCode,
+			Address: address,
+		}
+		return true
+	})
+	return
+}
+
+// 1
+func (e *Ex) GetParties() (ep []*entity.Party) {
+	ruleSql := fmt.Sprintf("SELECT lpi.inventory,pbi.name ,lpi.id  FROM %s pr LEFT JOIN %s lpi ON pr.prize_id  = lpi.id AND pr.active_id = lpi.active_id LEFT JOIN %s pbi ON lpi.pb_id = pbi.id  WHERE pr.active_id = ? AND  pr.product_info_id = ? AND  pr.state  = 0  AND  lpi.state  = 0", consts.TableProductRule, consts.TablePrizeInfo, consts.TablePrizeBaseInfo)
+	parties := db.BaseMysql.SelectBySql(ruleSql, e.ActiveId, e.Id)
+	if parties != nil && len(*parties) > 0 {
+		ep = []*entity.Party{}
+		for _, pv := range *parties {
+			ep = append(ep, &entity.Party{
+				PrizeId: encrypt.SE.EncodeString(common.InterfaceToStr(pv["id"])),
+				Name:    common.InterfaceToStr(pv["name"]),
+				State:   common.If(common.IntAll(pv["inventory"]) > 0, 1, 0).(int),
+			})
+		}
+	}
+	return
+}
+
+// 0
+func (e *Ex) GetRecords() (ex *entity.ExchangeData) {
+	positionId := common.Int64All(e.Sess["positionId"])
+	unionSql := fmt.Sprintf(`SELECT lua.id ,lua.product_info_id ,lua.expires,lua.create_time,lua.update_time,pbi.name AS pname ,pbi.url,ei.code,pi2.name AS jyname ,pi2.mold  FROM  %s lua LEFT JOIN %s lpi  ON lua.prize_id  = lpi.id  LEFT JOIN %s ei ON ei.id  = lua.equity_id LEFT JOIN  %s pi2 ON pi2 .id  = lua.product_info_id LEFT JOIN  %s pbi ON lpi.pb_id = pbi.id   WHERE  lua.position_id  = ? AND  lua.active_id  = ?  ORDER BY  lua.update_time  DESC `, consts.TableUserAccount, consts.TablePrizeInfo, consts.TableEquityInfo, consts.TableProductInfo, consts.TablePrizeBaseInfo)
+	records := db.BaseMysql.SelectBySql(unionSql, positionId, e.ActiveId)
+	if records != nil && len(*records) > 0 {
+		ex = &entity.ExchangeData{
+			Pending:   []*entity.ExchangeList{},
+			Processed: []*entity.ExchangeList{},
+			Address:   "",
+			Rule: func(activeId int64) (rule []map[string]string) {
+				value, ok := consts.ActivateRule.Load(activeId)
+				if ok {
+					rule, ok = value.([]map[string]string)
+					if ok && len(rule) > 0 {
+						return
+					}
+				}
+				activitySql := fmt.Sprintf("SELECT  lai.rule ,lai.name FROM %s lai WHERE lai.id = ? AND lai.state = 0", consts.TableActivityInfo)
+				activityInfos := db.BaseMysql.SelectBySql(activitySql, activeId)
+				if activityInfos != nil && len(*activityInfos) > 0 {
+					activityInfo := (*activityInfos)[0]
+					consts.ActivateName.Store(activeId, common.InterfaceToStr(activityInfo["name"]))
+					errRule := json.Unmarshal([]byte(common.ObjToString(activityInfo["rule"])), &rule)
+					if errRule == nil {
+						if len(rule) > 0 {
+							consts.ActivateRule.Store(activeId, rule)
+						}
+						return
+					}
+				}
+				return
+			}(e.ActiveId),
+		}
+		for _, rv := range *records {
+			urlMap := common.ObjToMap(rv["url"])
+			if ex.Address == "" && urlMap != nil && len(*urlMap) > 0 {
+				if urlMap != nil {
+					ex.Address = common.InterfaceToStr((*urlMap)[e.Platform])
+				}
+			}
+			productId := encrypt.SE.EncodeString(common.InterfaceToStr(rv["product_info_id"]))
+			accountId := encrypt.SE.EncodeString(common.InterfaceToStr(rv["id"]))
+			name := func() string {
+				mold := common.IntAll(rv["mold"])
+				pattern := "购买"
+				switch mold {
+				case 2:
+					pattern = "续费"
+				case 3:
+					pattern = "升级"
+				}
+				return fmt.Sprintf("%s%s", pattern, common.InterfaceToStr(rv["jyname"]))
+			}
+			createDate := strings.ReplaceAll(strings.Split(common.InterfaceToStr(rv["create_time"]), " ")[0], "-", ".")
+			exDate := strings.ReplaceAll(strings.Split(common.InterfaceToStr(rv["update_time"]), " ")[0], "-", ".")
+			exCode := common.InterfaceToStr(rv["code"])
+			partyName := common.InterfaceToStr(rv["pname"])
+			if exCode != "" { //已兑换
+				ex.Processed = append(ex.Processed, &entity.ExchangeList{
+					ProductId:  productId,
+					AccountId:  accountId,
+					Name:       name(),
+					CreateDate: createDate,
+					State:      1,
+					ExCode:     exCode,
+					PartyName:  partyName,
+					EXDate:     exDate,
+				})
+			} else { //未兑换
+				//判断是否已经过期
+				isExpires := func(expires string) bool {
+					expiresTime, err := time.ParseInLocation(date.Date_Full_Layout, expires, time.Local)
+					if err == nil && time.Now().After(expiresTime) {
+						return true
+					}
+					return false
+				}
+				if isExpires(common.InterfaceToStr(rv["expires"])) { //未兑换-已过期
+					ex.Processed = append(ex.Processed, &entity.ExchangeList{
+						ProductId:  productId,
+						AccountId:  accountId,
+						Name:       name(),
+						CreateDate: createDate,
+						State:      -1,
+					})
+				} else { //未兑换-未过期
+					ex.Pending = append(ex.Pending, &entity.ExchangeList{
+						ProductId:  productId,
+						AccountId:  accountId,
+						Name:       name(),
+						CreateDate: createDate,
+						State:      0,
+					})
+				}
+			}
+		}
+	}
+	return
+}

+ 2 - 2
src/jfw/modules/publicapply/src/activityday/dao/raffle.go

@@ -290,7 +290,7 @@ func (r *RaffleInfo) ActiveInfo() (ai *Lai, err error) {
 
 // 奖品信息
 func (r *RaffleInfo) PrizeInfo() (pi *Lpi, err error) {
-	sql := fmt.Sprintf("SELECT * FROM %s lpi WHERE lpi.active_id = ? AND state = 0", consts.TablePrizeInfo)
+	sql := fmt.Sprintf("SELECT lpi.id ,lpi.active_id ,lpi.jy_prize ,lpi.frequency ,lpi.probability ,lpi.inventory ,lpi.total ,lpi.alarm_switch ,lpi.alarm_threshold ,lpi.target ,lpi.daily_num ,pbi.name ,pbi.attribute ,pbi.draw_pic ,pbi.win_pic ,pbi.notes ,pbi.url ,pbi.label  FROM %s lpi LEFT JOIN %s pbi ON lpi.pb_id = pbi.id  WHERE lpi.active_id = ? AND state = 0", consts.TablePrizeInfo, consts.TablePrizeBaseInfo)
 	data := db.BaseMysql.SelectBySql(sql, r.ActiveId)
 	if data != nil && len(*data) > 0 {
 		var (
@@ -369,7 +369,7 @@ func GetToday() (string, string) {
 
 // 获取此次活动 用户获奖信息
 func (r *RaffleInfo) UserAccountInfo() (ua *Lua, err error) {
-	sql := fmt.Sprintf("SELECT lua.active_id,lua.equity_id,lua.prize_id,lua.create_time,lpi.name,lpi.daily_num,lpi.mold FROM %s lua LEFT JOIN %s lpi ON lua.prize_id = lpi.id AND lua.active_id = lpi.active_id WHERE lua.position_id = ? AND lua.active_id = ? ORDER BY lua.create_time ASC", consts.TableUserAccount, consts.TablePrizeInfo)
+	sql := fmt.Sprintf("SELECT lua.active_id,lua.equity_id,lua.prize_id,lua.create_time,lpi.daily_num,lpi.mold FROM %s lua LEFT JOIN %s lpi ON lua.prize_id = lpi.id AND lua.active_id = lpi.active_id WHERE lua.position_id = ? AND lua.active_id = ? ORDER BY lua.create_time ASC", consts.TableUserAccount, consts.TablePrizeInfo)
 	data := db.BaseMysql.SelectBySql(sql, r.UserInfo.PositionId, r.ActiveId)
 	ua = &Lua{}
 	if data != nil && len(*data) > 0 {

+ 35 - 0
src/jfw/modules/publicapply/src/activityday/entity/exchange.go

@@ -0,0 +1,35 @@
+package entity
+
+// 兑换列表详情
+type ExchangeList struct {
+	ProductId  string `json:"product_id"`
+	AccountId  string `json:"account_id"`
+	Name       string `json:"name"`
+	CreateDate string `json:"create_date"`
+	State      int    `json:"state"`
+	ExCode     string `json:"ex_code"`
+	PartyName  string `json:"party_name"`
+	EXDate     string `json:"ex_date"` //兑换时间
+}
+
+// 兑换列表返回结构体
+type ExchangeData struct {
+	Pending   []*ExchangeList     `json:"pending"`
+	Processed []*ExchangeList     `json:"processed"`
+	Address   string              `json:"address"`
+	Rule      []map[string]string `json:"rule"`
+}
+
+// 三方会员
+type Party struct {
+	PrizeId string `json:"prize_id"`
+	Name    string `json:"name"`
+	State   int    `json:"state"`
+}
+
+// 兑换结果
+type Redeem struct {
+	Name    string `json:"name"`
+	Code    string `json:"code"`
+	Address string `json:"address"`
+}

+ 6 - 3
src/jfw/modules/publicapply/src/activityday/service/action.go

@@ -4,7 +4,10 @@ import "app.yhyue.com/moapp/jybase/go-xweb/xweb"
 
 type ActivityDay struct {
 	*xweb.Action
-	list   xweb.Mapper `xweb:"/activity/day/list"`   //我的奖品列表
-	info   xweb.Mapper `xweb:"/activity/day/info"`   //抽奖活动信息
-	raffle xweb.Mapper `xweb:"/activity/day/raffle"` //抽奖
+	list    xweb.Mapper `xweb:"/activity/day/list"`   //我的奖品列表
+	info    xweb.Mapper `xweb:"/activity/day/info"`   //抽奖活动信息
+	raffle  xweb.Mapper `xweb:"/activity/day/raffle"` //抽奖
+	records xweb.Mapper `xweb:"/activity/records"`    //超级订阅下单三方会员兑换列表
+	parties xweb.Mapper `xweb:"/activity/parties"`    //超级订阅下单兑换三方会员列表
+	redeem  xweb.Mapper `xweb:"/activity/redeem"`     //超级订阅下单兑换接口
 }

+ 120 - 0
src/jfw/modules/publicapply/src/activityday/service/exchange.go

@@ -0,0 +1,120 @@
+package service
+
+import (
+	. "app.yhyue.com/moapp/jybase/api"
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"jy/src/jfw/modules/publicapply/src/activityday/dao"
+	autil "jy/src/jfw/modules/publicapply/src/activityday/util"
+	"strconv"
+)
+
+// Redeem 超级订阅下单兑换
+func (d *ActivityDay) Redeem() {
+	defer common.Catch()
+	r := func() Result {
+		if d.Method() != "POST" {
+			return Result{Data: nil, Error_msg: Error_msg_1005}
+		}
+		//接收参数
+		prizeId := d.GetString("prize_id")
+		accountId := d.GetString("account_id")
+		activeId := d.Request.Header.Get("activeId")
+		if activeId == "" || prizeId == "" || accountId == "" {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		prizeId = encrypt.SE.DecodeString(prizeId)
+		accountId = encrypt.SE.DecodeString(accountId)
+		activeId = encrypt.SE.DecodeString(activeId)
+		if activeId == "" || prizeId == "" || accountId == "" {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		acid, _ := strconv.ParseInt(accountId, 10, 64)
+		aid, _ := strconv.ParseInt(activeId, 10, 64)
+		pid, _ := strconv.ParseInt(prizeId, 10, 64)
+		if aid <= 0 || pid <= 0 || acid <= 0 {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		sessVal := d.Session().GetMultiple()
+		positionId := common.Int64All(sessVal["positionId"])
+		if positionId == 0 {
+			return Result{Data: nil, Error_msg: Error_msg_1001}
+		}
+		//防止重复提交
+		if err := autil.RequestValidation(positionId); err != nil {
+			return Result{Data: nil, Error_msg: err.Error()}
+		}
+		platform := dao.GetPlatform(d.Request)
+		list, msg := dao.NewEx(sessVal, platform, aid, pid, acid).Redeem()
+		errorCode := 0
+		if msg != "" {
+			errorCode = -1
+		}
+		return Result{Data: list, Error_msg: msg, Error_code: errorCode}
+	}()
+	d.ServeJson(r)
+}
+
+// Parties 超级订阅下单兑换三方会员列表
+func (d *ActivityDay) Parties() {
+	defer common.Catch()
+	r := func() Result {
+		if d.Method() != "POST" {
+			return Result{Data: nil, Error_msg: Error_msg_1005}
+		}
+		//接收参数
+		productInfoId := d.GetString("product_id")
+		activeId := d.Request.Header.Get("activeId")
+		if activeId == "" || productInfoId == "" {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		activeId = encrypt.SE.DecodeString(activeId)
+		productInfoId = encrypt.SE.DecodeString(productInfoId)
+		if activeId == "" || productInfoId == "" {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		aid, _ := strconv.ParseInt(activeId, 10, 64)
+		pid, _ := strconv.ParseInt(productInfoId, 10, 64)
+		if aid <= 0 || pid <= 0 {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		sessVal := d.Session().GetMultiple()
+		if common.Int64All(sessVal["positionId"]) == 0 {
+			return Result{Data: nil, Error_msg: Error_msg_1001}
+		}
+		platform := dao.GetPlatform(d.Request)
+		list := dao.NewEx(sessVal, platform, aid, pid, 0).GetParties()
+		return Result{Data: list}
+	}()
+	d.ServeJson(r)
+}
+
+// Records 超级订阅下单三方会员兑换列表
+func (d *ActivityDay) Records() {
+	defer common.Catch()
+	r := func() Result {
+		if d.Method() != "POST" {
+			return Result{Data: nil, Error_msg: Error_msg_1005}
+		}
+		//接收参数
+		activeId := d.Request.Header.Get("activeId")
+		if activeId == "" {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		if activeId = encrypt.SE.DecodeString(activeId); activeId == "" {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		aid, _ := strconv.ParseInt(activeId, 10, 64)
+		if aid <= 0 {
+			return Result{Data: nil, Error_msg: Error_msg_1002}
+		}
+		sessVal := d.Session().GetMultiple()
+		if common.Int64All(sessVal["positionId"]) == 0 {
+			return Result{Data: nil, Error_msg: Error_msg_1001}
+		}
+		platform := dao.GetPlatform(d.Request)
+		list := dao.NewEx(sessVal, platform, aid, 0, 0).GetRecords()
+		return Result{Data: list}
+	}()
+	d.ServeJson(r)
+}

+ 3 - 3
src/jfw/modules/publicapply/src/activityday/util/util.go

@@ -47,10 +47,10 @@ func GetDefaultPayWay(userAgent string) string {
 func RequestValidation(positionId int64) (err error) {
 	repeatKey := fmt.Sprintf(consts.RepeatKey, positionId)
 	if ok, redisErr := redis.Exists(consts.RedisCode, repeatKey); ok && redisErr == nil {
-		err = fmt.Errorf("请求频繁 稍后再试")
+		err = fmt.Errorf("正在处理中······")
 		return
 	}
-	//方式重复性请求--1秒内 允许请求一次
-	redis.Put("other", repeatKey, "REPEAT", 1)
+	//方式重复性请求--2秒内 允许请求一次
+	redis.Put("other", repeatKey, "REPEAT", 2)
 	return
 }

+ 3 - 1
src/jfw/modules/publicapply/src/config.yaml

@@ -1,6 +1,8 @@
 etcd:
   hosts:
-  - 192.168.3.206:2379
+    - 192.168.3.207:2379
+    - 192.168.3.165:2379
+    - 192.168.3.204:2379
 userCenterKey: "usercenter.rpc" #用户中台rpc
 powerCheckCenterKey: "powercheck.rpc" #权益校验中台
 entManageApplication: "entmanageapplication.rpc" #企业管理中台

+ 2 - 2
src/jfw/modules/publicapply/src/go.sum

@@ -20,8 +20,8 @@ app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66/go.mod h1:XHNATN6t
 app.yhyue.com/moapp/jyfs v0.0.0-20231024061508-480c270480d4/go.mod h1:61hzZ3dZHXL28BNl8BOgZsvM2S5UVY5YFzOkEUPrSu4=
 app.yhyue.com/moapp/jylog v0.0.0-20230522075550-05d7230ca545 h1:+Lak4m1zgsigQloOsvp8AJ+0XeX/+PGp9QP550xlbBQ=
 app.yhyue.com/moapp/jylog v0.0.0-20230522075550-05d7230ca545/go.mod h1:uFrsdUBFbETiJlEmr4PtJWPsZlUpPj2bHQRhryu6ggk=
-app.yhyue.com/moapp/jypkg v1.22.6 h1:38q9rpOWOwWtPEW6+Y95rcf0eI1Fvcejdq5rK92XNPs=
-app.yhyue.com/moapp/jypkg v1.22.6/go.mod h1:FylaC4MJ4G36WndktgeZfc8jTq3uvBGWIwbk02xfdQI=
+app.yhyue.com/moapp/jypkg v1.22.7 h1:7azZJOhvoJasnKHEab4QF8cwIc5DOthOpmDh85Tif7I=
+app.yhyue.com/moapp/jypkg v1.22.7/go.mod h1:FylaC4MJ4G36WndktgeZfc8jTq3uvBGWIwbk02xfdQI=
 app.yhyue.com/moapp/message v0.0.0-20231204024949-8c7145bfc161 h1:WGi4OEIoqw6NpNFGioUEBZnjK9aBa+xJqf/5WY+QyhM=
 app.yhyue.com/moapp/message v0.0.0-20231204024949-8c7145bfc161/go.mod h1:0Oj8SB4pVjdCLD28sy2zyM3hS0WHGpNuVcakLW43GmI=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=

+ 8 - 36
src/jfw/modules/subscribepay/src/config.json

@@ -1,16 +1,16 @@
 {
-  "mongodbServers": "192.168.3.206:27080",
+  "mongodbServers": "192.168.3.149:27180",
   "mongodbPoolSize": 10,
   "mongodbName": "qfw",
   "mongoent": {
-    "address": "192.168.3.206:27002",
+    "address": "192.168.3.149:27102",
     "size": 5,
     "dbName": "qfw_data",
     "userName": "jyDevGroup",
     "password": "jy@DevGroup"
   },
   "mongobidding": {
-    "address": "192.168.3.206:27002",
+    "address": "192.168.3.149:27102",
     "size": 5,
     "dbName": "qfw_data",
     "replSet": "",
@@ -20,12 +20,12 @@
     "password": "jy@DevGroup"
   },
   "mongoqyfw": {
-    "address": "192.168.3.206:27080",
+    "address": "192.168.3.149:27180",
     "size": 5,
     "dbName": "jyqyfw"
   },
   "mongolog": {
-    "address": "192.168.3.206:27090",
+    "address": "192.168.3.149:27190",
     "size": 5,
     "dbName": "qfw",
     "replSet": "",
@@ -168,41 +168,13 @@
     "siteMsg": {
       "callPlatform": "subscribepay",
       "msgType": 13,
-      "title": "%s已到账,戳我解锁!",
-      "content": "购买%s产品赠送%s已到账。兑换码:%s。兑换截止日期:%s。点击链接<a style=\"color:blue\"  href=\"https://22233.cn/2258\">https://22233.cn/2258</a>进行兑换。#jy#购买%s赠送%s#jy#兑换码:%s。",
-      "link": "https://22233.cn/2258",
+      "title": "赠送三方会员已到账,戳我解锁!",
+      "content": "购买%s产品赠送三方会员已到账。兑换截止日期:%s。请在剑鱼标讯平台兑换中心获取兑换码进行兑换。#jy#购买%s赠送三方会员#jy#请前往剑鱼标讯平台进行兑换解锁福利。",
+      "link": "",
       "androidUrl": "",
       "iosUrl": "",
       "weChatUrl": ""
     },
-    "mailAlarm": {
-      "to": [
-        "liumingliang@topnet.net.cn",
-        "zhaozhenzhen-jyyyb@topnet.net.cn",
-        "wangshan@topnet.net.cn",
-        "yanpeizhu@topnet.net.cn",
-        "yangliang@topnet.net.cn"
-      ],
-      "title": "赠送兑换码活动库存告警",
-      "reTry": 3,
-      "threshold": {
-        "0": {
-          "name": "月度",
-          "value": 50
-        },
-        "1": {
-          "name": "年度",
-          "value": 5
-        }
-      }
-    },
-    "sms": {
-      "args": [
-        "%s。兑换码%s。兑换截止日期:%s",
-        "点击链接https://22233.cn/2258进行兑换。"
-      ],
-      "tid": "04"
-    },
     "saleDep": {
       "040000": true,
       "040100": true,

+ 0 - 13
src/jfw/modules/subscribepay/src/config/config.go

@@ -130,19 +130,6 @@ type config struct {
 			IosUrl       string `json:"iosUrl"`
 			WeChatUrl    string `json:"weChatUrl"`
 		} `json:"siteMsg"` // 站内信内容配置
-		MailAlarm struct {
-			To        []string `json:"to"`
-			Title     string   `json:"title"`
-			ReTry     int      `json:"reTry"`
-			Threshold map[string]struct {
-				Name  string `json:"name"`
-				Value int    `json:"value"`
-			} `json:"threshold"` // 库存剩余阈值
-		} `json:"mailAlarm"` // 库存告警
-		Sms struct {
-			Args []string `json:"args"` // 短信部分可配置参数
-			Tid  string   `json:"tid"`  // 短信模板id
-		} `json:"sms"` // 短信配置
 		SaleDep map[string]bool // 代用户下单业绩归属部门配置 只有业绩归属为运营部才赠送
 	} `json:"equityActive"` // p459赠送视频权益活动配置
 	PayRaffle struct {

+ 100 - 169
src/jfw/modules/subscribepay/src/entity/equityActive.go

@@ -1,37 +1,63 @@
 package entity
 
 import (
-	"app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/date"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/redis"
-	"fmt"
-	"gopkg.in/mgo.v2/bson"
-	"jy/src/jfw/modules/subscribepay/src/config"
-	"jy/src/jfw/modules/subscribepay/src/util"
-	"log"
-	"strings"
-	"sync"
+    "app.yhyue.com/moapp/jybase/common"
+    "app.yhyue.com/moapp/jybase/date"
+    "app.yhyue.com/moapp/jybase/encrypt"
+    "app.yhyue.com/moapp/jybase/redis"
+    "fmt"
+    "jy/src/jfw/modules/subscribepay/src/config"
+    "jy/src/jfw/modules/subscribepay/src/util"
+    "log"
+    "sync"
+    "time"
 )
 
 const (
 	TableEquityInfo = "jyactivities.equity_info" // 营销权益信息表
 	//TableEquityActive     = "jyactivities.equity_active" // 营销权益活动表 P477和权益码兑换表合成一张表
-	TableEquityActive      = "jyactivities.activity_info"       // 营销权益活动表
-	TableOrder             = "jianyu.dataexport_order"          // 订单表
-	TableLotteryPrizeOrder = "jyactivities.lottery_prize_order" // 下单后抽奖活动关联订单信息表
-	TablebasePosition      = "base_service.base_position"       // 用户职位表
-	valueStateGifted       = 1                                  // 已赠送状态值
-	valueMoldMonth         = 0                                  // 月度
-	valueMoldYear          = 1                                  // 年度
-	valueOrderTypeCreate   = 1                                  // 超级订阅订单类型: 购买
-	valueOrderTypeRenew    = 2                                  // 续费
-	valueOrderTypeUpgrade  = 3                                  // 升级
-	valueCycleUnitYear     = 1                                  // 周期单位为年
-	valueAreaCountAll      = -1                                 //  全国
+	TableEquityActive       = "jyactivities.activity_info"        // 营销权益活动表
+	TableOrder              = "jianyu.dataexport_order"           // 订单表
+	TableLotteryPrizeOrder  = "jyactivities.lottery_prize_order"  // 下单后抽奖活动关联订单信息表
+	TableLotteryProducInfo  = "jyactivities.product_info"         // 活动奖励对应的剑鱼产品说明表
+	TableLotteryProductRule = "jyactivities.product_rule"         // 赠送规则iddoc
+	TableLotteryUserCount   = "jyactivities.lottery_user_account" // 用户中奖信息表
+	TableLotteryPrizeInfo   = "jyactivities.lottery_prize_info"   // 奖品信息配置表
+	TablebasePosition       = "base_service.base_position"        // 用户职位表
+	valueStateGifted        = 1                                   // 已赠送状态值
+	valueMoldMonth          = 0                                   // 月度
+	valueMoldYear           = 1                                   // 年度
+	valueOrderTypeCreate    = 1                                   // 超级订阅订单类型: 购买
+	valueOrderTypeRenew     = 2                                   // 续费
+	valueOrderTypeUpgrade   = 3                                   // 升级
+	valueCycleUnitYear      = 1                                   // 周期单位为年
+	valueCycleUnitMonth     = 2                                   // 周期单位为月
+	valueCycleUnitDay       = 3                                   // 周期单位为天
+	valueCycleUnitQuarter   = 4                                   // 周期单位为季
+	valueAreaCountAll       = -1                                  //  全国
 
 )
 
+// mold_wide_cycle : id
+var ActivityProductInfoMap = map[string]int{}
+
+// 为了初始化产品信息到内存
+func init() {
+	query := fmt.Sprintf("SELECT * FROM %s where state=0;", TableLotteryProducInfo)
+	rs := util.BaseMysql.SelectBySql(query)
+	if rs == nil || len(*rs) == 0 {
+		log.Println("jyactivities.product_info 未获取到数据")
+		return
+	}
+	for i := 0; i < len(*rs); i++ {
+		id := (*rs)[i]["id"]
+		mold := (*rs)[i]["mold"]
+		wide := (*rs)[i]["wide"]
+		cycle := (*rs)[i]["cycle"]
+		ActivityProductInfoMap[fmt.Sprintf("%v_%v_%v", mold, wide, cycle)] = common.IntAll(id)
+	}
+}
+
 var equityStockLock = sync.Mutex{} // 赠送视频权益码库存锁
 // EquityActive 赠送视频会员活动
 type EquityActive struct {
@@ -40,8 +66,8 @@ type EquityActive struct {
 	positionId       int    // 职位id
 	Phone            string // 手机号 用于发短信
 	OrderCode        string // 订单号
-	OrderType        int    // 1购买 2升级 3续费
-	CycleUnit        int    // 单位  1-年
+	OrderType        int    // 1购买 2续费 3升级
+	CycleUnit        int    // 单位  1-年 2-月  3-天  4-季
 	CycleCount       int    // 数量
 	AreaCount        int    // -1 是全国
 	ProductType      string // 消息中的产品类型
@@ -53,7 +79,7 @@ type EquityActive struct {
 // GiftVip 赠送腾讯视频会员
 func (e *EquityActive) GiftVip() {
 	//1. 判断活动是否开启
-	open, activeId, activeName := e.activityStart()
+	open, activeId, _ := e.activityStart()
 	if !open || activeId <= 0 {
 		return
 	}
@@ -63,17 +89,17 @@ func (e *EquityActive) GiftVip() {
 		log.Println("equityActive 未获取到有效的mgoId", e.OrderCode)
 		return
 	}
-	//2. 判断是否符合赠送条件
-	ok, mold := e.matchOrder()
-	if !ok {
+	//2. 判断是否符合活动配置的产品id
+	productInfoId := e.matchOrder()
+	if productInfoId <= 0 {
 		return
 	}
 	equityStockLock.Lock()
 	defer func() {
 		equityStockLock.Unlock()
 	}()
-	//3. 判断库存
-	e.processEquityInfo(activeName, activeId, mold)
+	//3. 1-判该产品id 是否有对应库存 2-更新用户待获取订单表 3-符合条件则发送消息
+	e.processEquityInfo(activeId, productInfoId)
 }
 
 // txActivityStart 判断活动是否开启 开启则返回活动id
@@ -91,105 +117,53 @@ func (e *EquityActive) activityStart() (open bool, id int, name string) {
 }
 
 // 判断订单是否符合条件
-func (e *EquityActive) matchOrder() (ok bool, mold int) {
-	//(购买||续费)
-	if (e.OrderType == valueOrderTypeCreate || e.OrderType == valueOrderTypeRenew) && e.CycleCount > 0 {
-		// 判断购买是否为年度订单
-		if e.CycleUnit != valueCycleUnitYear {
-			return
-		}
-		// 为年度订单则判断是否为全国
-		if e.AreaCount == valueAreaCountAll {
-			ok = true
-			mold = valueMoldYear //全国赠送1年
-		} else {
-			ok = true
-			mold = valueMoldMonth //非全国赠送1月
-		}
-		//其他不赠送
-		return
-	} else if e.OrderType == valueOrderTypeUpgrade {
-		// 升级
-		// 判断是否是年度会员  不是年度会员则不赠送 是则赠送1月
-		if e.isYearVip() {
-			ok = true
-			mold = valueMoldMonth
-		}
-	}
-	return
+func (e *EquityActive) matchOrder() (productInfoId int) {
+	// mold  '类型:1:购买;2:续费;3:升级',
+	//`wide` int(1) DEFAULT '0' COMMENT '是否全国:默认0:非全国;1:全国',
+	//`cycle` int(1) DEFAULT '0' COMMENT '下单周期:1:月;2:季;3:年',
+	// 1. 获取product_info_id
+	mold := e.OrderType
+	wide := common.If(e.AreaCount == -1, -1, 0)
+	cycle := e.CycleUnit
+	key := fmt.Sprintf("%v_%v_%v", mold, wide, cycle)
+	return ActivityProductInfoMap[key]
 }
 
-// 处理库存
-func (e *EquityActive) processEquityInfo(activeName string, activeId, mold int) {
-	count := 0
-	tx, err := util.Mysql.DB.Begin()
-	if err != nil {
-		log.Println("equityActive db Begin:", err)
-		return
-	}
-	now := date.NowFormat(date.Date_Full_Layout)
-	countQuery := fmt.Sprintf("SELECT count(*)  FROM %s where state= 0 and mold=? and active_id=? and ex_end_time>?;", TableEquityInfo)
-	rows, err := tx.Query(countQuery, mold, activeId, now)
-	if err != nil || rows == nil {
-		log.Println("获取剩余库存数量失败:", err, rows, e.OrderCode)
-		return
-	}
-	defer rows.Close()
-	for rows.Next() {
-		err = rows.Scan(&count)
-		if err != nil {
-			log.Println("遍历剩余库存数量失败:", err, rows)
-			return
-		}
-	}
-	if count <= 0 {
-		log.Println("库存剩余为0:", countQuery, mold, activeId, now)
-		return
-	}
-	query := fmt.Sprintf("SELECT id,name,code,date_format(ex_end_time,'%%Y-%%m-%%d') as ex_end_time  FROM %s where state= 0 and mold=? and active_id=? and ex_end_time>? limit 1  for update;", TableEquityInfo)
-	data, err := tx.Query(query, mold, activeId, now)
-	if err != nil || data == nil {
-		tx.Rollback()
-		log.Println("获取视频权益码信息失败:", err, data, e.OrderCode)
-		return
-	}
-	eId, name, code, exEndTime := 0, "", "", ""
-	defer data.Close()
-	for data.Next() {
-		err = data.Scan(&eId, &name, &code, &exEndTime)
-	}
-	if err != nil {
-		log.Println("获取视频权益码失败:", err, data, e.OrderCode)
-		tx.Rollback()
-		return
-	}
-	threshold, b := config.Config.EquityActive.MailAlarm.Threshold[fmt.Sprintf("%v", mold)]
-	if count < 1 || eId <= 0 {
-		tx.Rollback()
-		// 没有库存
-		if b {
-			go e.sendAlarmMail(activeName, activeId, threshold.Name, mold, 0)
-		}
+//// 2. 根据product_info_id  获取对应奖品信息是否有库存
+
+// 存 lottery_user_account   发消息
+func (e *EquityActive) processEquityInfo(activeId, productInfoId int) {
+	//判断库存
+	q := fmt.Sprintf("SELECT sum(b.inventory) as inventory ,min(a.cycle) as cycle  FROM %s a left join %s b on(a.prize_id=b.id) where a.state=0 and b.state=0 and a.product_info_id=? and a.active_id=?;", TableLotteryProductRule, TableLotteryPrizeInfo)
+	rs := util.BaseMysql.SelectBySql(q, productInfoId, activeId)
+	if rs == nil || len(*rs) == 0 {
 		return
 	}
-	if b && int(count)-1 <= threshold.Value {
-		// 发库存告警时这减去1是因为这一次消耗一个
-		go e.sendAlarmMail(activeName, activeId, threshold.Name, mold, int(count)-1)
-	}
-	update := fmt.Sprintf("update %s set order_code=?,state=?,update_time=? where id=? ", TableEquityInfo)
-	_, err = tx.Exec(update, e.OrderCode, valueStateGifted, date.NowFormat(date.Date_Full_Layout), eId)
-	if err != nil {
-		tx.Rollback()
-		log.Println("更新视频权益码失败", e.OrderCode, eId, err)
+	inventory := common.IntAll((*rs)[0]["inventory"])
+	if inventory <= 0 { // 判断库存
 		return
 	}
-	err = tx.Commit()
-	if err != nil {
-		log.Println("视频权益码commit失败", e.OrderCode, eId, err)
-		return
+	cycle := common.IntAll((*rs)[0]["cycle"])
+	if cycle <= 0 {
+		cycle = 90
 	}
-	//6. 发送短信、站内信
-	go e.sendVipMsg(name, code, exEndTime)
+	now := time.Now()
+	// 计算过期时间
+	expires := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, time.Local).AddDate(0, 0, cycle)
+	// 存记录
+	util.BaseMysql.Insert(TableLotteryUserCount, map[string]interface{}{
+		"active_id":       activeId,
+		"phone":           e.Phone,
+		"position_id":     e.positionId,
+		"mgo_user_id":     e.mgoId,
+		"order_code":      e.OrderCode,
+		"create_time":     date.NowFormat(date.Date_Full_Layout),
+		"update_time":     date.NowFormat(date.Date_Full_Layout),
+		"expires":         date.FormatDate(&expires, date.Date_Full_Layout),
+		"product_info_id": productInfoId,
+	})
+	// 站内信
+	go e.sendVipMsg(date.FormatDate(&expires, date.Date_Short_Layout))
 	return
 }
 
@@ -208,42 +182,11 @@ func (e *EquityActive) setUserID() {
 	if phone != "" {
 		e.Phone = phone
 	}
-	// 如果没有redis取到说明是代用户下单的订单
-	// 代用户下单的现在只有个人版的 所以可以直接从订单里面取用户mgoId
-	// 但是需要再判断业绩归属部门
-	if e.mgoId == "" && bson.IsObjectIdHex(e.UserId) && e.SaleDep != "" {
-		if _, ok := config.Config.EquityActive.SaleDep[e.SaleDep]; ok {
-			e.mgoId = e.UserId
-		}
-	}
-	return
-}
-
-// 支付后发送抽奖消息 获取用户id
-func (e *EquityActive) setUserIDPayRaffle() {
-	orderKey := fmt.Sprintf("order_%s", e.OrderCode)
-	rs := redis.Get("other", orderKey)
-	info := common.ObjToMap(rs)
-	phone := ""
-	if info != nil && len(*info) > 0 {
-		log.Println("PayRaffle 获取到redis保存的用户身份信息:", orderKey, info)
-		e.mgoId = common.ObjToString((*info)["mgoId"])
-		e.positionId = common.IntAll((*info)["positionId"])
-		phone = common.ObjToString((*info)["phone"])
-	}
-	if phone != "" {
-		e.Phone = phone
-	}
-	// 如果没有redis取到说明是代用户下单的订单
-	// 代用户下单的现在只有个人版的 所以可以直接从订单里面取用户mgoId
-	if e.mgoId == "" && bson.IsObjectIdHex(e.UserId) {
-		e.mgoId = e.UserId
-	}
 	return
 }
 
 // 发送消息
-func (e *EquityActive) sendVipMsg(eName, code, ex_end_time string) {
+func (e *EquityActive) sendVipMsg(ex_end_time string) {
 	// 发送短信
 	//  04 短信模板:用户{1}您好,购买{2}产品赠送您{3},请前往{4}进行兑换解锁福利。
 	// 手机号处理
@@ -272,8 +215,8 @@ func (e *EquityActive) sendVipMsg(eName, code, ex_end_time string) {
 	p := util.MessageParam{
 		UserIds:     e.mgoId,
 		PositionIds: fmt.Sprintf("%v", e.positionId),
-		Title:       fmt.Sprintf(siteMsg.Title, eName),
-		Content:     fmt.Sprintf(siteMsg.Content, e.ProductType, eName, code, ex_end_time, e.ProductType, eName, code),
+		Title:       fmt.Sprintf(siteMsg.Title),
+		Content:     fmt.Sprintf(siteMsg.Content, e.ProductType, ex_end_time, e.ProductType),
 		MsgType:     siteMsg.MsgType,
 		SendMode:    2,
 		Link:        siteMsg.Link,
@@ -285,18 +228,6 @@ func (e *EquityActive) sendVipMsg(eName, code, ex_end_time string) {
 
 }
 
-// 库存告警
-func (e *EquityActive) sendAlarmMail(activeName string, activeId int, name string, mold, count int) {
-	ma := config.Config.EquityActive.MailAlarm
-	if len(ma.To) == 0 {
-		log.Println("未配置视频会员权益码活动库存告警邮箱")
-		return
-	}
-	to := strings.Join(ma.To, ",")
-	content := fmt.Sprintf("活动:%s(活动id:%d),%s权益(mold:%d)当前库存:%d", activeName, activeId, name, mold, count)
-	util.SendRetryMailMany(ma.ReTry, to, ma.Title, content, "", "", config.GmailAuth)
-}
-
 // 判断是否年度会员
 func (e *EquityActive) isYearVip() bool {
 	query := fmt.Sprintf("select count(*) from %s where user_id=? and order_status=1 and product_type =? and (timestampdiff(day,vip_starttime,vip_endtime)>=365) order by create_time desc limit 1", TableOrder)