mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-27 23:57:09 +08:00
发布v2.15.1版本,更新内容请查看:https://github.com/bufanyun/hotgo/blob/v2.0/docs/guide-zh-CN/start-update-log.md
This commit is contained in:
@@ -335,7 +335,7 @@ func (s *sSysEmsLog) AllowSend(ctx context.Context, models *entity.SysEmsLog, co
|
||||
}
|
||||
|
||||
if config.MaxIpLimit > 0 {
|
||||
count, err := s.NowDayCount(ctx, models.Event, models.Email)
|
||||
count, err := s.NowDayIpSendCount(ctx, models.Event)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -348,10 +348,10 @@ func (s *sSysEmsLog) AllowSend(ctx context.Context, models *entity.SysEmsLog, co
|
||||
return
|
||||
}
|
||||
|
||||
// NowDayCount 当天发送次数
|
||||
func (s *sSysEmsLog) NowDayCount(ctx context.Context, event, email string) (count int, err error) {
|
||||
// NowDayIpSendCount 当天IP累计发送次数
|
||||
func (s *sSysEmsLog) NowDayIpSendCount(ctx context.Context, event string) (count int, err error) {
|
||||
return dao.SysEmsLog.Ctx(ctx).
|
||||
Where("email", email).
|
||||
Where("ip", location.GetClientIp(ghttp.RequestFromCtx(ctx))).
|
||||
Where("event", event).
|
||||
WhereGTE("created_at", gtime.Now().Format("Y-m-d")).
|
||||
Count()
|
||||
|
Reference in New Issue
Block a user