代码初始化
This commit is contained in:
86
dao/copydata/api_account_report_detail_dao.go
Normal file
86
dao/copydata/api_account_report_detail_dao.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var CidAccountReportDetail = new(cidAccountReportDetailDao)
|
||||
|
||||
type cidAccountReportDetailDao struct{}
|
||||
|
||||
// Insert 插入广告数据报表详情
|
||||
func (d *cidAccountReportDetailDao) Insert(ctx context.Context, req *dto.CidAccountReportDetailItem) (id int64, err error) {
|
||||
var entityData *entity.CidAccountReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.CidAccountReportDetailTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入广告数据报表详情
|
||||
func (d *cidAccountReportDetailDao) BatchInsert(ctx context.Context, reqs []*dto.CidAccountReportDetailItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
// 分批处理,每批100条
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.CidAccountReportDetail, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.CidAccountReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 执行批量插入
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.CidAccountReportDetailTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
// 批量插入失败,尝试逐条插入
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
86
dao/copydata/api_account_report_sum_dao.go
Normal file
86
dao/copydata/api_account_report_sum_dao.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var CidAccountReportSum = new(CidAccountReportSumDao)
|
||||
|
||||
type CidAccountReportSumDao struct{}
|
||||
|
||||
// Insert 插入广告数据报表详情
|
||||
func (d *CidAccountReportSumDao) Insert(ctx context.Context, req *dto.CidAccountReportSumItem) (id int64, err error) {
|
||||
var entityData *entity.CidAccountReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.CidAccountReportSumTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入广告数据报表详情
|
||||
func (d *CidAccountReportSumDao) BatchInsert(ctx context.Context, reqs []*dto.CidAccountReportSumItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
// 分批处理,每批100条
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.CidAccountReportSum, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.CidAccountReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 执行批量插入
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.CidAccountReportSumTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
// 批量插入失败,尝试逐条插入
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
81
dao/copydata/creative_report_detail_dao.go
Normal file
81
dao/copydata/creative_report_detail_dao.go
Normal file
@@ -0,0 +1,81 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var CreativeReportDetail = new(CreativeReportDetailDao)
|
||||
|
||||
type CreativeReportDetailDao struct{}
|
||||
|
||||
func (d *CreativeReportDetailDao) Insert(ctx context.Context, req *dto.CreativeReportDetailItem) (id int64, err error) {
|
||||
var entityData *entity.CreativeReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.CreativeReportDetailTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
func (d *CreativeReportDetailDao) BatchInsert(ctx context.Context, reqs []*dto.CreativeReportDetailItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.CreativeReportDetail, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.CreativeReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.CreativeReportDetailTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
86
dao/copydata/creative_report_sum_dao.go
Normal file
86
dao/copydata/creative_report_sum_dao.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var CreativeReportSum = new(CreativeReportSumDao)
|
||||
|
||||
type CreativeReportSumDao struct{}
|
||||
|
||||
// Insert 插入广告效果指标表
|
||||
func (d *CreativeReportSumDao) Insert(ctx context.Context, req *dto.CreativeReportSumItem) (id int64, err error) {
|
||||
var entityData *entity.CreativeReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.CreativeReportSumTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入广告效果指标表
|
||||
func (d *CreativeReportSumDao) BatchInsert(ctx context.Context, reqs []*dto.CreativeReportSumItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
// 分批处理,每批 100 条
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.CreativeReportSum, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.CreativeReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 执行批量插入
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.CreativeReportSumTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
// 批量插入失败,尝试逐条插入
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
128
dao/copydata/material_report_dao.go
Normal file
128
dao/copydata/material_report_dao.go
Normal file
@@ -0,0 +1,128 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var MaterialReport = new(materialReportDao)
|
||||
|
||||
type materialReportDao struct{}
|
||||
|
||||
// Insert 插入素材报表数据
|
||||
func (d *materialReportDao) Insert(ctx context.Context, req *dto.MaterialReportItem) (id int64, err error) {
|
||||
var entityData *entity.MaterialReport
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.MaterialReportTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入素材报表数据
|
||||
func (d *materialReportDao) BatchInsert(ctx context.Context, reqs []*dto.MaterialReportItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.MaterialReport, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.MaterialReport
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.MaterialReportTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
|
||||
// List 查询素材报表数据列表
|
||||
func (d *materialReportDao) List(ctx context.Context, req *dto.ListMaterialReportReq) ([]*entity.MaterialReport, int, error) {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.MaterialReportTable).Model
|
||||
|
||||
if req.ReportDateStr != "" {
|
||||
model = model.Where("report_date_str", req.ReportDateStr)
|
||||
}
|
||||
if req.PhotoId != "" {
|
||||
model = model.Where("photo_id", req.PhotoId)
|
||||
}
|
||||
if req.CampaignId != nil {
|
||||
model = model.Where("campaign_id", req.CampaignId)
|
||||
}
|
||||
if req.UnitId != nil {
|
||||
model = model.Where("unit_id", req.UnitId)
|
||||
}
|
||||
if req.CreativeId != nil {
|
||||
model = model.Where("creative_id", req.CreativeId)
|
||||
}
|
||||
if req.Keyword != "" {
|
||||
model = model.Where("(photo_name LIKE ? OR campaign_name LIKE ? OR unit_name LIKE ? OR creative_name LIKE ?)",
|
||||
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
model = model.OrderDesc("created_at")
|
||||
|
||||
total, err := model.Count()
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
var list []*entity.MaterialReport
|
||||
if req.Page != nil {
|
||||
err = model.Page(int(req.Page.PageNum), int(req.Page.PageSize)).Scan(&list)
|
||||
} else {
|
||||
err = model.Scan(&list)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return list, total, nil
|
||||
}
|
||||
124
dao/copydata/population_report_dao.go
Normal file
124
dao/copydata/population_report_dao.go
Normal file
@@ -0,0 +1,124 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var PopulationReport = new(populationReportDao)
|
||||
|
||||
type populationReportDao struct{}
|
||||
|
||||
// Insert 插入人群报表数据
|
||||
func (d *populationReportDao) Insert(ctx context.Context, req *dto.PopulationReportItem) (id int64, err error) {
|
||||
var entityData *entity.PopulationReport
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.PopulationReportTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入人群报表数据
|
||||
func (d *populationReportDao) BatchInsert(ctx context.Context, reqs []*dto.PopulationReportItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
// 分批处理,每批 100 条
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.PopulationReport, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.PopulationReport
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 执行批量插入
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.PopulationReportTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
// 批量插入失败,尝试逐条插入
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
|
||||
// List 查询人群报表数据列表
|
||||
func (d *populationReportDao) List(ctx context.Context, req *dto.ListPopulationReportReq) ([]*entity.PopulationReport, int, error) {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.PopulationReportTable).Model
|
||||
|
||||
// 构建查询条件
|
||||
if req.ReportDateStr != "" {
|
||||
model = model.Where("report_date_str", req.ReportDateStr)
|
||||
}
|
||||
if req.PhotoId != "" {
|
||||
model = model.Where("photo_id", req.PhotoId)
|
||||
}
|
||||
if req.Keyword != "" {
|
||||
model = model.Where("photo_name LIKE ?", "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
// 设置排序
|
||||
model = model.OrderDesc("created_at")
|
||||
|
||||
// 分页查询并获取总数
|
||||
total, err := model.Count()
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
var list []*entity.PopulationReport
|
||||
if req.Page != nil {
|
||||
err = model.Page(int(req.Page.PageNum), int(req.Page.PageSize)).Scan(&list)
|
||||
} else {
|
||||
err = model.Scan(&list)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return list, total, nil
|
||||
}
|
||||
86
dao/copydata/storewide_report_detail_dao.go
Normal file
86
dao/copydata/storewide_report_detail_dao.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var StorewideReportDetail = new(StorewideReportDetailDao)
|
||||
|
||||
type StorewideReportDetailDao struct{}
|
||||
|
||||
// Insert 插入广告效果指标表
|
||||
func (d *StorewideReportDetailDao) Insert(ctx context.Context, req *dto.StorewideReportDetailItem) (id int64, err error) {
|
||||
var entityData *entity.StorewideReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.StorewideReportDetailTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入广告效果指标表
|
||||
func (d *StorewideReportDetailDao) BatchInsert(ctx context.Context, reqs []*dto.StorewideReportDetailItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
// 分批处理,每批 100 条
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.StorewideReportDetail, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.StorewideReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 执行批量插入
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.StorewideReportDetailTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
// 批量插入失败,尝试逐条插入
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
86
dao/copydata/storewide_report_sum_dao.go
Normal file
86
dao/copydata/storewide_report_sum_dao.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var StorewideReportSum = new(StorewideReportSumDao)
|
||||
|
||||
type StorewideReportSumDao struct{}
|
||||
|
||||
// Insert 插入广告效果指标表
|
||||
func (d *StorewideReportSumDao) Insert(ctx context.Context, req *dto.StorewideReportSumItem) (id int64, err error) {
|
||||
var entityData *entity.StorewideReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.StorewideReportSumTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入广告效果指标表
|
||||
func (d *StorewideReportSumDao) BatchInsert(ctx context.Context, reqs []*dto.StorewideReportSumItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
// 分批处理,每批 100 条
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.StorewideReportSum, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.StorewideReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 执行批量插入
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.StorewideReportSumTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
// 批量插入失败,尝试逐条插入
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
124
dao/copydata/task_report_dao.go
Normal file
124
dao/copydata/task_report_dao.go
Normal file
@@ -0,0 +1,124 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var TaskReport = new(taskReportDao)
|
||||
|
||||
type taskReportDao struct{}
|
||||
|
||||
// Insert 插入调控任务数据
|
||||
func (d *taskReportDao) Insert(ctx context.Context, req *dto.TaskReportItem) (id int64, err error) {
|
||||
var entityData *entity.TaskReport
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.TaskReportTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入调控任务数据
|
||||
func (d *taskReportDao) BatchInsert(ctx context.Context, reqs []*dto.TaskReportItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
// 分批处理,每批 100 条
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.TaskReport, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.TaskReport
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 执行批量插入
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.TaskReportTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
// 批量插入失败,尝试逐条插入
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
|
||||
// List 查询调控任务数据列表
|
||||
func (d *taskReportDao) List(ctx context.Context, req *dto.ListTaskReportReq) ([]*entity.TaskReport, int, error) {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.TaskReportTable).Model
|
||||
|
||||
// 构建查询条件
|
||||
if req.ReportDateStr != "" {
|
||||
model = model.Where("report_date_str", req.ReportDateStr)
|
||||
}
|
||||
if req.PhotoId != "" {
|
||||
model = model.Where("photo_id", req.PhotoId)
|
||||
}
|
||||
if req.Keyword != "" {
|
||||
model = model.Where("photo_name LIKE ?", "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
// 设置排序
|
||||
model = model.OrderDesc("created_at")
|
||||
|
||||
// 分页查询并获取总数
|
||||
total, err := model.Count()
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
var list []*entity.TaskReport
|
||||
if req.Page != nil {
|
||||
err = model.Page(int(req.Page.PageNum), int(req.Page.PageSize)).Scan(&list)
|
||||
} else {
|
||||
err = model.Scan(&list)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return list, total, nil
|
||||
}
|
||||
83
dao/copydata/unit_report_detail_dao.go
Normal file
83
dao/copydata/unit_report_detail_dao.go
Normal file
@@ -0,0 +1,83 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var UnitReportDetail = new(UnitReportDetailDao)
|
||||
|
||||
type UnitReportDetailDao struct{}
|
||||
|
||||
// Insert 插入广告效果指标详情
|
||||
func (d *UnitReportDetailDao) Insert(ctx context.Context, req *dto.UnitReportDetailItem) (id int64, err error) {
|
||||
var entityData *entity.UnitReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.UnitReportDetailTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入广告效果指标详情
|
||||
func (d *UnitReportDetailDao) BatchInsert(ctx context.Context, reqs []*dto.UnitReportDetailItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.UnitReportDetail, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.UnitReportDetail
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.UnitReportDetailTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
83
dao/copydata/unit_report_sum_dao.go
Normal file
83
dao/copydata/unit_report_sum_dao.go
Normal file
@@ -0,0 +1,83 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var UnitReportSum = new(UnitReportSumDao)
|
||||
|
||||
type UnitReportSumDao struct{}
|
||||
|
||||
// Insert 插入广告效果指标
|
||||
func (d *UnitReportSumDao) Insert(ctx context.Context, req *dto.UnitReportSumItem) (id int64, err error) {
|
||||
var entityData *entity.UnitReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.UnitReportSumTable).Data(&entityData).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入广告效果指标
|
||||
func (d *UnitReportSumDao) BatchInsert(ctx context.Context, reqs []*dto.UnitReportSumItem) (successCount int64, failCount int64, failedIndexes []int64, err error) {
|
||||
if len(reqs) == 0 {
|
||||
return 0, 0, nil, errors.New("批量插入数据不能为空")
|
||||
}
|
||||
|
||||
batchSize := 100
|
||||
successCount = 0
|
||||
failCount = 0
|
||||
failedIndexes = make([]int64, 0)
|
||||
|
||||
for i := 0; i < len(reqs); i += batchSize {
|
||||
end := i + batchSize
|
||||
if end > len(reqs) {
|
||||
end = len(reqs)
|
||||
}
|
||||
|
||||
batch := reqs[i:end]
|
||||
entityList := make([]*entity.UnitReportSum, len(batch))
|
||||
|
||||
for j, req := range batch {
|
||||
var entityData entity.UnitReportSum
|
||||
if err = gconv.Struct(req, &entityData); err != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+j))
|
||||
continue
|
||||
}
|
||||
entityList[j] = &entityData
|
||||
}
|
||||
|
||||
if len(entityList) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
_, err = gfdb.DB(ctx).Model(ctx, consts.UnitReportSumTable).Data(entityList).Insert()
|
||||
if err != nil {
|
||||
for k := range batch {
|
||||
_, singleErr := d.Insert(ctx, batch[k])
|
||||
if singleErr != nil {
|
||||
failCount++
|
||||
failedIndexes = append(failedIndexes, int64(i+k))
|
||||
} else {
|
||||
successCount++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
successCount += int64(len(entityList))
|
||||
}
|
||||
}
|
||||
|
||||
return successCount, failCount, failedIndexes, nil
|
||||
}
|
||||
239
dao/dict/api_datasource_platform_dao.go
Normal file
239
dao/dict/api_datasource_platform_dao.go
Normal file
@@ -0,0 +1,239 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts1 "cid/consts/api-feature"
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var DatasourcePlatform = new(datasourcePlatformDao)
|
||||
|
||||
type datasourcePlatformDao struct{}
|
||||
|
||||
// Insert 插入数据源平台
|
||||
func (d *datasourcePlatformDao) Insert(ctx context.Context, req *dto.CreateDatasourcePlatformReq) (ID int64, err error) {
|
||||
var res *entity.DatasourcePlatform
|
||||
if err = gconv.Struct(req, &res); err != nil {
|
||||
return
|
||||
}
|
||||
// 设置创建时间
|
||||
// 设置创建时间和更新时间
|
||||
now := time.Now()
|
||||
res.CreatedAt = &now
|
||||
res.UpdatedAt = &now
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).Data(&res).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// Update 更新数据源平台
|
||||
func (d *datasourcePlatformDao) Update(ctx context.Context, req *dto.UpdateDatasourcePlatformReq) (rows int64, err error) {
|
||||
// 设置更新时间
|
||||
data := gconv.Map(req)
|
||||
data[entity.DatasourcePlatformCols.UpdatedAt] = time.Now()
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Data(data).
|
||||
OmitEmpty().
|
||||
Where(entity.DatasourcePlatformCols.ID, req.Id).
|
||||
Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// Delete 删除数据源平台
|
||||
func (d *datasourcePlatformDao) Delete(ctx context.Context, req *dto.DeleteDatasourcePlatformReq) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Where(entity.DatasourcePlatformCols.ID, req.Id).
|
||||
Delete()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// GetOne 获取单个数据源平台
|
||||
func (d *datasourcePlatformDao) GetOne(ctx context.Context, req *dto.GetDatasourcePlatformReq) (res *entity.DatasourcePlatform, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Where(entity.DatasourcePlatformCols.ID, req.Id).
|
||||
One()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Struct(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// GetByPlatformCode 根据平台编码获取数据源平台
|
||||
func (d *datasourcePlatformDao) GetByPlatformCode(ctx context.Context, platformCode string) (res *entity.DatasourcePlatform, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Where(entity.DatasourcePlatformCols.PlatformCode, platformCode).
|
||||
One()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Struct(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// Count 获取数据源平台数量
|
||||
func (d *datasourcePlatformDao) Count(ctx context.Context, req *dto.ListDatasourcePlatformReq) (count int, err error) {
|
||||
return d.buildListFilter(ctx, req).Count()
|
||||
}
|
||||
|
||||
// List 获取数据源平台列表
|
||||
func (d *datasourcePlatformDao) List(ctx context.Context, req *dto.ListDatasourcePlatformReq) (res []entity.DatasourcePlatform, total int, err error) {
|
||||
model := d.buildListFilter(ctx, req)
|
||||
model.OrderDesc(entity.DatasourcePlatformCols.CreatedAt)
|
||||
if req.Page != nil {
|
||||
model.Page(int(req.Page.PageNum), int(req.Page.PageSize))
|
||||
}
|
||||
r, total, err := model.AllAndCount(false)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// buildListFilter 构建列表查询的过滤条件
|
||||
func (d *datasourcePlatformDao) buildListFilter(ctx context.Context, req *dto.ListDatasourcePlatformReq) *gdb.Model {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).Model
|
||||
|
||||
// 关键字搜索(平台名称或编码)
|
||||
if !g.IsEmpty(req.Keyword) {
|
||||
model.WhereLike(entity.DatasourcePlatformCols.PlatformName, "%"+req.Keyword+"%")
|
||||
model.WhereOrLike(entity.DatasourcePlatformCols.PlatformCode, "%"+req.Keyword+"%")
|
||||
model.WhereOrLike(entity.DatasourcePlatformCols.Description, "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
// 精确匹配条件
|
||||
if !g.IsEmpty(req.PlatformCode) {
|
||||
model.Where(entity.DatasourcePlatformCols.PlatformCode, req.PlatformCode)
|
||||
}
|
||||
if !g.IsEmpty(req.PlatformName) {
|
||||
model.Where(entity.DatasourcePlatformCols.PlatformName, req.PlatformName)
|
||||
}
|
||||
if !g.IsEmpty(req.Status) {
|
||||
model.Where(entity.DatasourcePlatformCols.Status, req.Status)
|
||||
}
|
||||
if !g.IsEmpty(req.AuthType) {
|
||||
model.Where(entity.DatasourcePlatformCols.AuthType, req.AuthType)
|
||||
}
|
||||
|
||||
model.OmitEmptyWhere()
|
||||
return model
|
||||
}
|
||||
|
||||
// UpdateStatus 更新数据源平台状态
|
||||
func (d *datasourcePlatformDao) UpdateStatus(ctx context.Context, ID int64, status string, updatedBy string) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Data(map[string]interface{}{
|
||||
entity.DatasourcePlatformCols.Status: status,
|
||||
entity.DatasourcePlatformCols.UpdatedBy: updatedBy,
|
||||
entity.DatasourcePlatformCols.UpdatedAt: time.Now(),
|
||||
}).
|
||||
Where(entity.DatasourcePlatformCols.ID, ID).
|
||||
Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// ExistsByPlatformCode 检查平台编码是否存在
|
||||
func (d *datasourcePlatformDao) ExistsByPlatformCode(ctx context.Context, platformCode string, excludeId ...int64) (exists bool, err error) {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Where(entity.DatasourcePlatformCols.PlatformCode, platformCode)
|
||||
|
||||
if len(excludeId) > 0 && excludeId[0] > 0 {
|
||||
model.WhereNot(entity.DatasourcePlatformCols.ID, excludeId[0])
|
||||
}
|
||||
|
||||
count, err := model.Count()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return count > 0, nil
|
||||
}
|
||||
|
||||
// ListActivePlatforms 获取所有启用的平台
|
||||
func (d *datasourcePlatformDao) ListActivePlatforms(ctx context.Context) (res []entity.DatasourcePlatform, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Where(entity.DatasourcePlatformCols.Status, consts1.PlatformStatusActive).
|
||||
OrderAsc(entity.DatasourcePlatformCols.PlatformName).
|
||||
All()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// GetPlatformStatistics 获取平台统计信息
|
||||
func (d *datasourcePlatformDao) GetPlatformStatistics(ctx context.Context) (stats map[string]int64, err error) {
|
||||
stats = make(map[string]int64)
|
||||
|
||||
// 总平台数
|
||||
total, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).Count()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stats["totalPlatforms"] = int64(total)
|
||||
|
||||
// 启用平台数
|
||||
active, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Where(entity.DatasourcePlatformCols.Status, consts1.MappingStatusActive).
|
||||
Count()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stats["activePlatforms"] = int64(active)
|
||||
|
||||
// 停用平台数
|
||||
stats["inactivePlatforms"] = int64(total - active)
|
||||
|
||||
// 按认证类型统计
|
||||
authTypes := []string{"TOKEN", "API_KEY", "OAUTH2", "BASIC"}
|
||||
for _, authType := range authTypes {
|
||||
count, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Where(entity.DatasourcePlatformCols.AuthType, authType).
|
||||
Count()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stats[authType+"AuthPlatforms"] = int64(count)
|
||||
}
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// BatchUpdateStatus 批量更新平台状态
|
||||
func (d *datasourcePlatformDao) BatchUpdateStatus(ctx context.Context, ids []int64, status string, updatedBy string) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.DatasourcePlatformTable).
|
||||
Data(map[string]interface{}{
|
||||
entity.DatasourcePlatformCols.Status: status,
|
||||
entity.DatasourcePlatformCols.UpdatedBy: updatedBy,
|
||||
entity.DatasourcePlatformCols.UpdatedAt: strconv.FormatInt(time.Now().Unix(), 10),
|
||||
}).
|
||||
WhereIn(entity.DatasourcePlatformCols.ID, ids).
|
||||
Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
274
dao/dict/api_field_mapping_config_dao.go
Normal file
274
dao/dict/api_field_mapping_config_dao.go
Normal file
@@ -0,0 +1,274 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var FieldMappingConfig = new(fieldMappingConfigDao)
|
||||
|
||||
type fieldMappingConfigDao struct{}
|
||||
|
||||
// Insert 插入字段映射配置
|
||||
func (d *fieldMappingConfigDao) Insert(ctx context.Context, req *dto.CreateFieldMappingConfigReq) (id int64, err error) {
|
||||
var config entity.FieldMappingConfig
|
||||
if err = gconv.Struct(req, &config); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
config.CreatedTime = now
|
||||
config.UpdatedTime = now
|
||||
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).Data(&config).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// Update 更新字段映射配置
|
||||
func (d *fieldMappingConfigDao) Update(ctx context.Context, req *dto.UpdateFieldMappingConfigReq) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).Data(&req).OmitEmpty().Where(entity.FieldMappingConfigCol.Id, req.Id).Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// Delete 删除字段映射配置
|
||||
func (d *fieldMappingConfigDao) Delete(ctx context.Context, req *dto.DeleteFieldMappingConfigReq) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Where(entity.FieldMappingConfigCol.Id, req.Id).
|
||||
Delete()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// GetOne 获取单个字段映射配置
|
||||
func (d *fieldMappingConfigDao) GetOne(ctx context.Context, req *dto.GetFieldMappingConfigReq) (res *entity.FieldMappingConfig, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Where(entity.FieldMappingConfigCol.Id, req.Id).
|
||||
One()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Struct(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// Count 获取字段映射配置数量
|
||||
func (d *fieldMappingConfigDao) Count(ctx context.Context, req *dto.ListFieldMappingConfigReq) (count int, err error) {
|
||||
return d.buildListFilter(ctx, req).Count()
|
||||
}
|
||||
|
||||
// List 获取字段映射配置列表
|
||||
func (d *fieldMappingConfigDao) List(ctx context.Context, req *dto.ListFieldMappingConfigReq) (res []entity.FieldMappingConfig, total int, err error) {
|
||||
model := d.buildListFilter(ctx, req)
|
||||
model.OrderDesc(entity.FieldMappingConfigCol.CreatedTime)
|
||||
|
||||
if req.Page != nil {
|
||||
model.Page(int(req.Page.PageNum), int(req.Page.PageSize))
|
||||
}
|
||||
|
||||
r, total, err := model.AllAndCount(false)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// buildListFilter 构建列表查询的过滤条件
|
||||
func (d *fieldMappingConfigDao) buildListFilter(ctx context.Context, req *dto.ListFieldMappingConfigReq) *gdb.Model {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).Model
|
||||
|
||||
if !g.IsEmpty(req.Keyword) {
|
||||
model.WhereLike(entity.FieldMappingConfigCol.ConfigName, "%"+req.Keyword+"%").
|
||||
WhereOrLike(entity.FieldMappingConfigCol.SourceFieldDesc, "%"+req.Keyword+"%").
|
||||
WhereOrLike(entity.FieldMappingConfigCol.TargetFieldDesc, "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
if !g.IsEmpty(req.ConfigName) {
|
||||
model.Where(entity.FieldMappingConfigCol.ConfigName, req.ConfigName)
|
||||
}
|
||||
if !g.IsEmpty(req.VendorName) {
|
||||
model.Where(entity.FieldMappingConfigCol.VendorName, req.VendorName)
|
||||
}
|
||||
if !g.IsEmpty(req.ApiName) {
|
||||
model.Where(entity.FieldMappingConfigCol.ApiName, req.ApiName)
|
||||
}
|
||||
if !g.IsEmpty(req.ApiVersion) {
|
||||
model.Where(entity.FieldMappingConfigCol.ApiVersion, req.ApiVersion)
|
||||
}
|
||||
if !g.IsEmpty(req.SourceField) {
|
||||
model.Where(entity.FieldMappingConfigCol.SourceField, req.SourceField)
|
||||
}
|
||||
if !g.IsEmpty(req.TargetField) {
|
||||
model.Where(entity.FieldMappingConfigCol.TargetField, req.TargetField)
|
||||
}
|
||||
if !g.IsEmpty(req.TransformType) {
|
||||
model.Where(entity.FieldMappingConfigCol.TransformType, req.TransformType)
|
||||
}
|
||||
if !g.IsEmpty(req.BusinessDomain) {
|
||||
model.Where(entity.FieldMappingConfigCol.BusinessDomain, req.BusinessDomain)
|
||||
}
|
||||
if !g.IsEmpty(req.FieldGroup) {
|
||||
model.Where(entity.FieldMappingConfigCol.FieldGroup, req.FieldGroup)
|
||||
}
|
||||
if req.IsActive != nil {
|
||||
model.Where(entity.FieldMappingConfigCol.IsActive, *req.IsActive)
|
||||
}
|
||||
|
||||
model.OmitEmptyWhere()
|
||||
return model
|
||||
}
|
||||
|
||||
// UpdateStatus 更新配置状态
|
||||
func (d *fieldMappingConfigDao) UpdateStatus(ctx context.Context, id int64, isActive bool) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Data(g.Map{
|
||||
"is_active": isActive,
|
||||
"updated_time": time.Now(),
|
||||
}).
|
||||
Where(entity.FieldMappingConfigCol.Id, id).
|
||||
Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// GetByIds 根据ID列表获取配置列表
|
||||
func (d *fieldMappingConfigDao) GetByIds(ctx context.Context, ids []int64) (res []entity.FieldMappingConfig, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
WhereIn(entity.FieldMappingConfigCol.Id, ids).
|
||||
All()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// GetByVendorAndApi 根据厂商和接口获取字段映射配置
|
||||
func (d *fieldMappingConfigDao) GetByVendorAndApi(ctx context.Context, vendorName, apiName, apiVersion string, isActive *bool) (res []*entity.FieldMappingConfig, err error) {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Where(entity.FieldMappingConfigCol.VendorName, vendorName).
|
||||
Where(entity.FieldMappingConfigCol.ApiName, apiName)
|
||||
|
||||
if !g.IsEmpty(apiVersion) {
|
||||
model.Where(entity.FieldMappingConfigCol.ApiVersion, apiVersion)
|
||||
}
|
||||
|
||||
if isActive != nil {
|
||||
model.Where(entity.FieldMappingConfigCol.IsActive, *isActive)
|
||||
}
|
||||
|
||||
model.OrderDesc(entity.FieldMappingConfigCol.Priority).
|
||||
OrderAsc(entity.FieldMappingConfigCol.Id)
|
||||
|
||||
r, err := model.All()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// CheckDuplicate 检查重复配置
|
||||
func (d *fieldMappingConfigDao) CheckDuplicate(ctx context.Context, vendorName, apiName, sourceField, targetField string, excludeId int64) (exists bool, err error) {
|
||||
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin"})
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Where(entity.FieldMappingConfigCol.VendorName, vendorName).
|
||||
Where(entity.FieldMappingConfigCol.ApiName, apiName).
|
||||
Where(entity.FieldMappingConfigCol.SourceField, sourceField).
|
||||
Where(entity.FieldMappingConfigCol.TargetField, targetField)
|
||||
|
||||
if excludeId > 0 {
|
||||
model.WhereNot(entity.FieldMappingConfigCol.Id, excludeId)
|
||||
}
|
||||
|
||||
count, err := model.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
exists = count > 0
|
||||
return
|
||||
}
|
||||
|
||||
// GetActiveConfigsByBusinessDomain 根据业务域获取启用的配置
|
||||
func (d *fieldMappingConfigDao) GetActiveConfigsByBusinessDomain(ctx context.Context, businessDomain string) (res []entity.FieldMappingConfig, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Where(entity.FieldMappingConfigCol.BusinessDomain, businessDomain).
|
||||
Where(entity.FieldMappingConfigCol.IsActive, true).
|
||||
OrderDesc(entity.FieldMappingConfigCol.Priority).
|
||||
OrderAsc(entity.FieldMappingConfigCol.Id).
|
||||
All()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// GetFieldGroupsByVendorApi 获取指定厂商接口的字段分组
|
||||
func (d *fieldMappingConfigDao) GetFieldGroupsByVendorApi(ctx context.Context, vendorName, apiName string) (groups []string, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Fields(entity.FieldMappingConfigCol.FieldGroup).
|
||||
Where(entity.FieldMappingConfigCol.VendorName, vendorName).
|
||||
Where(entity.FieldMappingConfigCol.ApiName, apiName).
|
||||
Where(entity.FieldMappingConfigCol.IsActive, true).
|
||||
Group(entity.FieldMappingConfigCol.FieldGroup).
|
||||
All()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, record := range r {
|
||||
group := record.Map()[entity.FieldMappingConfigCol.FieldGroup]
|
||||
if groupStr, ok := group.(string); ok && groupStr != "" {
|
||||
groups = append(groups, groupStr)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteExpiredConfigs 删除已过期的配置
|
||||
func (d *fieldMappingConfigDao) DeleteExpiredConfigs(ctx context.Context) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Where("expiry_date IS NOT NULL AND expiry_date < ?", time.Now()).
|
||||
Delete()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// GetConfigsEffectiveNow 获取当前生效的配置
|
||||
func (d *fieldMappingConfigDao) GetConfigsEffectiveNow(ctx context.Context) (res []entity.FieldMappingConfig, err error) {
|
||||
now := time.Now()
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.FieldMappingConfigTable).
|
||||
Where(entity.FieldMappingConfigCol.IsActive, true).
|
||||
Where("(effective_date IS NULL OR effective_date <= ?)", now).
|
||||
Where("(expiry_date IS NULL OR expiry_date > ?)", now).
|
||||
OrderDesc(entity.FieldMappingConfigCol.Priority).
|
||||
OrderAsc(entity.FieldMappingConfigCol.Id).
|
||||
All()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
118
dao/dict/api_interface_dao.go
Normal file
118
dao/dict/api_interface_dao.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var ApiInterface = new(apiInterfaceDao)
|
||||
|
||||
type apiInterfaceDao struct{}
|
||||
|
||||
// Insert 插入接口
|
||||
func (d *apiInterfaceDao) Insert(ctx context.Context, req *dto.CreateApiInterfaceReq) (id int64, err error) {
|
||||
var res *entity.ApiInterface
|
||||
if err = gconv.Struct(req, &res); err != nil {
|
||||
return
|
||||
}
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.ApiInterfaceTable).Data(&res).Insert()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
||||
// Update 更新接口
|
||||
func (d *apiInterfaceDao) Update(ctx context.Context, req *dto.UpdateApiInterfaceReq) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.ApiInterfaceTable).Data(&req).OmitEmpty().Where(entity.ApiInterfaceCols.Id, req.Id).Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// Delete 删除接口
|
||||
func (d *apiInterfaceDao) Delete(ctx context.Context, req *dto.DeleteApiInterfaceReq) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.ApiInterfaceTable).Where(entity.ApiInterfaceCols.Id, req.Id).Delete()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// GetOne 获取单个接口
|
||||
func (d *apiInterfaceDao) GetOne(ctx context.Context, req *dto.GetApiInterfaceReq) (res *entity.ApiInterface, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.ApiInterfaceTable).Where(entity.ApiInterfaceCols.Id, req.Id).One()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Struct(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// Count 获取接口数量
|
||||
func (d *apiInterfaceDao) Count(ctx context.Context, req *dto.ListApiInterfaceReq) (count int, err error) {
|
||||
return d.buildListFilter(ctx, req).Count()
|
||||
}
|
||||
|
||||
// List 获取接口列表
|
||||
func (d *apiInterfaceDao) List(ctx context.Context, req *dto.ListApiInterfaceReq) (res []entity.ApiInterface, total int, err error) {
|
||||
model := d.buildListFilter(ctx, req)
|
||||
model.OrderDesc(entity.ApiInterfaceCols.CreatedAt)
|
||||
if req.Page != nil {
|
||||
model.Page(int(req.Page.PageNum), int(req.Page.PageSize))
|
||||
}
|
||||
r, total, err := model.AllAndCount(false)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
|
||||
// buildListFilter 构建列表查询的过滤条件
|
||||
func (d *apiInterfaceDao) buildListFilter(ctx context.Context, req *dto.ListApiInterfaceReq) *gdb.Model {
|
||||
model := gfdb.DB(ctx).Model(ctx, consts.ApiInterfaceTable).Model
|
||||
if !g.IsEmpty(req.Keyword) {
|
||||
model.WhereLike(entity.ApiInterfaceCols.Name, "%"+req.Keyword+"%")
|
||||
model.WhereOrLike(entity.ApiInterfaceCols.Code, "%"+req.Keyword+"%")
|
||||
}
|
||||
model.Where(entity.ApiInterfaceCols.PlatformId, req.PlatformId)
|
||||
model.Where(entity.ApiInterfaceCols.Name, req.Name)
|
||||
model.Where(entity.ApiInterfaceCols.Code, req.Code)
|
||||
model.Where(entity.ApiInterfaceCols.Method, req.Method)
|
||||
model.Where(entity.ApiInterfaceCols.Status, req.Status)
|
||||
model.OmitEmptyWhere()
|
||||
return model
|
||||
}
|
||||
|
||||
// UpdateStatus 更新接口状态
|
||||
func (d *apiInterfaceDao) UpdateStatus(ctx context.Context, id int64, status string) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.ApiInterfaceTable).
|
||||
Data(map[string]interface{}{"status": status}).
|
||||
Where(entity.ApiInterfaceCols.Id, id).
|
||||
Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return r.RowsAffected()
|
||||
}
|
||||
|
||||
// GetByIds 根据ID列表获取接口列表
|
||||
func (d *apiInterfaceDao) GetByIds(ctx context.Context, ids []int64) (res []entity.ApiInterface, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, consts.ApiInterfaceTable).
|
||||
WhereIn(entity.ApiInterfaceCols.Id, ids).
|
||||
All()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = r.Structs(&res)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user