Authored by mali

收藏数目

... ... @@ -446,6 +446,14 @@ public class CacheService {
return aBoolean;
}
public void delUserSkuFavorate(Integer userId, Integer storageId){
if (null != storageId) {
yhRedisTemplate.delete(getSkuFavoriteFlagRedisKeyBuilder(userId, storageId));
}
yhRedisTemplate.delete(getSkuFavoriteRedisKeyBuilder(userId));
}
private String getSkuFacoriteValue(Integer storageId, BigDecimal price) {
StringBuilder sb = new StringBuilder();
sb.append(storageId).append(":").append(price);
... ...
... ... @@ -6,6 +6,7 @@ import com.yoho.tools.common.beans.ApiResponse;
import com.yohobuy.ufo.model.user.req.FavoriteSkuRequestVO;
import com.yohobuy.ufo.model.user.resp.FavoriteSkuResp;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.user.requestVO.FavoriteRequestVO;
import com.yohoufo.user.service.IFavoriteService;
... ... @@ -148,6 +149,22 @@ public class FavoriteSkuController {
}
/**
* 用户收藏商品数量num
* @param vo
* @return
* @throws ServiceException
* http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/?debug=XYZ&method=ufo.user.skuFavoriteNum&uid=500031120
*/
@IgnoreSession
@IgnoreSignature
@RequestMapping(params = "method=ufo.user.clearSkuFavoriteCache")
public ApiResponse clearSkuFavoriteCache(FavoriteSkuRequestVO vo) throws ServiceException {
logger.info("Begin call ufo.user.clearSkuFavoriteCache . with param is {}", vo);
favoriteSkuService.clearSkuFavoriteCache(vo.getUid(), vo.getStorageId());
return new ApiResponse.ApiResponseBuilder().data("success").build();
}
private void validateRequest(FavoriteSkuRequestVO vo, boolean checkStorage, boolean checkProduct) {
if (null == vo) {
logger.warn("validateRequest params is null");
... ...
... ... @@ -242,4 +242,8 @@ public class FavoriteSkuService {
});
return respList;
}
public void clearSkuFavoriteCache(Integer uid, Integer storageId) {
cacheService.delUserSkuFavorate(uid, storageId);
}
}
... ...