Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user