优化mongo,封装count逻辑,处理objectId

This commit is contained in:
2026-01-08 11:07:58 +08:00
parent 65c80ae56f
commit e85c8453de
34 changed files with 753 additions and 446 deletions

View File

@@ -5,7 +5,6 @@ import (
"cid/model/dto"
"cid/model/entity"
"context"
"time"
"github.com/gogf/gf/v2/util/gconv"
)
@@ -21,15 +20,10 @@ func (s *advertisement) Add(ctx context.Context, req *dto.AddAdvertisementReq) (
return
}
// 设置基础字段
now := time.Now()
advertisement.CreatedAt = now
advertisement.UpdatedAt = now
advertisement.IsDeleted = false
// 设置初始状态
advertisement.Status = "待审核"
// 注意CreatedAt、UpdatedAt、TenantId、IsDeleted等字段由common/mongo的Insert方法自动设置
if err = dao.Advertisement.Insert(ctx, advertisement); err != nil {
return
}