| | |
| | | return AjaxResult.ok(goodsService.pageList1(basePage)); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "兑换商品") |
| | | @PostMapping(value = "/app/shop") |
| | | public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | | //查询当前商品信息 |
| | | TGoods good = goodsService.getById(exchangeDto.getGoodId()); |
| | | |
| | | //检查当前用户积分是否够 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | | //检查当前用户是否到达兑换上限 |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId).getData(); |
| | | if (good.getLimitExchangeTimes()!=-1&&count>=good.getLimitExchangeTimes()){ |
| | | return AjaxResult.error("当前用户已到达兑换上限"); |
| | | } |
| | | //生成积分兑换成功的订单 |
| | | orderClient.exchangeCreate(exchangeDto); |
| | | |
| | | //如果是优惠卷,赠送优惠卷给用户 |
| | | |
| | | |
| | | |
| | | |
| | | //生成消耗积分的记录 |
| | | |
| | | |
| | | } |
| | | // @ApiOperation(tags = {"小程序-兑换商城"},value = "兑换商品") |
| | | // @PostMapping(value = "/app/shop") |
| | | // public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | | // //查询当前商品信息 |
| | | // TGoods good = goodsService.getById(exchangeDto.getGoodId()); |
| | | // |
| | | // //检查当前用户积分是否够 |
| | | // Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | // if (user.getPoints()<good.getRedeemPoints()){ |
| | | // return AjaxResult.error("当前用户积分不足"); |
| | | // } |
| | | // //检查当前用户是否到达兑换上限 |
| | | // Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId).getData(); |
| | | // if (good.getLimitExchangeTimes()!=-1&&count>=good.getLimitExchangeTimes()){ |
| | | // return AjaxResult.error("当前用户已到达兑换上限"); |
| | | // } |
| | | // //生成积分兑换成功的订单 |
| | | //// orderClient.exchangeCreate(exchangeDto); |
| | | // |
| | | // //如果是优惠卷,赠送优惠卷给用户 |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // //生成消耗积分的记录 |
| | | // |
| | | // |
| | | // } |
| | | |
| | | |
| | | /** |