mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-16 16:05:52 +08:00
feat(商品设置): 添加ES商品索引管理功能
新增三个API接口用于管理ES商品索引: 1. 删除ES中下架的商品 2. 删除不存在的索引 3. 生成所有商品的缓存 同时在商品设置页面添加对应操作按钮
This commit is contained in:
@@ -445,6 +445,21 @@ export const getProgress = () => {
|
||||
return getRequest(`/other/elasticsearch/progress`);
|
||||
};
|
||||
|
||||
// 删除ES中下架的商品
|
||||
export const deleteGoodsDown = () => {
|
||||
return getRequest(`/other/elasticsearch/deleteGoodsDown`);
|
||||
};
|
||||
|
||||
// 删除不存在的索引
|
||||
export const delSkuIndex = () => {
|
||||
return getRequest(`/other/elasticsearch/delSkuIndex`);
|
||||
};
|
||||
|
||||
// 生成所有商品的缓存
|
||||
export const generateGoodsCache = () => {
|
||||
return getRequest(`/other/elasticsearch/cache`);
|
||||
};
|
||||
|
||||
// 分页查询自定义分词
|
||||
export const getCustomWordsPage = (params) => {
|
||||
return getRequest(`/other/customWords/page`, params);
|
||||
|
||||
@@ -56,7 +56,12 @@
|
||||
</div>
|
||||
<div class="label-btns">
|
||||
<Button type="primary" @click="submit('formValidate')">保存</Button>
|
||||
<Button type="primary" style="margin-left: 100px" @click="createIndex()">重新生成所有商品索引</Button>
|
||||
<div class="es-buttons">
|
||||
<Button type="success" @click="createIndex()">重新生成所有商品索引</Button>
|
||||
<Button type="info" @click="deleteDownGoods()">删除ES中下架的商品</Button>
|
||||
<Button type="warning" @click="generateCache()">生成所有商品的缓存</Button>
|
||||
<Button type="error" @click="deleteNotExistIndex()">删除不存在的索引</Button>
|
||||
</div>
|
||||
<div class="progress-item" v-if="showProgress">
|
||||
<i-progress :percent="progressVal"></i-progress>
|
||||
</div>
|
||||
@@ -65,7 +70,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { setSetting, createIndex, getProgress } from "@/api/index";
|
||||
import { setSetting, createIndex, getProgress, deleteGoodsDown, generateGoodsCache, delSkuIndex } from "@/api/index";
|
||||
import { handleSubmit } from "./validate";
|
||||
export default {
|
||||
props: ["res", "type"],
|
||||
@@ -140,6 +145,36 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
//删除ES中下架的商品
|
||||
deleteDownGoods() {
|
||||
deleteGoodsDown().then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success("删除成功!");
|
||||
} else {
|
||||
this.$Message.error("删除失败!");
|
||||
}
|
||||
});
|
||||
},
|
||||
//生成所有商品的缓存
|
||||
generateCache() {
|
||||
generateGoodsCache().then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success("生成成功!");
|
||||
} else {
|
||||
this.$Message.error("生成失败!");
|
||||
}
|
||||
});
|
||||
},
|
||||
//删除不存在的索引
|
||||
deleteNotExistIndex() {
|
||||
delSkuIndex().then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success("删除成功!");
|
||||
} else {
|
||||
this.$Message.error("删除失败!");
|
||||
}
|
||||
});
|
||||
},
|
||||
// 保存设置
|
||||
setupSetting() {
|
||||
setSetting(this.type, this.formValidate).then((res) => {
|
||||
|
||||
Reference in New Issue
Block a user