|
@@ -1323,13 +1323,17 @@ func (e *EquityCode) InitCheckInfo(groupId string, groupType int, frequencyLimit
|
|
|
|
|
|
// CheckFrequencyLimit 校验兑换码次数
|
|
|
func (e *EquityCode) CheckFrequencyLimit() bool {
|
|
|
- if e.userInfo == nil || len(e.userInfo) == 0 || e.frequencyLimit == 0 {
|
|
|
+ if e.userInfo == nil || len(e.userInfo) == 0 || e.frequencyLimit == 0 || e.UserId == "" {
|
|
|
+ log.Println("没有用户信息不用校验")
|
|
|
// 没有用户信息 说明是新用户 不用校验 或者没有设置验证
|
|
|
return true
|
|
|
}
|
|
|
_id := qu.ObjToString(e.userInfo["_id"])
|
|
|
+ log.Println(_id)
|
|
|
q := "select count(*) from jyactivities.equity_record where userId=? and equityId=?"
|
|
|
- if int(util.BaseMysql.CountBySql(q, _id, e.EquityId)) >= e.frequencyLimit {
|
|
|
+ count := int(util.BaseMysql.CountBySql(q, e.UserId, e.EquityId))
|
|
|
+ log.Println("count===", e.UserId, e.EquityId)
|
|
|
+ if count >= e.frequencyLimit {
|
|
|
return false
|
|
|
}
|
|
|
return true
|