xhxu 5 лет назад
Родитель
Сommit
c53f26f139
3 измененных файлов: 39 добавлений и 25 удалений
  1. +8
    -7
      mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java
  2. +22
    -18
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  3. +9
    -0
      mallinkService/src/main/java/com/iformall/utils/Constant.java

+ 8
- 7
mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java Просмотреть файл

@@ -6,6 +6,7 @@ import com.iformall.domain.po.*;
import com.iformall.enums.EnumGameStatus;
import com.iformall.service.WxCouponOrderService;
import com.iformall.service.WxGameService;
import com.iformall.utils.Constant;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -105,16 +106,16 @@ public class WxGameController extends BaseController {
return new ResultData(ErrorCode.GAME_NOT_FOUND);
}
int playLimit = (int) data.get("playLimit");
if(playLimit < 0){
if(playLimit < Constant.limit){
return new ResultData(ErrorCode.GAME_NOT_COUNT);
}
int AwardLimit = (int) data.get("AwardLimit");
int AwardCount = (int) data.get("AwardCount");
if(AwardLimit != 0 && AwardCount >= AwardLimit){
if(AwardLimit != Constant.limit && AwardCount >= AwardLimit){
return new ResultData(ErrorCode.GAME_NOT_WIN_COUNT);
}
int playCount = (int) data.get("playCount");
if((playLimit > 0 && playCount >= playLimit) || playLimit < 0){
if((playLimit > Constant.limit && playCount >= playLimit) || playLimit == Constant.notLimit){
return new ResultData(ErrorCode.GAME_NOT_HAVE_COUNT);
}
ResultData resultData = wxGameService.luckDraw(gameIdL, getMemberId(),0);
@@ -141,19 +142,19 @@ public class WxGameController extends BaseController {
return new ResultData(ErrorCode.GAME_NOT_FOUND);
}
int playLimit = (int) data.get("playLimit");
if(playLimit < 0){
if(playLimit < Constant.limit){
return new ResultData(ErrorCode.GAME_NOT_COUNT);
}
int AwardLimit = (int) data.get("AwardLimit");
int AwardCount = (int) data.get("AwardCount");
if(AwardLimit != 0 && AwardCount >= AwardLimit){
if(AwardLimit != Constant.limit && AwardCount >= AwardLimit){
return new ResultData(ErrorCode.GAME_NOT_WIN_COUNT);
}
int playCount = (int) data.get("playCount");
if((playLimit > 0 && playCount >= playLimit) || playLimit < 0){
if((playLimit > Constant.limit && playCount >= playLimit) || playLimit == Constant.notLimit){
int playCreditLimit = (int) data.get("playCreditLimit");
int playCreditCount = (int) data.get("playCreditCount");
if((playCreditLimit > 0 && playCreditCount >= playCreditLimit) || playCreditLimit < 0){//积分不能玩了
if((playCreditLimit > Constant.limit && playCreditCount >= playCreditLimit) || playCreditLimit == Constant.notLimit){//积分不能玩了
return new ResultData(ErrorCode.GAME_NOT_HAVEC_COUNT);
}
}else{


+ 22
- 18
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Просмотреть файл

@@ -157,7 +157,7 @@ public class WxGameServiceImpl implements WxGameService {


WxGameActionLog wxGameActionLog = new WxGameActionLog();
if(wxGame.getLimitType().equals(1)){//每天
if(wxGame.getLimitType().equals(Constant.limitType)){//每天
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
@@ -197,11 +197,11 @@ public class WxGameServiceImpl implements WxGameService {
map.put("AwardCount",AwardCount);//当前中奖次数

boolean playAble = true;
if(AwardLimit != 0 && AwardCount >= AwardLimit){//中奖次数没了,不能完了
if(AwardLimit != Constant.limit && AwardCount >= AwardLimit){//中奖次数没了,不能完了
playAble = false;
}
if((playLimit > 0 && playCount >= playLimit) || playLimit < 0){//免费不能玩了
if((playCreditLimit > 0 && playCreditCount >= playCreditLimit) || playCreditLimit < 0){//积分不能玩了
if((playLimit > Constant.limit && playCount >= playLimit) || playLimit == Constant.notLimit){//免费不能玩了
if((playCreditLimit > Constant.limit && playCreditCount >= playCreditLimit) || playCreditLimit == Constant.notLimit){//积分不能玩了
playAble = false;
}
}
@@ -231,15 +231,16 @@ public class WxGameServiceImpl implements WxGameService {
List couponIdsList = new ArrayList();
JSONArray couponChannelIds = JSON.parseArray(record.getCouponIds());
ValueOperations<String, WxCouponCVo> operations = cdRedisTemplate.opsForValue();
for(int i=0; i<couponChannelIds.size();i++) {
for(int i = 0; i<couponChannelIds.size();i++) {
JSONObject couponChanObj = (JSONObject) couponChannelIds.get(i);
Integer type = couponChanObj.getInteger("prizeType");
if(type != null && type == 0){
Integer prizeType = couponChanObj.getInteger("prizeType");
if(prizeType != null && prizeType == Constant.creditPlayType){
Map<String,Object> map = new HashMap<>();
map.put("prizeType",0);
map.put("prizeType",Constant.creditPlayType);
map.put("gameWeight",couponChanObj.getInteger("weight"));
map.put("credit",couponChanObj.getInteger("credit"));
map.put("couponId",couponChanObj.getLong("couponId"));
map.put("id",couponChanObj.getInteger("id"));
// map.put("couponId",couponChanObj.getLong("couponId"));
couponIdsList.add(map);
}else{
Long couponId = couponChanObj.getLong("couponId");
@@ -327,14 +328,17 @@ public class WxGameServiceImpl implements WxGameService {
// 上架 couponChannel 更新
for(int i=0; i<couponIds.size();i++) {
JSONObject obj = (JSONObject)couponIds.get(i);
Long couponId = obj.getLong("couponId");
int weight = obj.getIntValue("weight");
try {
if(couponId != null){
saveOrUpdateCouponChannel(couponId, wxCouponChannelsMap, record);
Integer prizeType = obj.getInteger("prizeType");
if(prizeType == null || prizeType != Constant.creditPlayType){
Long couponId = obj.getLong("couponId");
int weight = obj.getIntValue("weight");
try {
if(couponId != null){
saveOrUpdateCouponChannel(couponId, wxCouponChannelsMap, record);
}
} catch (MallinkException e) {
logger.error(e.getMessage());
}
} catch (MallinkException e) {
logger.error(e.getMessage());
}
}

@@ -457,7 +461,7 @@ public class WxGameServiceImpl implements WxGameService {
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ;
wxCreditHistoryService.saveOrUpdate(wxCreditHistory);
addCredit = credit;
orderId = -1L;
orderId = Constant.creditPlayOrderIdTab;
}
resultData.data = null;
// }
@@ -487,7 +491,7 @@ public class WxGameServiceImpl implements WxGameService {
wxGameActionLog.setCreateTime(new Date());
wxGameActionLog.setUsedCredit(userCredit);
if(userCredit > 0){
wxGameActionLog.setType(1);
wxGameActionLog.setType(Constant.creditPlayType);
}
wxGameActionLog.setCouponOrderId(orderId);
wxGameActionLog.setAddCredit(addCredit);


+ 9
- 0
mallinkService/src/main/java/com/iformall/utils/Constant.java Просмотреть файл

@@ -10,6 +10,15 @@ public class Constant {

public static final int WX_LIMIT_DAYS = 30; // 微信分账限制30天

//游戏常量
public static final int limit = 0;//游戏玩法不限次数
public static final int notLimit = -1;//游戏玩法不限能玩

public static final int creditPlayType = 1;//积分玩法类型
public static final Long creditPlayOrderIdTab = -1L;//积分中奖 orderId标识

public static final int limitType = 1;//游戏玩法次数类型 表示每天的次数

// 前端未初始常量
public static final String UNDEFINED = "undefined";



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