|
|
|
@@ -425,12 +425,13 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
if(couponIdsList != null || couponIdsList.size() > 0){ |
|
|
|
for (Object a:couponIdsList) { |
|
|
|
int weight = 0; |
|
|
|
if(a instanceof Map){ |
|
|
|
Map map = (Map) a; |
|
|
|
weight = (int) map.get("weight"); |
|
|
|
}else if(a instanceof WxCouponChannelVo){ |
|
|
|
if(a instanceof WxCouponChannelVo){ |
|
|
|
WxCouponChannelVo vo = (WxCouponChannelVo) a; |
|
|
|
weight = vo.getGameWeight(); |
|
|
|
}else if(a instanceof JSONObject){ |
|
|
|
JSONObject map = (JSONObject) a; |
|
|
|
Integer w = map.getInteger("weight"); |
|
|
|
weight = (w==null?0:w); |
|
|
|
} |
|
|
|
y += weight; |
|
|
|
if(x <= y){ |
|
|
|
@@ -443,12 +444,25 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
Long orderId = 0L; |
|
|
|
Integer addCredit = 0; |
|
|
|
if(data != null){ |
|
|
|
if(data instanceof Map){ |
|
|
|
Map dataMap = (Map) data; |
|
|
|
if(data instanceof WxCouponChannelVo){ |
|
|
|
WxCouponChannelVo vo = (WxCouponChannelVo) data; |
|
|
|
OrderSaveDto orderSaveDto = new OrderSaveDto(); |
|
|
|
orderSaveDto.setCouponChannelId(vo.getId()); |
|
|
|
orderSaveDto.setCouponId(vo.getCouponId()); |
|
|
|
ResultData resultData1 = wxOrderService.saveOrder(orderSaveDto, userId, EnumPayWay.PAY_WAY_WECHAT, wxGame); |
|
|
|
|
|
|
|
if(resultData1.code == Result.SUCCESS && resultData1.data != null && resultData1.data instanceof WxOrder){ |
|
|
|
WxOrder order = (WxOrder)resultData1.data; |
|
|
|
orderId = order.getId(); |
|
|
|
}else{ |
|
|
|
resultData.data = null; |
|
|
|
} |
|
|
|
}else if(data instanceof JSONObject){ |
|
|
|
JSONObject dataMap = (JSONObject) data; |
|
|
|
// Integer prizeType = (Integer) dataMap.get("prizeType"); |
|
|
|
// if(prizeType != null && prizeType == 0){ |
|
|
|
Integer credit = (Integer) dataMap.get("credit"); |
|
|
|
if(credit > 0){ |
|
|
|
Integer credit = dataMap.getInteger("credit"); |
|
|
|
if(credit != null && credit > 0){ |
|
|
|
WxCreditHistory wxCreditHistory = new WxCreditHistory(); |
|
|
|
wxCreditHistory.setTenantId(wxGame.getFinalTenantId()); |
|
|
|
wxCreditHistory.setCUserId(userId); |
|
|
|
@@ -466,19 +480,6 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
}else if(data instanceof WxCouponChannelVo){ |
|
|
|
WxCouponChannelVo vo = (WxCouponChannelVo) data; |
|
|
|
OrderSaveDto orderSaveDto = new OrderSaveDto(); |
|
|
|
orderSaveDto.setCouponChannelId(vo.getId()); |
|
|
|
orderSaveDto.setCouponId(vo.getCouponId()); |
|
|
|
ResultData resultData1 = wxOrderService.saveOrder(orderSaveDto, userId, EnumPayWay.PAY_WAY_WECHAT, wxGame); |
|
|
|
|
|
|
|
if(resultData1.code == Result.SUCCESS && resultData1.data != null && resultData1.data instanceof WxOrder){ |
|
|
|
WxOrder order = (WxOrder)resultData1.data; |
|
|
|
orderId = order.getId(); |
|
|
|
}else{ |
|
|
|
resultData.data = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|