Authored by mlge

Merge branch 'test6.8.7' of http://git.yoho.cn/platform/platform-cms into test6.8.7

... ... @@ -676,24 +676,27 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
@Override
public void deleteArticle(GrassArticleReq req) throws PlatformException {
int articleId = req.getArticleId();
GrassArticle grassArticle = grassArticleDao.selectByPrimaryKey(articleId);
int flag = grassArticleDao.deleteById(articleId);
logger.info("after deleteArticle,flag is {},articleId is {}",flag,articleId);
if(flag == 0){
return;
}
grassArticleBlockDao.deleteByArticleId(articleId);
//记录删除日志
GrassArticleDeleteLog grassArticleDeleteLog = new GrassArticleDeleteLog(articleId,req.getAuthorizeAccount(), DateUtil.getCurrentTimeSeconds());
grassArticleDeleteLogDao.insertByGrassArticleDeleteLog(grassArticleDeleteLog);
//删除文章关联数据
grassArticleBlockDao.deleteRealByArticleId(articleId);
grassArticleCommentDao.deleteByDestIdAndColumnType(articleId,GrassArticleComment.ColumnType.ARTICLE.getValue());
grassArticlePraiseDao.deleteByArticleId(articleId);
userFavoriteArticleDao.deleteByArticleId(articleId);
grassArticleLabelDao.deleteByArticleId(articleId);
grassArticleProductDao.deleteByArticleId(articleId);
grassArticleProductDao.deleteRealByArticleId(articleId);
GrassArticleDeleteLog grassArticleDeleteLog = new GrassArticleDeleteLog(articleId,req.getAuthorizeAccount(), DateUtil.getCurrentTimeSeconds());
grassArticleDeleteLogDao.insertByGrassArticleDeleteLog(grassArticleDeleteLog);
//TODO 清空缓存,cdn啥的
GrassCacheReq cacheReq = new GrassCacheReq();
cacheReq.setClearCode(GrassCacheReq.CLEARCODE_ARTICLE);
cacheReq.setElementId(String.valueOf(articleId));
cacheReq.setUid(grassArticle.getAuthorUid());
grassRefreshCacheService.refreshGrassCache(cacheReq);
}
... ...
... ... @@ -39,13 +39,14 @@ public class GrassRefreshCacheServiceImpl implements IGrassRefreshCacheService{
public void run() {
String elementId = reqVO.getElementId();
int clearCode = reqVO.getClearCode();
int uid = reqVO.getUid();
try{
String url = apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode;
logger.info("start refreshGrassCache, url is: {}, elementId is {}, clearCode is {}", url, elementId, clearCode);
String url = apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode + "&uid=" + uid;
logger.info("start refreshGrassCache, url is: {}, elementId is {}, clearCode is {},uid is {}", url, elementId, clearCode, uid);
serviceCaller.get("app.clearGrassCache", url, null, String.class, null);
logger.info("success refreshGrassCache elementId is {}, clearCode is {}", elementId, clearCode);
logger.info("success refreshGrassCache elementId is {}, clearCode is {},uid is {}", elementId, clearCode, uid);
}catch (Exception e){
logger.info("fail refreshGrassCache, elementId is {}, clearCode is {}, error is {}", elementId, clearCode, e);
logger.info("fail refreshGrassCache, elementId is {}, clearCode is {},uid is {}, error is {}", elementId, clearCode, uid, e);
}
}
});
... ...