fix(tenant): 收紧双站运营提号与录单边界
This commit is contained in:
@@ -535,9 +535,6 @@ func (r *Repository) tradingDailyOverview(ctx context.Context, now time.Time, da
|
||||
// 录单表是后来新增的功能表,若迁移尚未执行(表不存在)则降级为空统计,
|
||||
// 避免连带整个仪表盘不可用。
|
||||
func (r *Repository) manualEntryToday(ctx context.Context, now time.Time) ([]ManualEntryAgentStatsDTO, error) {
|
||||
if tenancy.IDFromContext(ctx) > 0 {
|
||||
return []ManualEntryAgentStatsDTO{}, nil
|
||||
}
|
||||
if r.db == nil || !r.db.Migrator().HasTable("cs_manual_entries") {
|
||||
return []ManualEntryAgentStatsDTO{}, nil
|
||||
}
|
||||
@@ -551,7 +548,11 @@ func (r *Repository) manualEntryToday(ctx context.Context, now time.Time) ([]Man
|
||||
Count int64
|
||||
}
|
||||
rows := make([]row, 0)
|
||||
if err := r.db.WithContext(ctx).Table("cs_manual_entries").
|
||||
query := r.db.WithContext(ctx).Table("cs_manual_entries")
|
||||
if tenantID := tenancy.IDFromContext(ctx); tenantID > 0 {
|
||||
query = query.Where("tenant_id = ?", tenantID)
|
||||
}
|
||||
if err := query.
|
||||
Select("admin_id, MAX(admin_name) AS admin_name, COUNT(*) AS count").
|
||||
Where("created_at >= ? AND created_at < ?", start, end).
|
||||
Group("admin_id").
|
||||
|
||||
Reference in New Issue
Block a user