| @@ -1,3 +1,7 @@ | |||||
| ALTER TABLE `wx_game` | ALTER TABLE `wx_game` | ||||
| ADD COLUMN `play_credit_limit` int(11) NOT NULL DEFAULT -1 AFTER `award_limit`, | ADD COLUMN `play_credit_limit` int(11) NOT NULL DEFAULT -1 AFTER `award_limit`, | ||||
| ADD COLUMN `play_credit` int(11) AFTER `play_credit_limit`; | |||||
| 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`; | |||||
| @@ -33,5 +33,8 @@ public class WxGameActionLog extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | ||||
| private Date createTime; | private Date createTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "type") | |||||
| private Integer type; | |||||
| } | } | ||||
| @@ -10,4 +10,6 @@ public interface WxGameActionLogMapper extends CommonMapper<WxGameActionLog, Str | |||||
| List<WxGameActionLog> findList(WxGameActionLog wxGameActionLog); | List<WxGameActionLog> findList(WxGameActionLog wxGameActionLog); | ||||
| int getPlayCount(WxGameActionLog wxGameActionLog); | int getPlayCount(WxGameActionLog wxGameActionLog); | ||||
| int getAwardCount(WxGameActionLog wxGameActionLog); | int getAwardCount(WxGameActionLog wxGameActionLog); | ||||
| int getPlayCreditCount(WxGameActionLog wxGameActionLog); | |||||
| } | } | ||||
| @@ -155,18 +155,35 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| wxGameActionLog.setGameId(gameId); | wxGameActionLog.setGameId(gameId); | ||||
| int playLimit = wxGame.getPlayLimit(); | int playLimit = wxGame.getPlayLimit(); | ||||
| int playCreditLimit = wxGame.getPlayCreditLimit(); | |||||
| int playCredit = wxGame.getPlayCredit(); | |||||
| int AwardLimit = wxGame.getAwardLimit(); | int AwardLimit = wxGame.getAwardLimit(); | ||||
| int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog); | int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog); | ||||
| int playCreditCount = wxGameActionLogMapper.getPlayCreditCount(wxGameActionLog); | |||||
| int AwardCount = wxGameActionLogMapper.getAwardCount(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<String,Object> map = new HashMap(); | Map<String,Object> 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); | map.put("playAble",playAble); | ||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| @@ -9,10 +9,12 @@ | |||||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | <result column="user_id" jdbcType="BIGINT" property="userId" /> | ||||
| <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" /> | <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" /> | ||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `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` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -60,6 +62,11 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -121,6 +128,10 @@ | |||||
| and `end_time` <= #{endTime} | and `end_time` <= #{endTime} | ||||
| </if> | </if> | ||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| </sql> | </sql> | ||||
| @@ -128,6 +139,13 @@ | |||||
| <select id="getPlayCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog"> | <select id="getPlayCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog"> | ||||
| select COUNT(*) FROM wx_game_action_log a | select COUNT(*) FROM wx_game_action_log a | ||||
| <include refid="dynamicCountWhereConditions" /> | <include refid="dynamicCountWhereConditions" /> | ||||
| and `type` = 0 | |||||
| </select> | |||||
| <select id="getPlayCreditCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog"> | |||||
| select COUNT(*) FROM wx_game_action_log a | |||||
| <include refid="dynamicCountWhereConditions" /> | |||||
| and `type` = 1 | |||||
| </select> | </select> | ||||
| <select id="getAwardCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog"> | <select id="getAwardCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog"> | ||||
| @@ -13,10 +13,13 @@ | |||||
| <result column="triggle_action" jdbcType="INTEGER" property="triggleAction" /> | <result column="triggle_action" jdbcType="INTEGER" property="triggleAction" /> | ||||
| <result column="play_limit" jdbcType="INTEGER" property="playLimit" /> | <result column="play_limit" jdbcType="INTEGER" property="playLimit" /> | ||||
| <result column="award_limit" jdbcType="INTEGER" property="awardLimit" /> | <result column="award_limit" jdbcType="INTEGER" property="awardLimit" /> | ||||
| <result column="play_credit_limit" jdbcType="INTEGER" property="playCreditLimit" /> | |||||
| <result column="play_credit" jdbcType="INTEGER" property="playCredit" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`game_id`,`status`,`coupon_ids`,`valid_start_date`,`valid_end_date`,`triggle_action`,`play_limit`,`award_limit` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`game_id`,`status`,`coupon_ids`,`valid_start_date`,`valid_end_date`,`triggle_action`,`play_limit`,`award_limit`,`play_credit_limit`,`play_credit` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||