1、过期号码筛选

This commit is contained in:
2025-10-21 14:29:27 +08:00
parent 1a5cffa2cc
commit 837900462a
2 changed files with 13 additions and 3 deletions

View File

@ -14,8 +14,10 @@ type SmsPhoneGetPageReq struct {
dto.Pagination `search:"-"` dto.Pagination `search:"-"`
Service string `form:"service" search:"type:exact;column:service;table:sms_phone" comment:"sms 服务"` Service string `form:"service" search:"type:exact;column:service;table:sms_phone" comment:"sms 服务"`
PlatformCode string `form:"platformCode" search:"type:exact;column:platform_code;table:sms_phone" comment:"平台code"` PlatformCode string `form:"platformCode" search:"type:exact;column:platform_code;table:sms_phone" comment:"平台code"`
ServiceCode string `form:"serviceCode" search:"type:exact;column:service_code;table:sms_phone" comment:"服务code"` ServiceCode string `form:"serviceCode" search:"type:contains;column:service_code;table:sms_phone" comment:"服务code"`
Phone string `form:"phone" search:"type:contains;column:phone;table:sms_phone" comment:"号码"`
Type int `form:"type" search:"-" comment:"类型 0-短效 1-长效"` Type int `form:"type" search:"-" comment:"类型 0-短效 1-长效"`
IsActived int `form:"isActived" search:"-" comment:"是否可用"`
SmsPhoneOrder SmsPhoneOrder
} }

View File

@ -725,12 +725,20 @@ func (e *SmsPhone) GetPage(c *dto.SmsPhoneGetPageReq, p *actions.DataPermission,
var err error var err error
var data models.SmsPhone var data models.SmsPhone
err = e.Orm.Model(&data). query := e.Orm.Model(&data).
Scopes( Scopes(
cDto.MakeCondition(c.GetNeedSearch()), cDto.MakeCondition(c.GetNeedSearch()),
cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
actions.Permission(data.TableName(), p), actions.Permission(data.TableName(), p),
). )
switch c.IsActived {
case 1:
query = query.Where("expire_time > ?", time.Now())
case 2:
query = query.Where("expire_time < ?", time.Now())
}
err = query.
Find(list).Limit(-1).Offset(-1). Find(list).Limit(-1).Offset(-1).
Count(count).Error Count(count).Error
if err != nil { if err != nil {