11export const sponsorUrl : string = typeof window !== 'undefined' ? window . location . origin + '/fastapi_best_architecture_docs/sponsors.html' : 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/sponsors.html' ;
22
3- interface Sponsor {
3+ export interface Sponsor {
4+ link : string ;
45 href ?: string ;
5- link ?: string ;
66 alt ?: string ;
77 expiryTime : string ; // ISO 格式日期:2099-12-31T23:59:59
88}
@@ -11,58 +11,40 @@ export const defaultSponsor: Sponsor = {
1111 link : '' ,
1212 href : sponsorUrl ,
1313 alt : '成为赞助商' ,
14- expiryTime : '2099-12-31T23:59:59 ' ,
14+ expiryTime : '' ,
1515} ;
1616
1717export const homeSponsor : Sponsor = { ...defaultSponsor } ;
1818
1919
2020export const goldSponsors : Sponsor [ ] = [
21- {
22- link : 'https://dscache.tencent-cloud.cn/upload//rhino-design-800x450-fea2ea55b7b63624628bf9bb22454cb8f91b7d69.png' ,
23- href : 'https://curl.qcloud.com/f9VMAii8' ,
24- alt : '2核2G云服务器低至 68元/年' ,
25- expiryTime : '2025-12-31T23:59:59' ,
26- } ,
2721 {
2822 link : 'https://img14.360buyimg.com/ddimg/jfs/t1/284966/5/22913/37242/68023351Faddd8304/6337ad52ea02ad10.jpg' ,
2923 href : 'https://share.302.ai/LJojhb' ,
3024 alt : '302.AI' ,
3125 expiryTime : '2025-06-18T16:35:00' ,
32- } ,
33- { ...defaultSponsor }
26+ }
3427]
3528
3629export const generalSponsors : Sponsor [ ] = [
3730 {
38- link : 'https://user.by.ltd/templates/lagom2/assets/img/logo/logo_big_inverse.1753622506.png ' ,
31+ link : 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQImbvY5S8IbJ1iL6yHfExtHiAhUtLIoi7AQ&s ' ,
3932 href : 'https://user.by.ltd/aff.php?aff=12215' ,
4033 alt : 'Bywave' ,
4134 expiryTime : '2099-12-31T23:59:59' ,
4235 } ,
43- { ...defaultSponsor } ,
44- { ...defaultSponsor } ,
45- { ...defaultSponsor } ,
46- { ...defaultSponsor } ,
4736 { ...defaultSponsor }
4837]
4938
5039export const openSponsorLink = ( href : string ) => {
5140 window . open ( href ) ;
5241} ;
5342
54- export function shouldShowSponsor ( sponsor : {
55- href ?: string ;
56- link ?: string ;
57- expiryTime ?: string ;
58- } ) : boolean {
59- if ( ! sponsor . link ) return false ;
60-
61- if ( sponsor . expiryTime ) {
43+ export function shouldShowSponsor ( expiryTime ?: string ) : boolean {
44+ if ( expiryTime ) {
6245 const now = new Date ( ) ;
63- const expiryDate = new Date ( sponsor . expiryTime ) ;
46+ const expiryDate = new Date ( expiryTime ) ;
6447 return now < expiryDate ;
6548 }
66-
67- return true ;
49+ return false ;
6850}
0 commit comments