diff --git a/controller/ad_position_controller.go b/controller/ad_position_controller.go index 8a6999c..adff651 100644 --- a/controller/ad_position_controller.go +++ b/controller/ad_position_controller.go @@ -11,7 +11,7 @@ import ( type adPosition struct{} -var AdPosition = &adPosition{} +var AdPosition = new(adPosition) // Add 添加广告位 func (c *adPosition) Add(ctx context.Context, req *dto.AddAdPositionReq) (res *dto.AddAdPositionRes, err error) { diff --git a/controller/ad_source_controller.go b/controller/ad_source_controller.go index 1b458d5..db61943 100644 --- a/controller/ad_source_controller.go +++ b/controller/ad_source_controller.go @@ -10,9 +10,7 @@ import ( "github.com/gogf/gf/v2/errors/gerror" ) -var ( - AdSource = adSource{} -) +var AdSource = new(adSource) type adSource struct{} diff --git a/controller/ad_statistics_controller.go b/controller/ad_statistics_controller.go index fb4aaa7..95d7f58 100644 --- a/controller/ad_statistics_controller.go +++ b/controller/ad_statistics_controller.go @@ -9,7 +9,7 @@ import ( type adStatistics struct{} -var AdStatistics = &adStatistics{} +var AdStatistics = new(adStatistics) // GetStatistics 获取统计数据 func (c *adStatistics) GetStatistics(ctx context.Context, req *dto.GetAdStatisticsReq) (res *dto.GetAdStatisticsRes, err error) { diff --git a/controller/advertisement_controller.go b/controller/advertisement_controller.go index 8f7a161..b72b753 100644 --- a/controller/advertisement_controller.go +++ b/controller/advertisement_controller.go @@ -10,7 +10,7 @@ import ( type advertisement struct{} -var Advertisement = &advertisement{} +var Advertisement = new(advertisement) // Add 添加广告 func (c *advertisement) Add(ctx context.Context, req *dto.AddAdvertisementReq) (res *dto.AddAdvertisementRes, err error) { diff --git a/controller/advertiser_controller.go b/controller/advertiser_controller.go index f5024a0..0a4055e 100644 --- a/controller/advertiser_controller.go +++ b/controller/advertiser_controller.go @@ -10,7 +10,7 @@ import ( type advertiser struct{} -var Advertiser = &advertiser{} +var Advertiser = new(advertiser) // Add 添加广告主 func (c *advertiser) Add(ctx context.Context, req *dto.AddAdvertiserReq) (res *dto.AddAdvertiserRes, err error) { diff --git a/controller/application_controller.go b/controller/application_controller.go index a4ed698..f72d487 100644 --- a/controller/application_controller.go +++ b/controller/application_controller.go @@ -7,9 +7,7 @@ import ( "cidservice/service" ) -var ( - Application = application{} -) +var Application = new(application) type application struct{} diff --git a/controller/cid_controller.go b/controller/cid_controller.go index b22d533..f446900 100644 --- a/controller/cid_controller.go +++ b/controller/cid_controller.go @@ -9,9 +9,7 @@ import ( "github.com/gogf/gf/v2/errors/gerror" ) -var ( - CID = cid{} -) +var CID = new(cid) type cid struct{} diff --git a/controller/rate_limit_controller.go b/controller/rate_limit_controller.go index 564fcad..f400853 100644 --- a/controller/rate_limit_controller.go +++ b/controller/rate_limit_controller.go @@ -7,9 +7,7 @@ import ( "cidservice/service" ) -var ( - RateLimit = rateLimit{} -) +var RateLimit = new(rateLimit) type rateLimit struct{} diff --git a/controller/report_controller.go b/controller/report_controller.go index 98dad06..8c58610 100644 --- a/controller/report_controller.go +++ b/controller/report_controller.go @@ -11,7 +11,7 @@ import ( type report struct{} -var Report = &report{} +var Report = new(report) // Create 创建报表 func (c *report) Create(ctx context.Context, req *dto.CreateReportReq) (res *dto.CreateReportRes, err error) { diff --git a/controller/stat_report_controller.go b/controller/stat_report_controller.go index dce17d5..fd7798c 100644 --- a/controller/stat_report_controller.go +++ b/controller/stat_report_controller.go @@ -7,9 +7,7 @@ import ( "cidservice/service" ) -var ( - StatReport = &statReport{} -) +var StatReport = new(statReport) type statReport struct{} diff --git a/controller/strategy_controller.go b/controller/strategy_controller.go index 6f099ff..1dd9efa 100644 --- a/controller/strategy_controller.go +++ b/controller/strategy_controller.go @@ -9,9 +9,7 @@ import ( "github.com/gogf/gf/v2/errors/gerror" ) -var ( - Strategy = strategy{} -) +var Strategy = new(strategy) type strategy struct{} diff --git a/main.go b/main.go index de1a796..0cc80a1 100644 --- a/main.go +++ b/main.go @@ -20,8 +20,8 @@ func main() { controller.AdPosition, controller.AdStatistics, controller.Report, - //controller.RateLimit, - //controller.Application, + controller.RateLimit, + controller.Application, controller.StatReport, }) select {}