记得上下班打卡 | git大法好,push需谨慎

Commit 786288f7 authored by 胡佳晨's avatar 胡佳晨

添加 spu销量

parent f7cc325a
...@@ -64,6 +64,7 @@ public class GoblinRedisConst { ...@@ -64,6 +64,7 @@ public class GoblinRedisConst {
public static final String REDIS_GOBLIN_BUY_COUNT = PREFIX.concat("uid:");//用户sku购买数量 key:uid:skuId:$skuId public static final String REDIS_GOBLIN_BUY_COUNT = PREFIX.concat("uid:");//用户sku购买数量 key:uid:skuId:$skuId
public static final String REDIS_GOBLIN_SALE_COUNT = PREFIX.concat("sale:skuId:");//用户sku购买数量 key:sale:skuId:$skuId public static final String REDIS_GOBLIN_SALE_COUNT = PREFIX.concat("sale:skuId:");//用户sku购买数量 key:sale:skuId:$skuId
public static final String REDIS_GOBLIN_SALE_SPU_COUNT = PREFIX.concat("sale:skuId:");//用户sku购买数量 key:sale:skuId:$spuId
public static final String REDIS_GOBLIN_ORDER = PREFIX.concat("order:");//用户sku购买数量 key:$orderId public static final String REDIS_GOBLIN_ORDER = PREFIX.concat("order:");//用户sku购买数量 key:$orderId
public static final String REDIS_GOBLIN_ORDER_BACK = PREFIX.concat("order:back:");//用户sku购买数量 key:$backOrderId public static final String REDIS_GOBLIN_ORDER_BACK = PREFIX.concat("order:back:");//用户sku购买数量 key:$backOrderId
public static final String REDIS_GOBLIN_ORDER_SKU = PREFIX.concat("orderSku:");//用户sku购买数量 key:$orderSkuId public static final String REDIS_GOBLIN_ORDER_SKU = PREFIX.concat("orderSku:");//用户sku购买数量 key:$orderSkuId
......
...@@ -495,6 +495,29 @@ public class GoblinRedisUtils { ...@@ -495,6 +495,29 @@ public class GoblinRedisUtils {
return (int) redisUtil.decr(redisKey, number); return (int) redisUtil.decr(redisKey, number);
} }
//获取 spu销量
public Integer getSpuSaleCount(String spuId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_SPU_COUNT.concat(spuId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
} else {
return (Integer) obj;
}
}
// 增加 spu销量
public int incrSpuSaleCount(String spuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_SPU_COUNT.concat(spuId);
return (int) redisUtil.incr(redisKey, number);
}
// 减少 spu销量
public int decrSpuSaleCount(String spuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_SPU_COUNT.concat(spuId);
return (int) redisUtil.decr(redisKey, number);
}
// 赋值 订单相关vo // 赋值 订单相关vo
public void setGoblinOrder(String orderId, GoblinStoreOrderVo vo) { public void setGoblinOrder(String orderId, GoblinStoreOrderVo vo) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER.concat(orderId); String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER.concat(orderId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment