修复商品收藏后无法取消,修复取消后无法再次收藏的问题
This commit is contained in:
@ -43,7 +43,7 @@ public interface YxStoreProductRelationService extends BaseService<YxStoreProduc
|
||||
* @param productId 商品id
|
||||
* @param uid 用户id
|
||||
*/
|
||||
void addRroductRelation(long productId,long uid);
|
||||
void addRroductRelation(long productId,long uid,String category);
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
|
@ -78,12 +78,13 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
||||
* @param uid 用户id
|
||||
*/
|
||||
@Override
|
||||
public void addRroductRelation(long productId,long uid) {
|
||||
public void addRroductRelation(long productId,long uid,String category) {
|
||||
if(isProductRelation(productId,uid)) {
|
||||
throw new YshopException("已收藏");
|
||||
}
|
||||
YxStoreProductRelation storeProductRelation = YxStoreProductRelation.builder()
|
||||
.productId(productId)
|
||||
.category(category)
|
||||
.uid(uid)
|
||||
.type("collect")
|
||||
.build();
|
||||
@ -100,7 +101,7 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
||||
YxStoreProductRelation productRelation = this.lambdaQuery()
|
||||
.eq(YxStoreProductRelation::getProductId,productId)
|
||||
.eq(YxStoreProductRelation::getUid,uid)
|
||||
.eq(YxStoreProductRelation::getType,category)
|
||||
.eq(YxStoreProductRelation::getCategory,category)
|
||||
.one();
|
||||
if(productRelation == null) {
|
||||
throw new YshopException("已取消");
|
||||
|
Reference in New Issue
Block a user