This commit is contained in:
toom1996
2025-07-24 16:05:56 +08:00
parent 7a12c336d4
commit 3ba9239522
14 changed files with 301 additions and 73 deletions

View File

@ -1,7 +1,7 @@
export const column = [
{
sign: 'seo_tech',
title: 'SEO教程',
title: 'SEO教程经验',
desc: '霍尔果斯飞驰广告有限公司不仅帮助多个企业实现了品牌曝光和流量增长也在SEO优化过程中积累了宝贵的经验和教训。我们相信随着SEO策略的不断发展和优化未来的网络营销将更加精细化、智能化。'
}
]

22
utils/date.ts Normal file
View File

@ -0,0 +1,22 @@
export function formatDate(dateStr:string) {
const date = new Date(dateStr);
if (isNaN(date)) return 'Invalid Date';
// 本地时间组件
const pad = n => String(n).padStart(2, '0');
const year = date.getFullYear();
const month = pad(date.getMonth() + 1);
const day = pad(date.getDate());
const hours = pad(date.getHours());
const minutes = pad(date.getMinutes());
const seconds = pad(date.getSeconds());
// 获取本地偏移量(分钟),转换为 +08:00 格式
const timezoneOffset = -date.getTimezoneOffset(); // 反向处理
const offsetHours = pad(Math.floor(Math.abs(timezoneOffset) / 60));
const offsetMinutes = pad(Math.abs(timezoneOffset) % 60);
const offsetSign = timezoneOffset >= 0 ? '+' : '-';
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}${offsetSign}${offsetHours}:${offsetMinutes}`;
}

View File

@ -10,11 +10,6 @@ interface result<T> {
data : T
}
interface data<T> {
page_title: string
page_module: T
}
function getRpcClient() {
return new JsonRpcClient(import.meta.env.RPC_REMOTE, import.meta.env.RPC_PORT)
@ -32,13 +27,27 @@ export interface InewsIndex {
updated_at: string
column_tag: string
column_tag_url: string
second_column_tag: string
second_column_tag_url: string
}
export async function newsIndex(websiteId:number = 0, limit:number = 10, page:number = 1):Promise<result<InewsIndex[]>>{
export async function newsIndex(websiteId:number = 0, limit:number = 10, page:number = 1, filter = []):Promise<{
code : number
message : string
data : InewsIndex[]
total: number
hot: {
cover: string
id: string
title: string
created_at: string
}[]
}>{
const client = getRpcClient()
const result = await client.call('news/index', {
id:websiteId,
limit: limit,
page: page
page: page,
filter: filter
})
return result
@ -56,6 +65,8 @@ export interface InewsDetail {
updated_at: string
column_tag: string
column_tag_url: string
second_column: string
second_column_url: string
about: {
id: number
title: string
@ -101,5 +112,20 @@ export async function websiteConfig(host:string):Promise<result<IWebsiteConfig>>
host:host
})
return result
}
export interface Icolumns {
id: number
title: string
link: string
desc:string
}
export async function columns(id: number):Promise<result<Icolumns>>{
const client = getRpcClient()
const result = await client.call('column/index', {
app_id:id,
})
return result
}