1
This commit is contained in:
@@ -141,6 +141,31 @@ public class CommentController extends BaseController {
|
||||
return success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存型号与商品ID映射(京东:型号→京东商品ID;淘宝:京东商品ID→淘宝商品ID)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('jarvis:comment:edit')")
|
||||
@Log(title = "评论商品ID", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/redis/map")
|
||||
public AjaxResult saveProductTypeMap(@RequestBody ProductTypeMapBody body) {
|
||||
if (body == null) {
|
||||
return error("参数不能为空");
|
||||
}
|
||||
commentService.saveProductTypeMap(body.getSource(), body.getKey(), body.getValue(), body.getOldKey());
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除型号与商品ID映射
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('jarvis:comment:edit')")
|
||||
@Log(title = "评论商品ID", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/redis/map")
|
||||
public AjaxResult deleteProductTypeMap(@RequestParam("source") String source, @RequestParam("key") String key) {
|
||||
commentService.deleteProductTypeMap(source, key);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论(后端转发到外部服务,避免前端跨域)
|
||||
* 请求转发至:GET {fetch-comments.base-url}/fetch_comments?product_id=xxx
|
||||
@@ -161,5 +186,51 @@ public class CommentController extends BaseController {
|
||||
return error("调用获取评论接口失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品ID映射保存参数
|
||||
*/
|
||||
public static class ProductTypeMapBody {
|
||||
/** jd 或 tb */
|
||||
private String source;
|
||||
/** 京东为型号名称,淘宝为京东商品ID */
|
||||
private String key;
|
||||
/** 京东为京东商品ID,淘宝为淘宝商品ID */
|
||||
private String value;
|
||||
/** 编辑前的 key,新增时为空 */
|
||||
private String oldKey;
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getOldKey() {
|
||||
return oldKey;
|
||||
}
|
||||
|
||||
public void setOldKey(String oldKey) {
|
||||
this.oldKey = oldKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user