添加表单查询和调整表格字段以及功能

This commit is contained in:
Eamon
2026-03-26 15:27:52 +08:00
parent a9e9ddd04b
commit 453d687c4a
28 changed files with 3013 additions and 384 deletions

View File

@@ -2,6 +2,17 @@ import type { PageRecord } from "@/lib/api"
import type { Batch } from "@/models/batch"
import { callByUser } from "./base"
export async function getPageBatch(params: { page: number; size: number }) {
export async function getPageBatch(params: {
page: number
size: number
user_phone?: string
resource_no?: string
batch_no?: string
prov?: string
city?: string
isp?: string
created_at_start?: Date
created_at_end?: Date
}) {
return callByUser<PageRecord<Batch>>("/api/admin/batch/page", params)
}

View File

@@ -1,7 +1,28 @@
import type { PageRecord } from "@/lib/api"
import { ProductCode } from "@/lib/base"
import type { Billing } from "@/models/billing"
import type { ProductSku } from "@/models/product_sku"
import { callByUser } from "./base"
export async function getPageBill(params: { page: number; size: number }) {
export async function getPageBill(params: {
page: number
size: number
bill_no?: string
user_phone?: string
trade_inner_no?: string
resource_no?: string
sku_code?: string
product_code?: string
created_at_start?: Date
created_at_end?: Date
}) {
return callByUser<PageRecord<Billing>>("/api/admin/bill/page", params)
}
export async function getSkuList(params: { product_code?: ProductCode }) {
const requestParams = {
...params,
...(params.product_code === ProductCode.All && { product_code: undefined }),
}
return callByUser<ProductSku[]>("/api/admin/product/sku/all", requestParams)
}

View File

@@ -2,6 +2,17 @@ import type { PageRecord } from "@/lib/api"
import type { Channel } from "@/models/channel"
import { callByUser } from "./base"
export async function getPageChannel(params: { page: number; size: number }) {
export async function getPageChannel(params: {
page: number
size: number
batch_no?: string
user_phone?: string
resource_no?: string
proxy_port?: number
proxy_host?: string
node_ip?: string
expired_at_start?: Date
expired_at_end?: Date
}) {
return callByUser<PageRecord<Channel>>("/api/admin/channel/page", params)
}

25
src/actions/cust.ts Normal file
View File

@@ -0,0 +1,25 @@
import type { PageRecord } from "@/lib/api"
import type { Cust } from "@/models/cust"
import { callByUser } from "./base"
export async function getPageCusts(params: { page: number; size: number }) {
return callByUser<PageRecord<Cust>>("/api/admin/user/page", params)
}
export async function updateCust(data: {
id: number
phone: string
email: string
}) {
return callByUser<PageRecord<Cust>>("/api/admin/user/updateCust", data)
}
export async function createCust(data: {
username: string
password: string
phone: string
email?: string
name?: string
contact_wechat?: string
}) {
return callByUser<PageRecord<Cust>>("/api/admin/user/create", data)
}

View File

@@ -2,19 +2,32 @@ import type { PageRecord } from "@/lib/api"
import type { Resources } from "@/models/resources"
import { callByUser } from "./base"
export async function listResourceLong(params: { page: number; size: number }) {
export interface ResourceListParams {
page: number
size: number
user_phone?: string
resource_no?: string
active?: boolean
mode?: number
created_at_start?: Date
created_at_end?: Date
expired?: boolean
}
export async function listResourceLong(params: ResourceListParams) {
return callByUser<PageRecord<Resources>>(
"/api/admin/resource/long/page",
params,
)
}
export async function listResourceShort(params: {
page: number
size: number
}) {
export async function listResourceShort(params: ResourceListParams) {
return callByUser<PageRecord<Resources>>(
"/api/admin/resource/short/page",
params,
)
}
export async function updateResource(data: { id: number; active?: boolean }) {
return callByUser<Resources>("/api/admin/resource/update", data)
}

View File

@@ -2,6 +2,16 @@ import type { PageRecord } from "@/lib/api"
import type { Trade } from "@/models/trade"
import { callByUser } from "./base"
export async function getPageTrade(params: { page: number; size: number }) {
export async function getPageTrade(params: {
page: number
size: number
user_phone?: string
inner_no?: string
method?: number
platform?: number
status?: number
created_at_start?: Date
created_at_end?: Date
}) {
return callByUser<PageRecord<Trade>>("/api/admin/trade/page", params)
}

View File

@@ -6,7 +6,14 @@ export async function getPageUsers(params: { page: number; size: number }) {
return callByUser<PageRecord<User>>("/api/admin/user/page", params)
}
export async function bindAdmin(params: { id: number }) {
export async function bindAdmin(params: {
id: number
phone?: string
name?: string
identified?: boolean
enabled?: boolean
assigned?: boolean
}) {
return callByUser("/api/admin/user/bind", {
user_id: params.id,
})