feat(微信用户): 新增微信用户管理模块及相关接口
添加微信用户管理功能,包括用户列表查询、详情获取、增删改查等接口 在订单查询中增加ab98UserId字段,并在用户详情页中传递该参数
This commit is contained in:
parent
59f8a9f744
commit
7296994b51
|
|
@ -3,6 +3,8 @@ import { http } from "@/utils/http";
|
||||||
export interface OrderQuery extends BasePageQuery {
|
export interface OrderQuery extends BasePageQuery {
|
||||||
/** 订单编号 */
|
/** 订单编号 */
|
||||||
orderId?: number;
|
orderId?: number;
|
||||||
|
/** 汇邦云用户ID */
|
||||||
|
ab98UserId?: number;
|
||||||
/**
|
/**
|
||||||
* 微信openid
|
* 微信openid
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
import { http } from "@/utils/http";
|
||||||
|
|
||||||
|
export interface WxUserDTO {
|
||||||
|
/** 主键ID */
|
||||||
|
wxUserId?: number;
|
||||||
|
/** openid */
|
||||||
|
openid?: string;
|
||||||
|
/** 汇邦云用户ID */
|
||||||
|
ab98UserId?: number;
|
||||||
|
/** 企业用户ID */
|
||||||
|
qyUserId?: number;
|
||||||
|
/** 昵称 */
|
||||||
|
nickName?: string;
|
||||||
|
/** 手机号码 */
|
||||||
|
tel?: string;
|
||||||
|
/** 用户余额(单位:分) */
|
||||||
|
wxBalance?: number;
|
||||||
|
/** 创建时间 */
|
||||||
|
createTime?: string;
|
||||||
|
/** 更新时间 */
|
||||||
|
updateTime?: string;
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SearchWxUserQuery extends BasePageQuery {
|
||||||
|
/** 微信用户ID */
|
||||||
|
wxUserId?: number;
|
||||||
|
/** openid */
|
||||||
|
openid?: string;
|
||||||
|
/** 昵称 */
|
||||||
|
nickName?: string;
|
||||||
|
/** 手机号码 */
|
||||||
|
tel?: string;
|
||||||
|
/** 汇邦云用户ID */
|
||||||
|
ab98UserId?: number;
|
||||||
|
/** 企业用户ID */
|
||||||
|
qyUserId?: number;
|
||||||
|
/** 最小余额(分) */
|
||||||
|
minBalance?: number;
|
||||||
|
/** 最大余额(分) */
|
||||||
|
maxBalance?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AddWxUserCommand {
|
||||||
|
/** openid */
|
||||||
|
openid?: string;
|
||||||
|
/** 汇邦云用户ID */
|
||||||
|
ab98UserId?: number;
|
||||||
|
/** 企业用户ID */
|
||||||
|
qyUserId?: number;
|
||||||
|
/** 昵称 */
|
||||||
|
nickName?: string;
|
||||||
|
/** 手机号码 */
|
||||||
|
tel?: string;
|
||||||
|
/** 余额(分) */
|
||||||
|
wxBalance?: string;
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateWxUserCommand extends AddWxUserCommand {
|
||||||
|
/** 主键ID */
|
||||||
|
wxUserId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信用户列表
|
||||||
|
*/
|
||||||
|
export const getWxUserListApi = (params: SearchWxUserQuery) => {
|
||||||
|
return http.request<ResponseData<PageDTO<WxUserDTO>>>("get", "/wx/users", { params });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信用户详情
|
||||||
|
*/
|
||||||
|
export const getWxUserDetailApi = (id: number) => {
|
||||||
|
return http.request<ResponseData<WxUserDTO>>("get", `/wx/users/detail/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid获取微信用户详情
|
||||||
|
*/
|
||||||
|
export const getWxUserDetailByOpenidApi = (openid: string) => {
|
||||||
|
return http.request<ResponseData<WxUserDTO>>("get", "/wx/users/detail/by-openid", {
|
||||||
|
params: { openid }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid获取或创建微信用户
|
||||||
|
*/
|
||||||
|
export const getOrCreateWxUserByOpenidApi = (openid: string) => {
|
||||||
|
return http.request<ResponseData<WxUserDTO>>("get", "/wx/users/get-or-create/by-openid", {
|
||||||
|
params: { openid }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信用户
|
||||||
|
*/
|
||||||
|
export const addWxUserApi = (data: AddWxUserCommand) => {
|
||||||
|
return http.request<ResponseData<void>>("post", "/wx/users", { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信用户
|
||||||
|
*/
|
||||||
|
export const updateWxUserApi = (id: number, data: UpdateWxUserCommand) => {
|
||||||
|
return http.request<ResponseData<void>>("put", `/wx/users/${id}`, { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信用户
|
||||||
|
*/
|
||||||
|
export const deleteWxUserApi = (id: number) => {
|
||||||
|
return http.request<ResponseData<void>>("delete", `/wx/users/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信用户
|
||||||
|
*/
|
||||||
|
export const deleteWxUserBatchApi = (ids: number[]) => {
|
||||||
|
return http.request<ResponseData<void>>("delete", `/wx/users/batch/${ids.join(',')}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加微信用户余额
|
||||||
|
*/
|
||||||
|
export const increaseWxUserBalanceApi = (id: number, amount: number) => {
|
||||||
|
return http.request<ResponseData<void>>("post", `/wx/users/${id}/increase-balance`, {
|
||||||
|
params: { amount }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减少微信用户余额
|
||||||
|
*/
|
||||||
|
export const decreaseWxUserBalanceApi = (id: number, amount: number) => {
|
||||||
|
return http.request<ResponseData<void>>("post", `/wx/users/${id}/decrease-balance`, {
|
||||||
|
params: { amount }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置微信用户余额
|
||||||
|
*/
|
||||||
|
export const setWxUserBalanceApi = (id: number, balance: number) => {
|
||||||
|
return http.request<ResponseData<void>>("post", `/wx/users/${id}/set-balance`, {
|
||||||
|
params: { balance }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
@ -48,6 +48,7 @@ async function fetchOrders() {
|
||||||
try {
|
try {
|
||||||
orderLoading.value = true;
|
orderLoading.value = true;
|
||||||
const { data } = await getOrderListApi({
|
const { data } = await getOrderListApi({
|
||||||
|
ab98UserId: userInfo.value.ab98UserId,
|
||||||
openid: userInfo.value.openid,
|
openid: userInfo.value.openid,
|
||||||
pageSize: pagination.value.pageSize,
|
pageSize: pagination.value.pageSize,
|
||||||
pageNum: pagination.value.currentPage
|
pageNum: pagination.value.currentPage
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue