与京东日账单共用取数与渲染逻辑的页签。 */ public static function tabs(): array { return [self::BILL_TYPE_JD, self::BILL_TYPE_JINGXI]; } public static function isJdBillTab(string $billType): bool { return in_array($billType, self::tabs(), true); } /** 页签对应的平台口径:'jingxi'、'jd',非京东系列页签返回 null。 */ public static function platformForBillType(string $billType): ?string { return match ($billType) { self::BILL_TYPE_JINGXI => 'jingxi', self::BILL_TYPE_JD => 'jd', default => null, }; } /** 京喜店铺名关键字。 */ public static function storeNameKeyword(): string { $keyword = trim((string) config(self::CONFIG_KEY . '.jingxi_store_name_keyword', '京喜')); return $keyword === '' ? '京喜' : $keyword; } /** 口径切换起始日期;null = 全量历史。 */ public static function scopeStartDate(): ?string { $start = config(self::CONFIG_KEY . '.scope_start_date'); return is_string($start) && preg_match('/^\d{4}-\d{2}-\d{2}$/', $start) === 1 ? $start : null; } /** * 店铺维度的过滤条件。 * * @param 'jingxi'|'jd'|null $platform * @return array{mode:string,keyword:string,start_date:?string}|null mode: only=只取该平台,exclude=排除该平台 */ public static function storeNameScope(?string $platform): ?array { if (! in_array($platform, ['jingxi', 'jd'], true)) { return null; } return [ 'mode' => $platform === 'jingxi' ? 'only' : 'exclude', 'keyword' => self::storeNameKeyword(), 'start_date' => self::scopeStartDate(), ]; } }