update
This commit is contained in:
40
utils/rpc.ts
40
utils/rpc.ts
@ -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
|
||||
}
|
Reference in New Issue
Block a user