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

Commit 1e90b55c authored by zhengfuxin's avatar zhengfuxin

增加购物车功能

parent 59caa1e4
...@@ -70,6 +70,7 @@ public class GoblinRedisConst { ...@@ -70,6 +70,7 @@ public class GoblinRedisConst {
public static final String COMPLIATIONS = PREFIX.concat("goblinFrontCompilations"); // 合集 public static final String COMPLIATIONS = PREFIX.concat("goblinFrontCompilations"); // 合集
public static final String FRONT_GOBLINFRONTCUBE = PREFIX.concat("goblinFrontCube"); // 魔方 public static final String FRONT_GOBLINFRONTCUBE = PREFIX.concat("goblinFrontCube"); // 魔方
public static final String FRONT_SHOPCART = PREFIX.concat("goblin_shopcart:"); // 购物车 public static final String FRONT_SHOPCART = PREFIX.concat("goblin_shopcart:"); // 购物车
public static final String FRONT_SHOPCART_TWO = PREFIX.concat("goblin_shopcartTwo:"); // 购物车第二部
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
......
...@@ -107,4 +107,8 @@ public class GoblinFrontController { ...@@ -107,4 +107,8 @@ public class GoblinFrontController {
} }
...@@ -42,17 +42,30 @@ public class GoblinFrontLoginController { ...@@ -42,17 +42,30 @@ public class GoblinFrontLoginController {
@GetMapping("getShopCartCount") @GetMapping("getShopCartCount")
@ApiOperation("获取商品数量") @ApiOperation("获取购物车数量")
public ResponseDto getShopCartCount() { public ResponseDto getShopCartCount() {
String userId=CurrentUtil.getCurrentUid(); String userId=CurrentUtil.getCurrentUid();
return ResponseDto.success(goblinFrontService.getShopCartCount(userId)); return ResponseDto.success(goblinFrontService.getShopCartCount(userId));
} }
@PostMapping("deleteShopCart") @PostMapping("deleteShopCart")
@ApiOperation("删除商品") @ApiOperation("删除购物车")
public ResponseDto deleteShopCart(String skuIds) { public ResponseDto deleteShopCart(String skuIds) {
String userId=CurrentUtil.getCurrentUid(); String userId=CurrentUtil.getCurrentUid();
return ResponseDto.success(goblinFrontService.delteShoppingCart(skuIds.split(","),userId)); return ResponseDto.success(goblinFrontService.delteShoppingCart(skuIds.split(","),userId));
} }
@PostMapping("saveData")
@ApiOperation("保存数据购物车过度")
public ResponseDto saveData(String data) {
String userId=CurrentUtil.getCurrentUid();
return ResponseDto.success(goblinFrontService.saveDate(data,userId));
}
@PostMapping("getData")
@ApiOperation("获得购物车过度")
public ResponseDto getData() {
String userId=CurrentUtil.getCurrentUid();
return ResponseDto.success(goblinFrontService.getDate(userId));
}
@GetMapping("getShopCart") @GetMapping("getShopCart")
@ApiOperation("获得购物车列表") @ApiOperation("获得购物车列表")
......
...@@ -624,6 +624,21 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -624,6 +624,21 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
} }
return count; return count;
} }
/***
* @author zhangfuxin
* @Description:存储信息
* @date 2022/1/17 下午4:55
*/
public boolean saveDate(String data,String userId) {
redisUtil.set(GoblinRedisConst.FRONT_SHOPCART_TWO.concat(userId),data,60*60*24);
return true;
}
public String getDate(String userId) {
if(redisUtil.get(GoblinRedisConst.FRONT_SHOPCART_TWO.concat(userId))==null){
return "";
}
return (String) redisUtil.get(GoblinRedisConst.FRONT_SHOPCART_TWO.concat(userId));
}
/** /**
* 删除购物车里面的商品 * 删除购物车里面的商品
*/ */
......
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