|
@ -86,25 +86,30 @@ public class BehaviorApi {
|
|
vo.setUserType(userType);
|
|
vo.setUserType(userType);
|
|
vo.setcName(cName);
|
|
vo.setcName(cName);
|
|
vo.setUserId(userId);
|
|
vo.setUserId(userId);
|
|
ArticleStatistic arvo = new ArticleStatistic();
|
|
|
|
arvo.setArticleId(articleId);
|
|
|
|
|
|
// ArticleStatistic arvo = new ArticleStatistic();
|
|
|
|
// arvo.setArticleId(articleId);
|
|
try {
|
|
try {
|
|
|
|
|
|
subDao.saveArticleCollection(vo);
|
|
|
|
// if (userType == 2) {
|
|
|
|
|
|
int size = subDao.getArticleCollection(vo);
|
|
|
|
if(size==0){
|
|
|
|
subDao.saveArticleCollection(vo);
|
|
int behaviorAction = 6;
|
|
int behaviorAction = 6;
|
|
int number = 1;
|
|
int number = 1;
|
|
ArticleApi.updateArticleStatistic(articleId, behaviorAction, number);
|
|
ArticleApi.updateArticleStatistic(articleId, behaviorAction, number);
|
|
|
|
Behavior behavior = new Behavior();
|
|
|
|
behavior.setArticleId(articleId);
|
|
|
|
behavior.setBehaviorAction(behaviorAction);
|
|
|
|
behavior.setcName(cName);
|
|
|
|
behavior.setUserId(userId);
|
|
|
|
// arvo.setArticleId(articleId);
|
|
|
|
subDao.saveBehavior(behavior);
|
|
|
|
}
|
|
|
|
// if (userType == 2) {
|
|
|
|
|
|
// }
|
|
// }
|
|
|
|
|
|
Behavior behavior = new Behavior();
|
|
|
|
behavior.setArticleId(articleId);
|
|
|
|
behavior.setBehaviorAction(behaviorAction);
|
|
|
|
behavior.setcName(cName);
|
|
|
|
behavior.setUserId(userId);
|
|
|
|
|
|
|
|
// ArticleStatistic arvo = new ArticleStatistic();
|
|
// ArticleStatistic arvo = new ArticleStatistic();
|
|
arvo.setArticleId(articleId);
|
|
|
|
subDao.saveBehavior(behavior);
|
|
|
|
|
|
|
|
|
|
|
|
return ApiUtil.getRespJSON(10000, "成功").toString();
|
|
return ApiUtil.getRespJSON(10000, "成功").toString();
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
@ -140,16 +145,21 @@ public class BehaviorApi {
|
|
arvo.setArticleId(articleId);
|
|
arvo.setArticleId(articleId);
|
|
|
|
|
|
try {
|
|
try {
|
|
int count = subDao.deleteArticleCollection(vo);
|
|
|
|
|
|
|
|
// if (userType == 2) {
|
|
|
|
int behaviorAction = 6;
|
|
|
|
int number = -1;
|
|
|
|
ArticleApi.updateArticleStatistic(articleId, behaviorAction, number);
|
|
|
|
// }
|
|
|
|
if (count == 0) {
|
|
|
|
return ApiUtil.getRespJSON(-10001, "收藏失败").toString();
|
|
|
|
|
|
int size = subDao.getArticleCollection(vo);
|
|
|
|
if(size>0){
|
|
|
|
int count = subDao.deleteArticleCollection(vo);
|
|
|
|
// if (userType == 2) {
|
|
|
|
|
|
|
|
// }
|
|
|
|
if (count > 0) {
|
|
|
|
int behaviorAction = 6;
|
|
|
|
int number = -1;
|
|
|
|
ArticleApi.updateArticleStatistic(articleId, behaviorAction, number);
|
|
|
|
}else{
|
|
|
|
return ApiUtil.getRespJSON(-10001, "收藏失败").toString();
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return ApiUtil.getRespJSON(10000, "成功").toString();
|
|
return ApiUtil.getRespJSON(10000, "成功").toString();
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|