|
|
|
@@ -13,6 +13,7 @@ import com.iformall.enums.EnumCouponStatus; |
|
|
|
import com.iformall.enums.EnumGameStatus; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.WxCouponChannelMapper; |
|
|
|
import com.iformall.mapper.WxCouponOrderMapper; |
|
|
|
import com.iformall.mapper.WxGameActionLogMapper; |
|
|
|
import com.iformall.service.WxCouponChannelService; |
|
|
|
import com.iformall.service.WxCouponService; |
|
|
|
@@ -43,6 +44,9 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
@Autowired |
|
|
|
WxCouponService wxCouponService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponOrderMapper wxCouponOrderMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponChannelService wxCouponChannelService; |
|
|
|
|
|
|
|
@@ -82,11 +86,31 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void addActionLog(WxGameActionLog wxGameActionLog) { |
|
|
|
public ResultData addActionLog(Long userId, Long gameId, Long orderId) { |
|
|
|
|
|
|
|
WxCouponOrder wxCouponOrder = new WxCouponOrder(); |
|
|
|
wxCouponOrder.setcUserId(userId); |
|
|
|
wxCouponOrder.setOrderId(orderId); |
|
|
|
|
|
|
|
try { |
|
|
|
wxCouponOrder = wxCouponOrderMapper.selectOne(wxCouponOrder); |
|
|
|
} catch (Exception e){ |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
if (wxCouponOrder == null) |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
|
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
WxGameActionLog wxGameActionLog = new WxGameActionLog(); |
|
|
|
wxGameActionLog.setUserId(userId); |
|
|
|
wxGameActionLog.setTenantId(wxCouponOrder.getTenantId()); |
|
|
|
wxGameActionLog.setGameId(gameId); |
|
|
|
wxGameActionLog.setCouponOrderId(wxCouponOrder.getOrderId()); |
|
|
|
wxGameActionLog.setId(idWorker.nextId()); |
|
|
|
wxGameActionLog.setCreateTime(new Date()); |
|
|
|
wxGameActionLogMapper.insertSelective(wxGameActionLog); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@@ -107,13 +131,13 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
int AwardCount = wxGameActionLogMapper.getAwardCount(wxGameActionLog); |
|
|
|
|
|
|
|
if ( playLimit != 0 |
|
|
|
&& playCount > playLimit) |
|
|
|
return new ResultData(ErrorCode.GAME_PLAY_HAS_BEEN_LIMITED,playCount - playLimit ); |
|
|
|
&& playCount >= playLimit) |
|
|
|
return new ResultData(ErrorCode.GAME_PLAY_HAS_BEEN_LIMITED, playLimit - playCount); |
|
|
|
|
|
|
|
if (AwardLimit != 0 |
|
|
|
&& AwardCount > AwardLimit) |
|
|
|
return new ResultData(ErrorCode.GAME_AWARD_HAS_BEEN_LIMITED,AwardCount - AwardLimit); |
|
|
|
return new ResultData(playCount - playLimit); |
|
|
|
&& AwardCount >= AwardLimit) |
|
|
|
return new ResultData(ErrorCode.GAME_AWARD_HAS_BEEN_LIMITED,AwardLimit - AwardCount); |
|
|
|
return new ResultData(playLimit - playCount); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|