|
@@ -14,46 +14,6 @@ export const sitemapConfig = {
|
|
|
changefreq: 'daily',
|
|
|
priority: 1,
|
|
|
},
|
|
|
- {
|
|
|
- loc: '/blog',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.8,
|
|
|
- },
|
|
|
- {
|
|
|
- loc: '/register',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.8,
|
|
|
- },
|
|
|
- {
|
|
|
- loc: '/collections',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.8,
|
|
|
- },
|
|
|
- {
|
|
|
- loc: '/about',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.8,
|
|
|
- },
|
|
|
- {
|
|
|
- loc: '/service',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.8,
|
|
|
- },
|
|
|
- {
|
|
|
- loc: '/policy',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.8,
|
|
|
- },
|
|
|
- {
|
|
|
- loc: '/suppliers/all-brands',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.8,
|
|
|
- },
|
|
|
- {
|
|
|
- loc: '/contact',
|
|
|
- changefreq: 'daily',
|
|
|
- priority: 0.6,
|
|
|
- },
|
|
|
],
|
|
|
|
|
|
// 动态路由生成函数
|
|
@@ -61,61 +21,16 @@ export const sitemapConfig = {
|
|
|
const routes: any[] = []
|
|
|
try {
|
|
|
// 获取品牌列表
|
|
|
- const { data: brandData }: any = await axios.get(`${BASE_URL}/client/brand/list/default`, { params: { pageSize: 10000, pageNo: 1 } })
|
|
|
- if (brandData.code === 200) {
|
|
|
- brandData.result.records.forEach((brand: any) => {
|
|
|
- routes.push({
|
|
|
- loc: `${BASE_URL}/brand/${brand.id}`,
|
|
|
- changefreq: 'weekly',
|
|
|
- priority: 0.7,
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- // 获取专题列表
|
|
|
- const { data: featuredData }: any = await axios.get(`${BASE_URL}/client/topic/list`, { params: { pageSize: 10000, pageNo: 1 } })
|
|
|
- if (featuredData.code === 200) {
|
|
|
- featuredData.result.records.forEach((item: any) => {
|
|
|
- routes.push({
|
|
|
- loc: `${BASE_URL}/collections/${item.title}`,
|
|
|
- changefreq: 'weekly',
|
|
|
- priority: 0.7,
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- // 获取分类列表
|
|
|
- const { data: categoryData }: any = await axios.get(`${BASE_URL}/client/category/merchandise`, { params: { all: false, pageSize: 10000, pageNo: 1 } })
|
|
|
- if (categoryData.code === 200) {
|
|
|
- categoryData.result.forEach((item: any) => {
|
|
|
- routes.push({
|
|
|
- loc: `${BASE_URL}/categories/${item.key}`,
|
|
|
- changefreq: 'weekly',
|
|
|
- priority: 0.7,
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- // 获取博客列表
|
|
|
- const { data: blogData }: any = await axios.get(`${BASE_URL}/client/content/list`, { params: { type: 1, pageSize: 10000, pageNo: 1 } })
|
|
|
- if (blogData.code === 200) {
|
|
|
- blogData.result.records.forEach((item: any) => {
|
|
|
- routes.push({
|
|
|
- loc: `${BASE_URL}/blog/${item.contentTitle}`,
|
|
|
- changefreq: 'weekly',
|
|
|
- priority: 0.7,
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- // 获取商品列表
|
|
|
- const { data: productData }: any = await axios.post(`${BASE_URL}/client/merchandise/list/default`, {}, { params: { pageSize: 10000, pageNo: 1 } })
|
|
|
- if (productData.code === 200) {
|
|
|
- productData.result.records.forEach((item: any) => {
|
|
|
- routes.push({
|
|
|
- loc: `${BASE_URL}/product/${item.id}`,
|
|
|
- changefreq: 'weekly',
|
|
|
- priority: 0.7,
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
+ // const { data: brandData }: any = await axios.get(`${BASE_URL}/client/brand/list/default`, { params: { pageSize: 10000, pageNo: 1 } })
|
|
|
+ // if (brandData.code === 200) {
|
|
|
+ // brandData.result.records.forEach((brand: any) => {
|
|
|
+ // routes.push({
|
|
|
+ // loc: `${BASE_URL}/brand/${brand.id}`,
|
|
|
+ // changefreq: 'weekly',
|
|
|
+ // priority: 0.7,
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }
|
|
|
}
|
|
|
catch (error) {
|
|
|
console.error('Error fetching brands:', error)
|