service

package
v0.0.0-...-f43e618 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RealmDropReports      = "drop_reports"
	RealmDropReportExtras = "drop_report_extras"

	ArchiveS3Prefix = "v1/"
)
View Source
const (
	UpyunAuthorizationHeaderRealm = "UPYUN"
)

Variables

View Source
var (
	ErrDatabaseNotReachable = errors.New("database not reachable")
	ErrRedisNotReachable    = errors.New("redis not reachable")
	ErrNATSNotReachable     = errors.New("nats not reachable")
)
View Source
var (
	ErrReportNotFound = pgerr.ErrInvalidReq.Msg("report not existed or has already been recalled")
	ErrAccountMissing = pgerr.ErrInvalidReq.Msg("account missing")
	ErrNatsTimeout    = errors.New("timeout waiting for NATS response")
)
View Source
var (
	ErrSnapshotNotFound            = errors.New("snapshot not found")
	ErrSnapshotNonNullable         = errors.New("snapshot content cannot be empty")
	ErrSnapshotFromVersionNotFound = pgerr.ErrInvalidReq.Msg("snapshot matching `from` version not found")
	ErrSnapshotToVersionNotFound   = pgerr.ErrInvalidReq.Msg("snapshot matching `to` version not found")
)

Functions

func Module

func Module() fx.Option

Types

type Account

type Account struct {
	AccountRepo *repo.Account
}

func NewAccount

func NewAccount(accountRepo *repo.Account) *Account

func (*Account) CreateAccountWithRandomPenguinId

func (s *Account) CreateAccountWithRandomPenguinId(ctx context.Context) (*model.Account, error)

func (*Account) GetAccountById

func (s *Account) GetAccountById(ctx context.Context, accountId string) (*model.Account, error)

Cache: account#accountId:{accountId}, 1 hr

func (*Account) GetAccountByPenguinId

func (s *Account) GetAccountByPenguinId(ctx context.Context, penguinId string) (*model.Account, error)

Cache: account#penguinId:{penguinId}, 1 hr

func (*Account) GetAccountFromRequest

func (s *Account) GetAccountFromRequest(ctx *fiber.Ctx) (*model.Account, error)

func (*Account) IsAccountExistWithId

func (s *Account) IsAccountExistWithId(ctx context.Context, accountId int) bool

type Activity

type Activity struct {
	ActivityRepo *repo.Activity
}

func NewActivity

func NewActivity(activityRepo *repo.Activity) *Activity

func (*Activity) GetActivities

func (s *Activity) GetActivities(ctx context.Context) ([]*model.Activity, error)

Cache: (singular) activities, 1 hr; records last modified time

func (*Activity) GetActivityById

func (s *Activity) GetActivityById(ctx context.Context, activityId int) (*model.Activity, error)

func (*Activity) GetShimActivities

func (s *Activity) GetShimActivities(ctx context.Context) ([]*modelv2.Activity, error)

Cache: (singular) shimActivities, 1 hr; records last modified time

type Admin

type Admin struct {
	DB                *bun.DB
	AdminRepo         *repo.Admin
	DropReportService *DropReport
	RejectRuleRepo    *repo.RejectRule
	ZoneService       *Zone
	StageService      *Stage
	ActivityService   *Activity
	TimeRangeService  *TimeRange
	DropInfoService   *DropInfo
}

func NewAdmin

func NewAdmin(
	db *bun.DB,
	adminRepo *repo.Admin,
	dropReportService *DropReport,
	rejectRuleRepo *repo.RejectRule,
	zoneService *Zone,
	stageService *Stage,
	activityService *Activity,
	timeRangeService *TimeRange,
	dropInfoService *DropInfo,
) *Admin

func (*Admin) CloneFromCN

func (s *Admin) CloneFromCN(ctx context.Context, req types.CloneFromCNRequest) error

func (*Admin) EvaluateRejectRules

func (s *Admin) EvaluateRejectRules(ctx context.Context, evaluationContexts []RejectRulesReevaluationEvaluationContext, ruleId int) (RejectRulesReevaluationEvaluationResultSet, error)

func (*Admin) SaveRenderedObjects

func (s *Admin) SaveRenderedObjects(ctx context.Context, objects *gamedata.RenderedObjects) error

type Analytics

type Analytics struct {
	DropReportService *DropReport
}

func NewAnalytics

func NewAnalytics(dropReportService *DropReport) *Analytics

func (*Analytics) GetRecentUniqueUserCountBySource

func (s *Analytics) GetRecentUniqueUserCountBySource(ctx context.Context, recent string) (map[string]int, error)

type Archive

type Archive struct {
	DropReportService      *DropReport
	DropReportExtraService *DropReportExtra
	Config                 *appconfig.Config
	// contains filtered or unexported fields
}

func NewArchive

func NewArchive(dropReportService *DropReport, dropReportExtraService *DropReportExtra, conf *appconfig.Config, lock *redsync.Redsync, db *bun.DB) (*Archive, error)

func (*Archive) ArchiveByDate

func (s *Archive) ArchiveByDate(ctx context.Context, date time.Time, deleteAfterArchive bool) error

func (*Archive) ArchiveByGlobalConfig

func (s *Archive) ArchiveByGlobalConfig(ctx context.Context) error

func (*Archive) DeleteReportsAndExtras

func (s *Archive) DeleteReportsAndExtras(ctx context.Context, date time.Time, idInclusiveStart int, idInclusiveEnd int) error

type DropInfo

type DropInfo struct {
	DropInfoRepo     *repo.DropInfo
	TimeRangeService *TimeRange
}

func NewDropInfo

func NewDropInfo(dropInfoRepo *repo.DropInfo, timeRangeService *TimeRange) *DropInfo

func (*DropInfo) CloneDropInfosFromCN

func (s *DropInfo) CloneDropInfosFromCN(ctx context.Context, originRangeId int, destRangeId int, server string) error

func (*DropInfo) GetAppearStageIdsByServer

func (s *DropInfo) GetAppearStageIdsByServer(ctx context.Context, server string) ([]int, error)

func (*DropInfo) GetCurrentDropInfosByServer

func (s *DropInfo) GetCurrentDropInfosByServer(ctx context.Context, server string) ([]*model.DropInfo, error)

func (*DropInfo) GetDropInfosByServer

func (s *DropInfo) GetDropInfosByServer(ctx context.Context, server string) ([]*model.DropInfo, error)

func (*DropInfo) GetDropInfosWithFilters

func (s *DropInfo) GetDropInfosWithFilters(ctx context.Context, server string, timeRanges []*model.TimeRange, stageIdFilter []int, itemIdFilter []int) ([]*model.DropInfo, error)

func (*DropInfo) GetItemDropSetByStageIdAndRangeId

func (s *DropInfo) GetItemDropSetByStageIdAndRangeId(ctx context.Context, server string, stageId int, rangeId int) ([]int, error)

Cache: itemDropSet#server|stageId|rangeId:{server}|{stageId}|{rangeId}, 24 hrs

func (*DropInfo) GetItemDropSetByStageIdAndTimeRange

func (s *DropInfo) GetItemDropSetByStageIdAndTimeRange(ctx context.Context, server string, stageId int, startTime *time.Time, endTime *time.Time) ([]int, error)

Cache: itemDropSet#server|stageId|startTime|endTime:{server}|{stageId}|{startTime}|{endTime}, 24 hrs

type DropMatrix

type DropMatrix struct {
	Config                   *appconfig.Config
	TimeRangeService         *TimeRange
	DropReportService        *DropReport
	DropInfoService          *DropInfo
	DropMatrixElementService *DropMatrixElement
	StageService             *Stage
	ItemService              *Item
}

func NewDropMatrix

func NewDropMatrix(
	config *appconfig.Config,
	timeRangeService *TimeRange,
	dropReportService *DropReport,
	dropInfoService *DropInfo,
	dropMatrixElementService *DropMatrixElement,
	stageService *Stage,
	itemService *Item,
) *DropMatrix

func (*DropMatrix) GetShimCustomizedDropMatrixResults

func (s *DropMatrix) GetShimCustomizedDropMatrixResults(
	ctx context.Context, server string, timeRange *model.TimeRange, stageIds []int, itemIds []int, accountId null.Int, sourceCategory string,
) (*modelv2.DropMatrixQueryResult, error)

func (*DropMatrix) GetShimDropMatrix

func (s *DropMatrix) GetShimDropMatrix(
	ctx context.Context, server string, showClosedZones bool, stageFilterStr string, itemFilterStr string, accountId null.Int, sourceCategory string,
) (*modelv2.DropMatrixQueryResult, error)

Cache: shimGlobalDropMatrix#server|showClosedZones|sourceCategory:{server}|{showClosedZones}|{sourceCategory}, 24 hrs, records last modified time Called by frontend, used for both global and personal, only for max accumulable results

func (*DropMatrix) RunCalcDropMatrixJob

func (s *DropMatrix) RunCalcDropMatrixJob(ctx context.Context, server string) error

Calc today's drop matrix elements and save to DB Called by worker

func (*DropMatrix) UpdateDropMatrixByGivenDate

func (s *DropMatrix) UpdateDropMatrixByGivenDate(ctx context.Context, server string, date *time.Time) error

Update drop matrix elements for a given date (entire day) Called by admin api

type DropMatrixElement

type DropMatrixElement struct {
	DropMatrixElementRepo *repo.DropMatrixElement
}

func NewDropMatrixElement

func NewDropMatrixElement(dropMatrixElementRepo *repo.DropMatrixElement) *DropMatrixElement

func (*DropMatrixElement) BatchSaveElements

func (s *DropMatrixElement) BatchSaveElements(ctx context.Context, elements []*model.DropMatrixElement, server string) error

func (*DropMatrixElement) CalcTotalItemQuantityForShimSiteStats

func (s *DropMatrixElement) CalcTotalItemQuantityForShimSiteStats(ctx context.Context, server string) ([]*modelv2.TotalItemQuantity, error)

func (*DropMatrixElement) CalcTotalSanityCostForShimSiteStats

func (s *DropMatrixElement) CalcTotalSanityCostForShimSiteStats(ctx context.Context, server string) (sanity int, err error)

func (*DropMatrixElement) CalcTotalStageQuantityForShimSiteStats

func (s *DropMatrixElement) CalcTotalStageQuantityForShimSiteStats(ctx context.Context, server string) ([]*modelv2.TotalStageTime, error)

func (*DropMatrixElement) DeleteByServerAndDayNum

func (s *DropMatrixElement) DeleteByServerAndDayNum(ctx context.Context, server string, dayNum int) error

func (*DropMatrixElement) GetAllQuantitiesForGlobalDropMatrixMapByStageIdAndItemId

func (s *DropMatrixElement) GetAllQuantitiesForGlobalDropMatrixMapByStageIdAndItemId(
	ctx context.Context, server string, timeRange *model.TimeRange, stageIds []int, sourceCategory string,
) (map[int]map[int]*model.AllQuantitiesResultForGlobalDropMatrix, error)

func (*DropMatrixElement) GetAllQuantityBucketsForGlobalDropMatrixMapByStageIdAndItemId

func (s *DropMatrixElement) GetAllQuantityBucketsForGlobalDropMatrixMapByStageIdAndItemId(
	ctx context.Context, server string, timeRange *model.TimeRange, stageIds []int, sourceCategory string,
) (map[int]map[int]*model.AllQuantityBucketsResultForGlobalDropMatrix, error)

func (*DropMatrixElement) GetAllTimesForGlobalDropMatrixMapByStageIdAndItemId

func (s *DropMatrixElement) GetAllTimesForGlobalDropMatrixMapByStageIdAndItemId(
	ctx context.Context, server string, timeRange *model.TimeRange, stageIds []int, sourceCategory string,
) (map[int]map[int]*model.AllTimesResultForGlobalDropMatrix, error)

func (*DropMatrixElement) GetElementsByServerAndSourceCategoryAndDayNumRange

func (s *DropMatrixElement) GetElementsByServerAndSourceCategoryAndDayNumRange(
	ctx context.Context, server string, sourceCategory string, startDayNum int, endDayNum int,
) ([]*model.DropMatrixElement, error)

func (*DropMatrixElement) IsExistByServerAndDayNum

func (s *DropMatrixElement) IsExistByServerAndDayNum(ctx context.Context, server string, dayNum int) (bool, error)

type DropPatternElement

type DropPatternElement struct {
	DropPatternElementRepo *repo.DropPatternElement
}

func NewDropPatternElement

func NewDropPatternElement(dropPatternElementRepo *repo.DropPatternElement) *DropPatternElement

func (*DropPatternElement) GetDropPatternElementsByPatternId

func (s *DropPatternElement) GetDropPatternElementsByPatternId(ctx context.Context, patternId int) ([]*model.DropPatternElement, error)

Cache: dropPatternElements#patternId:{patternId}, 24hrs

func (*DropPatternElement) GetDropPatternElementsMapByPatternIds

func (s *DropPatternElement) GetDropPatternElementsMapByPatternIds(ctx context.Context, patternIds []int) (map[int][]*model.DropPatternElement, error)

type DropReport

type DropReport struct {
	DropReportRepo *repo.DropReport
}

func NewDropReport

func NewDropReport(dropReportRepo *repo.DropReport) *DropReport

func (*DropReport) CalcQuantityUniqCount

func (s *DropReport) CalcQuantityUniqCount(
	ctx context.Context, queryCtx *model.DropReportQueryContext,
) ([]*model.QuantityUniqCountResultForDropMatrix, error)

func (*DropReport) CalcRecentUniqueUserCountBySource

func (s *DropReport) CalcRecentUniqueUserCountBySource(ctx context.Context, duration time.Duration) ([]*modelv2.UniqueUserCountBySource, error)

func (*DropReport) CalcTotalQuantityForPatternMatrix

func (s *DropReport) CalcTotalQuantityForPatternMatrix(
	ctx context.Context, queryCtx *model.DropReportQueryContext,
) ([]*model.TotalQuantityResultForPatternMatrix, error)

func (*DropReport) CalcTotalQuantityForTrend

func (s *DropReport) CalcTotalQuantityForTrend(
	ctx context.Context, server string, startTime *time.Time, intervalLength time.Duration, intervalNum int, stageIdItemIdMap map[int][]int, accountId null.Int, sourceCategory string,
) ([]*model.TotalQuantityResultForTrend, error)

func (*DropReport) CalcTotalStageQuantityForShimSiteStats

func (s *DropReport) CalcTotalStageQuantityForShimSiteStats(ctx context.Context, server string, isRecent24h bool) ([]*modelv2.TotalStageTime, error)

func (*DropReport) CalcTotalTimesForDropMatrix

func (s *DropReport) CalcTotalTimesForDropMatrix(
	ctx context.Context, queryCtx *model.DropReportQueryContext,
) ([]*model.TotalTimesResult, error)

func (*DropReport) CalcTotalTimesForPatternMatrix

func (s *DropReport) CalcTotalTimesForPatternMatrix(
	ctx context.Context, queryCtx *model.DropReportQueryContext,
) ([]*model.TotalTimesResult, error)

func (*DropReport) CalcTotalTimesForTrend

func (s *DropReport) CalcTotalTimesForTrend(
	ctx context.Context, server string, startTime *time.Time, intervalLength time.Duration, intervalNum int, stageIds []int, accountId null.Int, sourceCategory string,
) ([]*model.TotalTimesResultForTrend, error)

func (*DropReport) DeleteDropReportsForArchive

func (s *DropReport) DeleteDropReportsForArchive(ctx context.Context, tx bun.Tx, date time.Time) (int64, error)

func (*DropReport) GetDropReports

func (s *DropReport) GetDropReports(
	ctx context.Context, queryCtx *model.DropReportQueryContext,
) ([]*model.DropReport, error)

func (*DropReport) GetDropReportsForArchive

func (s *DropReport) GetDropReportsForArchive(ctx context.Context, cursor *model.Cursor, date time.Time, limit int) ([]*model.DropReport, model.Cursor, error)

type DropReportExtra

type DropReportExtra struct {
	DropReportExtraRepo *repo.DropReportExtra
}

func NewDropReportExtra

func NewDropReportExtra(dropReportExtraRepo *repo.DropReportExtra) *DropReportExtra

func (*DropReportExtra) DeleteDropReportExtrasForArchive

func (c *DropReportExtra) DeleteDropReportExtrasForArchive(ctx context.Context, tx bun.Tx, idInclusiveStart int, idInclusiveEnd int) (int64, error)

func (*DropReportExtra) GetDropReportExtraForArchive

func (s *DropReportExtra) GetDropReportExtraForArchive(ctx context.Context, cursor *model.Cursor, idInclusiveStart int, idInclusiveEnd int, limit int) ([]*model.DropReportExtra, model.Cursor, error)

type Export

type Export struct {
	DropReportService         *DropReport
	DropPatternElementService *DropPatternElement
	ItemService               *Item
}

func NewExport

func NewExport(
	dropReportService *DropReport,
	dropPatternElementService *DropPatternElement,
	itemService *Item,
) *Export

func (*Export) ExportDropReportsAndPatterns

func (s *Export) ExportDropReportsAndPatterns(
	ctx context.Context, server string, startTime *time.Time, endTime *time.Time, times null.Int, stageId int, itemIds []int, accountId null.Int, sourceCategory string,
) (*model.ExportDropReportsAndPatternsResult, error)

type Formula

type Formula struct {
	PropertyRepo *repo.Property
}

func NewFormula

func NewFormula(propertyRepo *repo.Property) *Formula

func (*Formula) GetFormula

func (s *Formula) GetFormula(ctx context.Context) (json.RawMessage, error)

Cache: (singular) formula, 1 hr

type FrontendConfig

type FrontendConfig struct {
	PropertyRepo *repo.Property
}

func NewFrontendConfig

func NewFrontendConfig(propertyRepo *repo.Property) *FrontendConfig

func (*FrontendConfig) GetFrontendConfig

func (s *FrontendConfig) GetFrontendConfig(ctx context.Context) (json.RawMessage, error)

Cache: (singular) frontend_config, 1 hr

type GeoIP

type GeoIP struct {
	// contains filtered or unexported fields
}

func NewGeoIP

func NewGeoIP(db *geoip2.Reader) *GeoIP

func (*GeoIP) Country

func (s *GeoIP) Country(ip string) (*geoip2.Country, error)

func (*GeoIP) InChinaMainland

func (s *GeoIP) InChinaMainland(ip string) bool

type Health

type Health struct {
	DB    *bun.DB
	Redis *redis.Client
	NATS  *nats.Conn
}

func NewHealth

func NewHealth(db *bun.DB, redis *redis.Client, nats *nats.Conn) *Health

func (*Health) Ping

func (s *Health) Ping(ctx context.Context) error

type Init

type Init struct {
	ItemService  *Item
	StageService *Stage
	ZoneService  *Zone
}

func NewInit

func NewInit(itemService *Item, stageService *Stage, zoneService *Zone) *Init

func (*Init) GetInit

func (i *Init) GetInit(ctx context.Context) (*modelv3.Init, error)

type Item

type Item struct {
	ItemRepo *repo.Item
}

func NewItem

func NewItem(itemRepo *repo.Item) *Item

func (*Item) GetItemByArkId

func (s *Item) GetItemByArkId(ctx context.Context, arkItemId string) (*model.Item, error)

Cache: item#arkItemId:{arkItemId}, 1 hr

func (*Item) GetItemById

func (s *Item) GetItemById(ctx context.Context, itemId int) (*model.Item, error)

func (*Item) GetItems

func (s *Item) GetItems(ctx context.Context) ([]*model.Item, error)

Cache: items, 1 hr

func (*Item) GetItemsMapByArkId

func (s *Item) GetItemsMapByArkId(ctx context.Context) (map[string]*model.Item, error)

Cache: (singular) itemsMapByArkId, 1 hr

func (*Item) GetItemsMapById

func (s *Item) GetItemsMapById(ctx context.Context) (map[int]*model.Item, error)

Cache: (singular) itemsMapById, 1 hr

func (*Item) GetRecruitTagItemsByBilingualName

func (s *Item) GetRecruitTagItemsByBilingualName(ctx context.Context) (map[string]string, error)

Cache: (singular) recruitTagMap, 1 hr

func (*Item) GetShimItemByArkId

func (s *Item) GetShimItemByArkId(ctx context.Context, arkItemId string) (*modelv2.Item, error)

Cache: shimItem#arkItemId:{arkItemId}, 1 hr

func (*Item) GetShimItems

func (s *Item) GetShimItems(ctx context.Context) ([]*modelv2.Item, error)

Cache: (singular) shimItems, 1 hr; records last modified time

func (*Item) SearchItemByName

func (s *Item) SearchItemByName(ctx context.Context, name string) (*model.Item, error)

type Notice

type Notice struct {
	NoticeRepo *repo.Notice
}

func NewNotice

func NewNotice(noticeRepo *repo.Notice) *Notice

func (*Notice) GetNotices

func (s *Notice) GetNotices(ctx context.Context) ([]*model.Notice, error)

Cache: (singular) notices, 10 seconds; records last modified time

type PatternMatrix

type PatternMatrix struct {
	Config                      *appconfig.Config
	TimeRangeService            *TimeRange
	DropReportService           *DropReport
	DropInfoService             *DropInfo
	PatternMatrixElementService *PatternMatrixElement
	DropPatternElementService   *DropPatternElement
	StageService                *Stage
	ItemService                 *Item
}

func NewPatternMatrix

func NewPatternMatrix(
	config *appconfig.Config,
	timeRangeService *TimeRange,
	dropReportService *DropReport,
	dropInfoService *DropInfo,
	patternMatrixElementService *PatternMatrixElement,
	dropPatternElementService *DropPatternElement,
	stageService *Stage,
	itemService *Item,
) *PatternMatrix

func (*PatternMatrix) GetShimPatternMatrix

func (s *PatternMatrix) GetShimPatternMatrix(ctx context.Context, server string, accountId null.Int, sourceCategory string, showAllPatterns bool,
) (*modelv2.PatternMatrixQueryResult, error)

Cache: shimGlobalPatternMatrix#server|sourceCategory|showAllPatterns:{server}|{sourceCategory}|{showAllPatterns}, 24hrs, records last modified time Called by frontend, used for both global and personal, only for latest timeranges

func (*PatternMatrix) RunCalcPatternMatrixJob

func (s *PatternMatrix) RunCalcPatternMatrixJob(ctx context.Context, server string) error

Calc today's pattern matrix elements and save to DB Called by worker

func (*PatternMatrix) UpdatePatternMatrixByGivenDate

func (s *PatternMatrix) UpdatePatternMatrixByGivenDate(ctx context.Context, server string, date *time.Time) error

Update pattern matrix elements for a given date (entire day) Called by admin api

type PatternMatrixElement

type PatternMatrixElement struct {
	PatternMatrixElementRepo *repo.PatternMatrixElement
}

func NewPatternMatrixElement

func NewPatternMatrixElement(patternMatrixElementRepo *repo.PatternMatrixElement) *PatternMatrixElement

func (*PatternMatrixElement) BatchSaveElements

func (s *PatternMatrixElement) BatchSaveElements(ctx context.Context, elements []*model.PatternMatrixElement, server string) error

func (*PatternMatrixElement) DeleteByServerAndDayNum

func (s *PatternMatrixElement) DeleteByServerAndDayNum(ctx context.Context, server string, dayNum int) error

func (*PatternMatrixElement) GetAllQuantitiesForGlobalPatternMatrixMapByStageIdAndPatternId

func (s *PatternMatrixElement) GetAllQuantitiesForGlobalPatternMatrixMapByStageIdAndPatternId(
	ctx context.Context, server string, timeRange *model.TimeRange, stageIds []int, sourceCategory string,
) (map[int]map[int]*model.AllQuantitiesResultForGlobalPatternMatrix, error)

func (*PatternMatrixElement) GetAllTimesForGlobalPatternMatrixMapByStageId

func (s *PatternMatrixElement) GetAllTimesForGlobalPatternMatrixMapByStageId(
	ctx context.Context, server string, timeRange *model.TimeRange, stageIds []int, sourceCategory string,
) (map[int]*model.AllTimesResultForGlobalPatternMatrix, error)

func (*PatternMatrixElement) IsExistByServerAndDayNum

func (s *PatternMatrixElement) IsExistByServerAndDayNum(ctx context.Context, server string, dayNum int) (bool, error)

type RejectRulesReevaluationEvaluationContext

type RejectRulesReevaluationEvaluationContext struct {
	OriginalReport  *model.DropReport           `json:"originalReport"`
	EvaluateContext *reportverifs.ReportContext `json:"evaluateContext"`
}

type RejectRulesReevaluationEvaluationResult

type RejectRulesReevaluationEvaluationResult struct {
	RejectRulesReevaluationEvaluationContext

	EvaluationShouldRejectToReliability *int `json:"evaluationShouldRejectToReliability"`
}

type RejectRulesReevaluationEvaluationResultSet

type RejectRulesReevaluationEvaluationResultSet []*RejectRulesReevaluationEvaluationResult

func (RejectRulesReevaluationEvaluationResultSet) ChangeSet

func (RejectRulesReevaluationEvaluationResultSet) Summary

type RejectRulesReevaluationEvaluationResultSetChangeSet

type RejectRulesReevaluationEvaluationResultSetChangeSet []*RejectRulesReevaluationEvaluationResultSetDiff

type RejectRulesReevaluationEvaluationResultSetDiff

type RejectRulesReevaluationEvaluationResultSetDiff struct {
	ReportID        int `json:"reportId"`
	FromReliability int `json:"fromReliability"`
	ToReliability   int `json:"toReliability"`
}

type RejectRulesReevaluationEvaluationResultSetSummary

type RejectRulesReevaluationEvaluationResultSetSummary struct {
	TotalCount         int                                                                   `json:"totalCount"`
	ChangeSetCount     int                                                                   `json:"changeSetCount"`
	ReliabilityChanges []RejectRulesReevaluationEvaluationResultSetSummaryReliabilityChanges `json:"reliabilityChanges"`

	SampledEvaluations RejectRulesReevaluationEvaluationResultSetSummarySampledEvaluations `json:"sampledEvaluations"`
}

type RejectRulesReevaluationEvaluationResultSetSummaryReliabilityChanges

type RejectRulesReevaluationEvaluationResultSetSummaryReliabilityChanges struct {
	From int `json:"from"`
	To   int `json:"to"`

	Count int `json:"count"`
}

type RejectRulesReevaluationEvaluationResultSetSummarySampledEvaluations

type RejectRulesReevaluationEvaluationResultSetSummarySampledEvaluations struct {
	ShouldReject []*RejectRulesReevaluationEvaluationResult `json:"shouldReject"`
	ShouldPass   []*RejectRulesReevaluationEvaluationResult `json:"shouldPass"`
}

type Report

type Report struct {
	DB                     *bun.DB
	Redis                  *redis.Client
	NatsJS                 nats.JetStreamContext
	ItemService            *Item
	StageService           *Stage
	AccountService         *Account
	TimeRangeService       *TimeRange
	StageRepo              *repo.Stage
	DropInfoRepo           *repo.DropInfo
	DropReportRepo         *repo.DropReport
	DropPatternRepo        *repo.DropPattern
	DropReportExtraRepo    *repo.DropReportExtra
	DropPatternElementRepo *repo.DropPatternElement
	ReportVerifier         *reportverifs.ReportVerifiers
}

func NewReport

func NewReport(db *bun.DB, redisClient *redis.Client, natsJs nats.JetStreamContext, itemService *Item, stageService *Stage, stageRepo *repo.Stage, dropInfoRepo *repo.DropInfo, dropReportRepo *repo.DropReport, dropReportExtraRepo *repo.DropReportExtra, dropPatternRepo *repo.DropPattern, dropPatternElementRepo *repo.DropPatternElement, accountService *Account, timeRangeService *TimeRange, reportVerifier *reportverifs.ReportVerifiers) *Report

func (*Report) PipelineAccount

func (s *Report) PipelineAccount(ctx *fiber.Ctx) (accountId int, err error)

func (*Report) PipelineAggregateGachaboxDrops

func (s *Report) PipelineAggregateGachaboxDrops(ctx context.Context, singleReport *types.ReportTaskSingleReport) error

func (*Report) PipelineMergeDropsAndMapDropTypes

func (s *Report) PipelineMergeDropsAndMapDropTypes(ctx context.Context, drops []types.ArkDrop) ([]*types.Drop, error)

func (*Report) PipelinePreprocessRecruitmentTags

func (s *Report) PipelinePreprocessRecruitmentTags(ctx context.Context, req *types.SingularReportRequest) error

func (*Report) PipelinePreprocessRerunStageIdForMaa

func (s *Report) PipelinePreprocessRerunStageIdForMaa(ctx context.Context, req *types.SingularReportRequest) error

func (*Report) PipelineTaskId

func (s *Report) PipelineTaskId(ctx *fiber.Ctx) string

func (*Report) PreprocessAndQueueBatchReport

func (s *Report) PreprocessAndQueueBatchReport(ctx *fiber.Ctx, req *types.BatchReportRequest) (taskId string, err error)

func (*Report) PreprocessAndQueueSingularReport

func (s *Report) PreprocessAndQueueSingularReport(ctx *fiber.Ctx, req *types.SingularReportRequest) (taskId string, err error)

returns taskID and error, if any

func (*Report) RecallSingularReport

func (s *Report) RecallSingularReport(ctx context.Context, req *types.SingularReportRecallRequest) error

type ShortURL

type ShortURL struct {
	ItemService  *Item
	StageService *Stage
	ZoneService  *Zone
	GeoIPService *GeoIP
}

func NewShortURL

func NewShortURL(itemService *Item, stageService *Stage, zoneService *Zone, geoIPService *GeoIP) *ShortURL

func (*ShortURL) Resolve

func (s *ShortURL) Resolve(ctx *fiber.Ctx, path string) string

type SiteStats

type SiteStats struct {
	DropReportService        *DropReport
	DropMatrixElementService *DropMatrixElement
}

func NewSiteStats

func NewSiteStats(
	dropReportService *DropReport,
	dropMatrixElementService *DropMatrixElement,
) *SiteStats

func (*SiteStats) GetShimSiteStats

func (s *SiteStats) GetShimSiteStats(ctx context.Context, server string) (*modelv2.SiteStats, error)

Cache: shimSiteStats#server:{server}, 24hrs

func (*SiteStats) RefreshShimSiteStats

func (s *SiteStats) RefreshShimSiteStats(ctx context.Context, server string) (*modelv2.SiteStats, error)

type Snapshot

type Snapshot struct {
	SnapshotRepo *repo.Snapshot
}

func NewSnapshot

func NewSnapshot(snapshotRepo *repo.Snapshot) *Snapshot

func (*Snapshot) CalculateVersion

func (s *Snapshot) CalculateVersion(content string) string

func (*Snapshot) GetDiffBetweenVersions

func (s *Snapshot) GetDiffBetweenVersions(ctx context.Context, key, fromVersion, toVersion string) ([]byte, error)

func (*Snapshot) SaveSnapshot

func (s *Snapshot) SaveSnapshot(ctx context.Context, key string, content string) (*model.Snapshot, error)

type Stage

type Stage struct {
	StageRepo *repo.Stage
}

func NewStage

func NewStage(stageRepo *repo.Stage) *Stage

func (*Stage) GetGachaBoxStages

func (s *Stage) GetGachaBoxStages(ctx context.Context) ([]*model.Stage, error)

func (*Stage) GetShimStageByArkId

func (s *Stage) GetShimStageByArkId(ctx context.Context, arkStageId string, server string) (*modelv2.Stage, error)

Cache: shimStage#server|arkStageId:{server}|{arkStageId}, 1 hr

func (*Stage) GetShimStages

func (s *Stage) GetShimStages(ctx context.Context, server string) ([]*modelv2.Stage, error)

Cache: shimStages#server:{server}, 1 hr; records last modified time

func (*Stage) GetShimStagesForFakeTime

func (s *Stage) GetShimStagesForFakeTime(ctx context.Context, server string, t time.Time) ([]*modelv2.Stage, error)

Not Cached

func (*Stage) GetStageByArkId

func (s *Stage) GetStageByArkId(ctx context.Context, arkStageId string) (*model.Stage, error)

Cache: stage#arkStageId:{arkStageId}, 1 hr

func (*Stage) GetStageById

func (s *Stage) GetStageById(ctx context.Context, stageId int) (*model.Stage, error)

func (*Stage) GetStageExtraProcessTypeByArkId

func (s *Stage) GetStageExtraProcessTypeByArkId(ctx context.Context, arkStageId string) (null.String, error)

func (*Stage) GetStages

func (s *Stage) GetStages(ctx context.Context) ([]*model.Stage, error)

Cache: (singular) stages, 1 hr

func (*Stage) GetStagesByZoneId

func (s *Stage) GetStagesByZoneId(ctx context.Context, zoneId int) ([]*model.Stage, error)

func (*Stage) GetStagesMapByArkId

func (s *Stage) GetStagesMapByArkId(ctx context.Context) (map[string]*model.Stage, error)

Cache: (singular) stagesMapByArkId, 1 hr

func (*Stage) GetStagesMapById

func (s *Stage) GetStagesMapById(ctx context.Context) (map[int]*model.Stage, error)

Cache: (singular) stagesMapById, 1 hr

func (*Stage) SearchStageByCode

func (s *Stage) SearchStageByCode(ctx context.Context, code string) (*model.Stage, error)

type TimeRange

type TimeRange struct {
	TimeRangeRepo *repo.TimeRange
	DropInfoRepo  *repo.DropInfo
}

func NewTimeRange

func NewTimeRange(timeRangeRepo *repo.TimeRange, dropInfoRepo *repo.DropInfo) *TimeRange

func (*TimeRange) GetAllMaxAccumulableTimeRangesByServer

func (s *TimeRange) GetAllMaxAccumulableTimeRangesByServer(ctx context.Context, server string) (map[int]map[int][]*model.TimeRange, error)

This function will combine time ranges together if they are adjacent Cache: allMaxAccumulableTimeRanges#server:{server}, 5 min

func (*TimeRange) GetCurrentTimeRangesByServer

func (s *TimeRange) GetCurrentTimeRangesByServer(ctx context.Context, server string) ([]*model.TimeRange, error)

func (*TimeRange) GetLatestTimeRangesByServer

func (s *TimeRange) GetLatestTimeRangesByServer(ctx context.Context, server string) (map[int]*model.TimeRange, error)

Cache: latestTimeRanges#server:{server}, 5 min

func (*TimeRange) GetMaxAccumulableTimeRangesByServer

func (s *TimeRange) GetMaxAccumulableTimeRangesByServer(ctx context.Context, server string) (map[int]map[int][]*model.TimeRange, error)

Cache: maxAccumulableTimeRanges#server:{server}, 5 min

func (*TimeRange) GetTimeRangeById

func (s *TimeRange) GetTimeRangeById(ctx context.Context, rangeId int) (*model.TimeRange, error)

Cache: timeRange#rangeId:{rangeId}, 1 hr

func (*TimeRange) GetTimeRangeByServerAndName

func (s *TimeRange) GetTimeRangeByServerAndName(ctx context.Context, server string, name string) (*model.TimeRange, error)

func (*TimeRange) GetTimeRangesByServer

func (s *TimeRange) GetTimeRangesByServer(ctx context.Context, server string) ([]*model.TimeRange, error)

Cache: timeRanges#server:{server}, 1 hr

func (*TimeRange) GetTimeRangesMap

func (s *TimeRange) GetTimeRangesMap(ctx context.Context, server string) (map[int]*model.TimeRange, error)

Cache: timeRangesMap#server:{server}, 5 min

type Trend

type Trend struct {
	DropReportService        *DropReport
	DropInfoService          *DropInfo
	StageService             *Stage
	ItemService              *Item
	DropMatrixElementService *DropMatrixElement
}

func NewTrend

func NewTrend(
	dropReportService *DropReport,
	dropInfoService *DropInfo,
	stageService *Stage,
	itemService *Item,
	dropMatrixElementService *DropMatrixElement,
) *Trend

func (*Trend) GetShimCustomizedTrendResults

func (s *Trend) GetShimCustomizedTrendResults(
	ctx context.Context, server string, startTime *time.Time, intervalLength time.Duration, intervalNum int, stageIds []int, itemIds []int, accountId null.Int, sourceCategory string,
) (*modelv2.TrendQueryResult, error)

func (*Trend) GetShimTrend

func (s *Trend) GetShimTrend(ctx context.Context, server string) (*modelv2.TrendQueryResult, error)

Cache: shimTrend#server:{server}, 24hrs, records last modified time Called by frontend, only for global

type Upyun

type Upyun struct {
	// contains filtered or unexported fields
}

func NewUpyun

func NewUpyun(conf *appconfig.Config) *Upyun

func (*Upyun) ImageURIToSignedURL

func (c *Upyun) ImageURIToSignedURL(uri, style string) (path string, err error)

func (*Upyun) InitImageUpload

func (c *Upyun) InitImageUpload(prefix string, uploadId string) (types.UpyunInitResponse, error)

func (*Upyun) MarshalImageURI

func (c *Upyun) MarshalImageURI(path string) string

func (*Upyun) VerifyImageUploadCallback

func (c *Upyun) VerifyImageUploadCallback(ctx *fiber.Ctx) (path string, err error)

type Zone

type Zone struct {
	ZoneRepo *repo.Zone
}

func NewZone

func NewZone(zoneRepo *repo.Zone) *Zone

func (*Zone) GetShimZoneByArkId

func (s *Zone) GetShimZoneByArkId(ctx context.Context, arkZoneId string) (*modelv2.Zone, error)

Cache: shimZone#arkZoneId:{arkZoneId}, 1 hr

func (*Zone) GetShimZones

func (s *Zone) GetShimZones(ctx context.Context) ([]*modelv2.Zone, error)

Cache: (singular) shimZones, 1 hr; records last modified time

func (*Zone) GetZoneByArkId

func (s *Zone) GetZoneByArkId(ctx context.Context, arkZoneId string) (*model.Zone, error)

Cache: zone#arkZoneId:{arkZoneId}, 1 hr

func (*Zone) GetZoneById

func (s *Zone) GetZoneById(ctx context.Context, id int) (*model.Zone, error)

func (*Zone) GetZones

func (s *Zone) GetZones(ctx context.Context) ([]*model.Zone, error)

Cache: (singular) zones, 1 hr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL