新增商品详情md转html

This commit is contained in:
2026-07-06 11:11:22 +08:00
parent e1d99b8ccf
commit 031a96b14e
4 changed files with 158 additions and 14 deletions

View File

@@ -3,6 +3,12 @@ import type { ApiResult, PageResult } from '@/api';
import type { ShopGoods, ShopGoodsParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
export interface ConvertGoodsContentResult {
total: number;
success: number;
updatedGoodsIds: number[];
}
/**
* 分页查询商品
*/
@@ -115,6 +121,30 @@ export async function getCount(params: ShopGoodsParam) {
return Promise.reject(new Error(res.data.message));
}
/**
* 商品详情Markdown图片转HTML
*/
export async function convertMarkdownImagesToHtml(params?: {
tenantId?: number;
goodsId?: number;
code?: string;
}) {
const res = await request.post<ApiResult<ConvertGoodsContentResult>>(
MODULES_API_URL + '/shop/shop-goods/content/markdown-images/to-html',
null,
{
params
}
);
if (res.data.code === 0) {
return {
message: res.data.message,
data: res.data.data
};
}
return Promise.reject(new Error(res.data.message));
}
/**
* 导入商品
*/
@@ -146,3 +176,19 @@ export async function importShopGoodsImages(file: File) {
}
return Promise.reject(new Error(res.data.message));
}
/**
* 导入商品详情
*/
export async function importShopGoodsDetails(file: File) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/shop/shop-goods/import/details',
formData
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}