This commit is contained in:
孟帅
2024-04-22 23:08:40 +08:00
parent 82483bd7b9
commit e144b12580
445 changed files with 17457 additions and 6708 deletions

View File

@@ -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()