|
@@ -10,6 +10,8 @@ type CcIpListRepository interface {
|
|
|
GetHttpWebId(ctx context.Context, serverId int64) (int64, error)
|
|
|
GetIpListId(ctx context.Context, serverId int64,ipListType string) (int64,error)
|
|
|
GetIpId(ctx context.Context, ipListId int64,ip string,sourceCategory string) (int64,error)
|
|
|
+ GetCcIpCount(ctx context.Context,ipListId int64, ip string,sourceCategory string) (int64, error)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
func NewCcIpListRepository(
|
|
@@ -45,5 +47,10 @@ func (r *ccIpListRepository) GetIpListId(ctx context.Context, serverId int64,ipL
|
|
|
|
|
|
func (r *ccIpListRepository) GetIpId(ctx context.Context, ipListId int64,ip string,sourceCategory string) (int64,error) {
|
|
|
var ipId int64
|
|
|
- return ipId, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND value = ? AND sourceCategory = ?", ipListId,ip,sourceCategory).Select("id").Scan(&ipId).Error
|
|
|
+ return ipId, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND value = ? AND sourceCategory = ?", ipListId,ip,sourceCategory).Order("id desc").Limit(1).Select("id").Scan(&ipId).Error
|
|
|
+}
|
|
|
+
|
|
|
+func (r *ccIpListRepository) GetCcIpCount(ctx context.Context,ipListId int64, ip string,sourceCategory string) (int64, error) {
|
|
|
+ var count int64
|
|
|
+ return count, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND value = ? AND sourceCategory = ?", ipListId,ip,sourceCategory).Count(&count).Error
|
|
|
}
|