|
@@ -49,6 +49,8 @@ public class ShopServiceImpl implements ShopService {
|
|
|
private ArticleMapper articleMapper;
|
|
|
@Resource
|
|
|
private PersonalCenterMapper personalCenterMapper;
|
|
|
+ @Value("${spring.cloud.config.profile}")
|
|
|
+ private String active;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -415,14 +417,20 @@ public class ShopServiceImpl implements ShopService {
|
|
|
ShopArticleVo shopArticle = articleMapper.getShopArticleById(articleId);
|
|
|
// 文章分类列表
|
|
|
List<ArticleTypeVo> articleTypeList = articleMapper.getArticleTypeList();
|
|
|
+ // 文章标签列表
|
|
|
+ String articleLabels = articleMapper.getArticleLabelList();
|
|
|
map.put("shopArticle", shopArticle);
|
|
|
map.put("articleTypeList", articleTypeList);
|
|
|
+ map.put("articleLabels", articleLabels);
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ResponseJson<Void> saveShopArticle(ShopArticleDto shopArticleDto) {
|
|
|
// 参数校验
|
|
|
+ if (null == shopArticleDto.getShopId()) {
|
|
|
+ return ResponseJson.error("参数异常,供应商id不能为空", null);
|
|
|
+ }
|
|
|
if (StringUtils.isEmpty(shopArticleDto.getTitle())) {
|
|
|
return ResponseJson.error("参数异常,文章标题不能为空", null);
|
|
|
}
|
|
@@ -481,18 +489,20 @@ public class ShopServiceImpl implements ShopService {
|
|
|
// 新增文章浏览/点赞记录
|
|
|
articleMapper.insertArticlePraise(articlePo.getArticleId());
|
|
|
// 新增文章 百度链接实时推送
|
|
|
- GenerateUtils.pushBaiduLink("https://www.caimei365.com/info/detail-"+articlePo.getArticleId()+"-1.html");
|
|
|
+ if ("prod".equals(active)) {
|
|
|
+ GenerateUtils.pushBaiduLink("https://www.caimei365.com/info/detail-"+articlePo.getArticleId()+"-1.html");
|
|
|
+ }
|
|
|
}
|
|
|
return ResponseJson.success(null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseJson<PageInfo<ShopArticleVo>> getShopArticleList(Integer shopId, int pageNum, int pageSize) {
|
|
|
- if (null == shopId) {
|
|
|
+ public ResponseJson<PageInfo<ShopArticleVo>> getShopArticleList(ShopArticleDto shopArticleDto, int pageNum, int pageSize) {
|
|
|
+ if (null == shopArticleDto) {
|
|
|
return ResponseJson.error("参数异常", null);
|
|
|
}
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- List<ShopArticleVo> articleList = articleMapper.getShopArticleList(shopId);
|
|
|
+ List<ShopArticleVo> articleList = articleMapper.getShopArticleList(shopArticleDto);
|
|
|
PageInfo<ShopArticleVo> pageInfo = new PageInfo<>(articleList);
|
|
|
return ResponseJson.success(pageInfo);
|
|
|
}
|
|
@@ -500,11 +510,27 @@ public class ShopServiceImpl implements ShopService {
|
|
|
@Override
|
|
|
public ResponseJson<Void> updateArticleStatus(ShopArticleDto shopArticleDto) {
|
|
|
Integer articleId = shopArticleDto.getArticleId();
|
|
|
- String status = shopArticleDto.getStatus();
|
|
|
+ Integer status = shopArticleDto.getStatus();
|
|
|
if (null == articleId || null == status) {
|
|
|
return ResponseJson.error("参数异常", null);
|
|
|
}
|
|
|
articleMapper.updateArticleStatus(articleId, status);
|
|
|
+ // 更新文章索引
|
|
|
+ commodityFeign.updateArticleIndex(articleId);
|
|
|
+ return ResponseJson.success(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson<List<ArticleTypeVo>> getArticleTypeList() {
|
|
|
+ List<ArticleTypeVo> articleTypeList = articleMapper.getArticleTypeList();
|
|
|
+ return ResponseJson.success(articleTypeList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Void> deleteArticle(Integer articleId) {
|
|
|
+ articleMapper.deleteArticle(articleId);
|
|
|
+ // 更新文章索引
|
|
|
+ commodityFeign.updateArticleIndex(articleId);
|
|
|
return ResponseJson.success(null);
|
|
|
}
|
|
|
}
|