xhxu 5 лет назад
Родитель
Сommit
0df96c6bb6
6 измененных файлов: 56 добавлений и 9 удалений
  1. +5
    -1
      mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql
  2. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java
  4. +23
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  5. +19
    -1
      mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml
  6. +4
    -1
      mallinkService/src/main/resources/mapper/WxGameMapper.xml

+ 5
- 1
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`;
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`;

+ 3
- 0
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;


}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java Просмотреть файл

@@ -10,4 +10,6 @@ public interface WxGameActionLogMapper extends CommonMapper<WxGameActionLog, Str
List<WxGameActionLog> findList(WxGameActionLog wxGameActionLog);
int getPlayCount(WxGameActionLog wxGameActionLog);
int getAwardCount(WxGameActionLog wxGameActionLog);

int getPlayCreditCount(WxGameActionLog wxGameActionLog);
}

+ 23
- 6
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<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);
return new ResultData(map);
}


+ 19
- 1
mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml Просмотреть файл

@@ -9,10 +9,12 @@
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />

<result column="type" jdbcType="INTEGER" property="type" />
</resultMap>
<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 id="dynamicWhereConditions">
@@ -60,6 +62,11 @@

</if>

<if test=" null != type ">
and `type` = #{type}

</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -121,6 +128,10 @@
and `end_time` &lt;= #{endTime}

</if>
<if test=" null != type ">
and `type` = #{type}

</if>


</sql>
@@ -128,6 +139,13 @@
<select id="getPlayCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog">
select COUNT(*) FROM wx_game_action_log a
<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 id="getAwardCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog">


+ 4
- 1
mallinkService/src/main/resources/mapper/WxGameMapper.xml Просмотреть файл

@@ -13,10 +13,13 @@
<result column="triggle_action" jdbcType="INTEGER" property="triggleAction" />
<result column="play_limit" jdbcType="INTEGER" property="playLimit" />
<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>
<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 id="dynamicWhereConditions">


Загрузка…
Отмена
Сохранить