diff --git a/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql b/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql index 6b9a69505..2bdcb8ce7 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql @@ -1,3 +1,7 @@ ALTER TABLE `wx_game` ADD COLUMN `play_credit_limit` int(11) NOT NULL DEFAULT -1 AFTER `award_limit`, -ADD COLUMN `play_credit` int(11) AFTER `play_credit_limit`; \ No newline at end of file +ADD COLUMN `play_credit` int(11) AFTER `play_credit_limit`; + + +ALTER TABLE `wx_game_action_log` +ADD COLUMN `type` int(11) NOT NULL DEFAULT 0 AFTER `create_time`; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java b/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java index 3ca496830..ee963434c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java @@ -33,5 +33,8 @@ public class WxGameActionLog extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="",name="createTime") private Date createTime; + @io.swagger.annotations.ApiModelProperty(value = "", name = "type") + private Integer type; + } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java index c5e778152..2521c0d7d 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java @@ -10,4 +10,6 @@ public interface WxGameActionLogMapper extends CommonMapper findList(WxGameActionLog wxGameActionLog); int getPlayCount(WxGameActionLog wxGameActionLog); int getAwardCount(WxGameActionLog wxGameActionLog); + + int getPlayCreditCount(WxGameActionLog wxGameActionLog); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index cf9a7c49b..247a3f493 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -155,18 +155,35 @@ public class WxGameServiceImpl implements WxGameService { wxGameActionLog.setGameId(gameId); int playLimit = wxGame.getPlayLimit(); + int playCreditLimit = wxGame.getPlayCreditLimit(); + int playCredit = wxGame.getPlayCredit(); int AwardLimit = wxGame.getAwardLimit(); int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog); + int playCreditCount = wxGameActionLogMapper.getPlayCreditCount(wxGameActionLog); int AwardCount = wxGameActionLogMapper.getAwardCount(wxGameActionLog); - boolean playAble = !(( playLimit != 0 && playCount >= playLimit) - || (AwardLimit != 0 && AwardCount >= AwardLimit)); +// boolean playAble = !(( playLimit != 0 && playCount >= playLimit) +// || (AwardLimit != 0 && AwardCount >= AwardLimit)); Map map = new HashMap(); - map.put("playLimit",playLimit); - map.put("AwardLimit",AwardLimit); - map.put("playCount",playCount); - map.put("AwardCount",AwardCount); + map.put("playLimit",playLimit);//免费次数限制(为0是不限制次数,为-1是不能玩) + map.put("playCreditLimit",playCreditLimit);//消耗积分次数限制(为0是不限制次数,为-1是不能玩) + map.put("playCredit",playCredit);//消耗积分数量 + map.put("AwardLimit",AwardLimit);//中奖次数限制(为0是不限制次数) + map.put("playCount",playCount);//当前玩的免费次数 + map.put("playCreditCount",playCreditCount);//当前玩的消耗积分次数 + map.put("AwardCount",AwardCount);//当前中奖次数 + + boolean playAble = true; + if(AwardLimit != 0 && AwardCount >= AwardLimit){//中奖次数没了,不能完了 + playAble = false; + } + if((playLimit > 0 && playCount >= playLimit) || playLimit < 0){//免费不能玩了 + if((playCreditLimit > 0 && playCreditCount >= playCreditLimit) || playCreditLimit < 0){//积分不能玩了 + playAble = false; + } + } + map.put("playAble",playAble); return new ResultData(map); } diff --git a/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml index 92227598a..7a38cc6f2 100644 --- a/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml @@ -9,10 +9,12 @@ + + - `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time` + `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`,`type` @@ -60,6 +62,11 @@ + + and `type` = #{type} + + + and id in @@ -121,6 +128,10 @@ and `end_time` <= #{endTime} + + and `type` = #{type} + + @@ -128,6 +139,13 @@ + +