65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import type { ApiResponse } from "@/lib/api"
|
|
import type {
|
|
PhpUserModel,
|
|
UpdateUserInfoParams,
|
|
UpdateUserPwdParams,
|
|
UserItem,
|
|
UserQueryParams,
|
|
} from "@/lib/models/user"
|
|
import { callByUser, callByUserCookie } from "./base"
|
|
|
|
// ==================== 用户管理 ====================
|
|
|
|
export async function fetchUserPage(
|
|
params: UserQueryParams,
|
|
): Promise<ApiResponse<UserItem[]>> {
|
|
return await callByUser<UserItem[]>(
|
|
"/api/baseinfo/v1/user/Page",
|
|
params,
|
|
"GET",
|
|
)
|
|
}
|
|
|
|
export async function fetchUserSearch(
|
|
params: UserQueryParams,
|
|
): Promise<ApiResponse<UserItem[]>> {
|
|
return await callByUser<UserItem[]>(
|
|
"/api/baseinfo/v1/user/Search",
|
|
params,
|
|
"GET",
|
|
)
|
|
}
|
|
|
|
export async function fetchAmountDetails(
|
|
params: Record<string, unknown>,
|
|
): Promise<ApiResponse<Record<string, unknown>>> {
|
|
return await callByUser<Record<string, unknown>>(
|
|
"/api/baseinfo/v1/user/AmountDetails",
|
|
params,
|
|
"GET",
|
|
)
|
|
}
|
|
|
|
export async function updateUserProfile(
|
|
data: Record<string, unknown>,
|
|
): Promise<ApiResponse<undefined>> {
|
|
return await callByUser<undefined>(
|
|
"/api/baseinfo/v1/user/UpdateProfile",
|
|
data,
|
|
)
|
|
}
|
|
|
|
// ==================== 个人中心资料/密码 ====================
|
|
|
|
export async function updateUserInfo(
|
|
data: UpdateUserInfoParams,
|
|
): Promise<ApiResponse<undefined>> {
|
|
return await callByUserCookie<undefined>("/user/ApiUpdateInfo", data)
|
|
}
|
|
|
|
export async function updateUserPwd(
|
|
data: UpdateUserPwdParams,
|
|
): Promise<ApiResponse<PhpUserModel>> {
|
|
return await callByUserCookie<PhpUserModel>("/user/UpdatePwd", data)
|
|
}
|