deploy: auto commit repo-root changes 2026-07-11 12:03:08
This commit is contained in:
@@ -535,6 +535,7 @@ class MatchController extends BaseApiController
|
||||
$this->request->get('sport_type/d', 0),
|
||||
trim($this->request->get('league_name/s', ''))
|
||||
),
|
||||
'platform_options' => $this->getOddsPlatformOptions(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -552,6 +553,7 @@ class MatchController extends BaseApiController
|
||||
'',
|
||||
true
|
||||
),
|
||||
'platform_options' => $this->getOddsPlatformOptions(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -795,11 +797,39 @@ class MatchController extends BaseApiController
|
||||
|
||||
private function resolveOddsPlatformName(string $sourceSite): string
|
||||
{
|
||||
$map = [
|
||||
$map = $this->getOddsPlatformNameMap();
|
||||
return $map[$sourceSite] ?? ($sourceSite !== '' ? strtoupper($sourceSite) : '平台');
|
||||
}
|
||||
|
||||
private function getOddsPlatformNameMap(): array
|
||||
{
|
||||
return [
|
||||
'hg' => '滚球',
|
||||
'titan007' => '球探',
|
||||
];
|
||||
return $map[$sourceSite] ?? ($sourceSite !== '' ? strtoupper($sourceSite) : '平台');
|
||||
}
|
||||
|
||||
private function getOddsPlatformOptions(): array
|
||||
{
|
||||
$platformMap = $this->getOddsPlatformNameMap();
|
||||
$sourceSites = MatchOdds::where('source_site', '<>', '')
|
||||
->group('source_site')
|
||||
->column('source_site');
|
||||
foreach ($sourceSites as $sourceSite) {
|
||||
$sourceSite = strtolower(trim((string)$sourceSite));
|
||||
if ($sourceSite !== '' && !isset($platformMap[$sourceSite])) {
|
||||
$platformMap[$sourceSite] = strtoupper($sourceSite);
|
||||
}
|
||||
}
|
||||
|
||||
$options = [];
|
||||
foreach ($platformMap as $key => $label) {
|
||||
$options[] = [
|
||||
'key' => $key,
|
||||
'label' => $label,
|
||||
];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
private function resolveOddsShowTypeText(string $showType): string
|
||||
|
||||
@@ -97,16 +97,11 @@ class MatchLiveService
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function getLiveCards(
|
||||
int $sportType = 0,
|
||||
string $leagueName = '',
|
||||
bool $worldCupOnly = false
|
||||
): array
|
||||
public static function getLiveCards(int $sportType = 0, string $leagueName = ''): array
|
||||
{
|
||||
$query = MatchLive::alias('live')
|
||||
->join('match m', 'm.id = live.match_id')
|
||||
->where(['m.is_show' => 1])
|
||||
->where([['m.status', '<>', 2]]);
|
||||
->leftJoin('match m', 'm.id = live.match_id')
|
||||
->where('live.fetch_status', 1);
|
||||
|
||||
if ($sportType > 0) {
|
||||
$query->where('m.sport_type', $sportType);
|
||||
@@ -114,13 +109,6 @@ class MatchLiveService
|
||||
if ($leagueName !== '') {
|
||||
$query->where('m.league_name', $leagueName);
|
||||
}
|
||||
if ($worldCupOnly) {
|
||||
$query
|
||||
->where(function ($query) {
|
||||
$query->where('m.league_name', '世界杯')
|
||||
->whereOr('m.competition_id', 61);
|
||||
});
|
||||
}
|
||||
|
||||
$rows = $query
|
||||
->field([
|
||||
@@ -210,6 +198,6 @@ class MatchLiveService
|
||||
|
||||
public static function getWorldCupLiveCards(): array
|
||||
{
|
||||
return self::getLiveCards(0, '', true);
|
||||
return self::getLiveCards();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,19 @@
|
||||
|
||||
<block v-else>
|
||||
<view class="match-odds-filter">
|
||||
<scroll-view scroll-x
|
||||
class="match-odds-filter__tabs match-odds-filter__platforms"
|
||||
show-scrollbar="false">
|
||||
<view class="match-odds-filter__tabs-inner">
|
||||
<view v-for="item in oddsPlatformOptions" :key="item.key"
|
||||
class="match-odds-filter__tab"
|
||||
:class="{ 'match-odds-filter__tab--active': oddsSourceSite === item.key }"
|
||||
@tap="switchOddsSourceSite(item.key)">
|
||||
<text>{{ item.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<scroll-view scroll-x class="match-odds-filter__tabs" show-scrollbar="false">
|
||||
<view class="match-odds-filter__tabs-inner">
|
||||
<view v-for="item in oddsShowTypeOptions" :key="item.key" class="match-odds-filter__tab"
|
||||
@@ -232,6 +245,7 @@ import {
|
||||
|
||||
type MatchCenterTab = 'schedule' | 'live' | 'odds'
|
||||
type OddsShowType = '' | 'live' | 'today' | 'early'
|
||||
type OddsPlatformOption = { key: string; label: string }
|
||||
|
||||
const contentTabs: { key: MatchCenterTab; label: string }[] = [
|
||||
{ key: 'schedule', label: '赛程' },
|
||||
@@ -246,6 +260,12 @@ const oddsShowTypeOptions: { key: OddsShowType; label: string }[] = [
|
||||
{ key: 'early', label: '早盘' },
|
||||
]
|
||||
|
||||
const defaultOddsPlatformOptions: OddsPlatformOption[] = [
|
||||
{ key: '', label: '全部平台' },
|
||||
{ key: 'hg', label: '滚球' },
|
||||
{ key: 'titan007', label: '球探' },
|
||||
]
|
||||
|
||||
const activeTab = ref<MatchCenterTab>('schedule')
|
||||
const sportTabs = ref<any[]>([])
|
||||
const currentSport = ref(0)
|
||||
@@ -269,6 +289,8 @@ const useLiveCardPosterMode = ref(false)
|
||||
const oddsList = ref<MatchOddsMatchItem[]>([])
|
||||
const oddsLoading = ref(false)
|
||||
const oddsLoaded = ref(false)
|
||||
const oddsPlatformOptions = ref<OddsPlatformOption[]>([...defaultOddsPlatformOptions])
|
||||
const oddsSourceSite = ref('')
|
||||
const oddsShowType = ref<OddsShowType>('')
|
||||
const oddsKeyword = ref('')
|
||||
const oddsSearchText = ref('')
|
||||
@@ -313,9 +335,12 @@ const matchGroups = computed(() => {
|
||||
})
|
||||
|
||||
const oddsFilterSummary = computed(() => {
|
||||
const platformLabel = oddsPlatformOptions.value.find(
|
||||
(item) => item.key === oddsSourceSite.value,
|
||||
)?.label || '全部平台'
|
||||
const showTypeLabel = oddsShowTypeOptions.find((item) => item.key === oddsShowType.value)?.label || '全部盘口'
|
||||
const keyword = oddsKeyword.value.trim()
|
||||
const parts = [showTypeLabel]
|
||||
const parts = [platformLabel, showTypeLabel]
|
||||
if (keyword) parts.push(`"${keyword}"`)
|
||||
parts.push(`${oddsList.value.length}场`)
|
||||
return parts.join(' · ')
|
||||
@@ -397,7 +422,10 @@ const fetchLiveCards = async (force = false) => {
|
||||
|
||||
const buildOddsRequestParams = () => {
|
||||
const params: {
|
||||
sport_type?: number
|
||||
league_name?: string
|
||||
show_type?: 'live' | 'today' | 'early'
|
||||
source_site?: string
|
||||
keyword?: string
|
||||
include_special: number
|
||||
limit: number
|
||||
@@ -405,7 +433,10 @@ const buildOddsRequestParams = () => {
|
||||
include_special: 0,
|
||||
limit: 300,
|
||||
}
|
||||
if (currentSport.value > 0) params.sport_type = currentSport.value
|
||||
if (currentLeague.value) params.league_name = currentLeague.value
|
||||
if (oddsShowType.value) params.show_type = oddsShowType.value
|
||||
if (oddsSourceSite.value) params.source_site = oddsSourceSite.value
|
||||
const keyword = oddsKeyword.value.trim()
|
||||
if (keyword) params.keyword = keyword
|
||||
return params
|
||||
@@ -420,6 +451,21 @@ const fetchOdds = async (force = false) => {
|
||||
const data = await getMatchOdds(buildOddsRequestParams())
|
||||
if (requestSeq === oddsRequestSeq.value) {
|
||||
oddsList.value = Array.isArray(data?.list) ? data.list : []
|
||||
const platformOptions = Array.isArray(data?.platform_options)
|
||||
? data.platform_options
|
||||
: []
|
||||
const platformMap = new Map(
|
||||
defaultOddsPlatformOptions.map((item) => [item.key, item]),
|
||||
)
|
||||
platformOptions.forEach((item: any) => {
|
||||
if (item?.key) {
|
||||
platformMap.set(String(item.key), {
|
||||
key: String(item.key),
|
||||
label: String(item.label || item.key).trim(),
|
||||
})
|
||||
}
|
||||
})
|
||||
oddsPlatformOptions.value = Array.from(platformMap.values())
|
||||
oddsLoaded.value = true
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -495,6 +541,13 @@ const switchOddsShowType = (showType: OddsShowType) => {
|
||||
void fetchOdds(true)
|
||||
}
|
||||
|
||||
const switchOddsSourceSite = (sourceSite: string) => {
|
||||
if (oddsSourceSite.value === sourceSite) return
|
||||
oddsSourceSite.value = sourceSite
|
||||
oddsLoaded.value = false
|
||||
void fetchOdds(true)
|
||||
}
|
||||
|
||||
const confirmOddsSearch = () => {
|
||||
const keyword = oddsSearchText.value.trim()
|
||||
if (oddsKeyword.value === keyword && oddsLoaded.value) return
|
||||
@@ -1005,6 +1058,10 @@ onMounted(() => {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.match-odds-filter__platforms {
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.match-odds-filter__tabs-inner {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user