Browse Source

改下配置

master
nili 5 months ago
parent
commit
aa609d56b8
  1. 16
      game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java
  2. 29
      game-service/src/main/java/awesome/group/game/service/bo/citrus/AppBasicInfo.java
  3. 40
      game-service/src/main/java/awesome/group/game/service/bo/citrus/AppCashConfig.java
  4. 30
      game-service/src/main/java/awesome/group/game/service/bo/matrix/AppNormalConfig.java
  5. 2
      game-service/src/main/java/awesome/group/game/service/citrus/AdvRecordService.java
  6. 3
      game-service/src/main/java/awesome/group/game/service/citrus/CitrusAppService.java
  7. 11
      game-service/src/main/java/awesome/group/game/service/citrus/UserService.java
  8. 15
      game-service/src/main/java/awesome/group/game/service/matrix/MatrixAppConfigService.java

16
game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java

@ -21,12 +21,12 @@ public class MatrixApp {
private String umeng;//友盟的配置数据 private String umeng;//友盟的配置数据
private String aliPay;//支付宝的配置数据 private String aliPay;//支付宝的配置数据
private String wx;//微信的配置数据 private String wx;//微信的配置数据
private String normalConfig;//提现门槛等配置
private String moneyLadder; // private String moneyLadder;
private Integer noAuditMoney; // private Integer noAuditMoney;
private String qqUrl; // private String qqUrl;
private Integer dayLimit;//每日提现次数限制 // private Integer dayLimit;//每日提现次数限制
private Integer maxIncomeEachVideo;//0正常,1停用 // private Integer maxIncomeEachVideo;
private String dayRates; // private String dayRates;
private Integer defaultRate; // private Integer defaultRate;
} }

29
game-service/src/main/java/awesome/group/game/service/bo/citrus/AppBasicInfo.java

@ -1,26 +1,33 @@
package awesome.group.game.service.bo.citrus; package awesome.group.game.service.bo.citrus;
import awesome.group.game.dao.bean.MatrixApp; import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.service.bo.matrix.AppNormalConfig;
import com.google.gson.Gson;
import org.springframework.util.StringUtils;
public class AppBasicInfo extends AppCashConfig{ public class AppBasicInfo extends AppNormalConfig {
public String name; public String name;
public String code; public String code;
public String img; public String img;
public String url; public String url;
public Integer version; public Integer version;
public boolean enablePangolin = true;
public int pangolinDailyLimit = 10;
public int tencentDailyLimit = 10;
public AppBasicInfo() { public AppBasicInfo() {
} }
public AppBasicInfo(MatrixApp app) { public static AppBasicInfo getBasic(MatrixApp app) {
super(app); AppBasicInfo res;
this.name = app.getName(); if (StringUtils.hasText(app.getNormalConfig())) {
this.code = app.getCode(); Gson gson = new Gson();
this.img = app.getImg(); res = gson.fromJson(app.getNormalConfig(), AppBasicInfo.class);
this.url = app.getUrl(); } else {
this.version = app.getVersion(); res = new AppBasicInfo();
}
res.name = app.getName();
res.code = app.getCode();
res.img = app.getImg();
res.url = app.getUrl();
res.version = app.getVersion();
return res;
} }
} }

40
game-service/src/main/java/awesome/group/game/service/bo/citrus/AppCashConfig.java

@ -1,40 +0,0 @@
package awesome.group.game.service.bo.citrus;
import awesome.group.game.dao.bean.MatrixApp;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.List;
public class AppCashConfig {
public List<Integer> moneyLadder;//提现梯度,单位分
public Integer noAuditMoney;//不需审核的金额,单位分
public String qqUrl;//qq客服链接
public Integer dayLimit;//每日提现次数
public AppCashConfig() {
}
public AppCashConfig(MatrixApp app) {
Gson gson = new Gson();
if (StringUtils.hasText(app.getMoneyLadder())) {
this.moneyLadder = gson.fromJson(app.getMoneyLadder(), new TypeToken<List<Integer>>() {
}.getType());
} else {
moneyLadder = Arrays.asList(30, 50, 100, 1000, 3000, 5000);
}
if (app.getNoAuditMoney() != null) {
this.noAuditMoney = app.getNoAuditMoney();
} else {
this.noAuditMoney = 30;
}
this.qqUrl = app.getQqUrl();
if (app.getDayLimit() != null) {
this.dayLimit = app.getDayLimit();
} else {
this.dayLimit = 3;
}
}
}

30
game-service/src/main/java/awesome/group/game/service/bo/matrix/AppNormalConfig.java

@ -2,32 +2,38 @@ package awesome.group.game.service.bo.matrix;
import awesome.group.game.dao.bean.MatrixApp; import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.dao.bean.MatrixUser; import awesome.group.game.dao.bean.MatrixUser;
import awesome.group.game.service.bo.citrus.AppCashConfig;
import awesome.group.game.service.util.DateUtil; import awesome.group.game.service.util.DateUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.List; import java.util.List;
public class AppNormalConfig extends AppCashConfig { public class AppNormalConfig {
public Integer maxIncomeEachVideo;//每个视频最大收益,单位分 public Integer maxIncomeEachVideo = 100;//每个视频最大收益,单位分
public List<DayRate> dayRates; public List<DayRate> dayRates;
public Integer defaultRate;//默认收益率 public Integer defaultRate = 50;//默认收益率
public List<Integer> moneyLadder = Arrays.asList(30, 50, 100, 1000, 3000, 5000);//提现梯度,单位分
public Integer noAuditMoney = 30;//不需审核的金额,单位分
public String qqUrl;//qq客服链接
public Integer dayLimit = 3;//每日提现次数
public boolean enablePangolin = true;
public int pangolinDailyLimit = 10;
public int tencentDailyLimit = 10;
public AppNormalConfig() { public AppNormalConfig() {
} }
public AppNormalConfig(MatrixApp app) { public static AppNormalConfig getConfig(MatrixApp app) {
super(app); if (StringUtils.hasText(app.getNormalConfig())) {
this.maxIncomeEachVideo = app.getMaxIncomeEachVideo();
if (StringUtils.hasText(app.getDayRates())) {
Gson gson = new Gson(); Gson gson = new Gson();
this.dayRates = gson.fromJson(app.getDayRates(), new TypeToken<List<DayRate>>() { return gson.fromJson(app.getNormalConfig(), AppNormalConfig.class);
}.getType()); } else {
return new AppNormalConfig();
} }
this.defaultRate = app.getDefaultRate();
} }
public static class DayRate { public static class DayRate {

2
game-service/src/main/java/awesome/group/game/service/citrus/AdvRecordService.java

@ -43,7 +43,7 @@ public class AdvRecordService {
} }
long ecpm = bo.advType > 1000 ? 0 : bo.ecpm; long ecpm = bo.advType > 1000 ? 0 : bo.ecpm;
AppNormalConfig config = new AppNormalConfig(app); AppNormalConfig config = AppNormalConfig.getConfig(app);
MatrixUser u = userMapper.selectById(uid); MatrixUser u = userMapper.selectById(uid);
Assert.isTrue(u.getAppId().equals(app.getId()), "非法请求"); Assert.isTrue(u.getAppId().equals(app.getId()), "非法请求");
Assert.isTrue(!u.getStatus().equals(Constants.USER_BANNED), "账号异常,无法获得收益"); Assert.isTrue(!u.getStatus().equals(Constants.USER_BANNED), "账号异常,无法获得收益");

3
game-service/src/main/java/awesome/group/game/service/citrus/CitrusAppService.java

@ -3,7 +3,6 @@ package awesome.group.game.service.citrus;
import awesome.group.game.dao.bean.MatrixApp; import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.dao.mapper.MatrixAppMapper; import awesome.group.game.dao.mapper.MatrixAppMapper;
import awesome.group.game.service.bo.citrus.AppBasicInfo; import awesome.group.game.service.bo.citrus.AppBasicInfo;
import awesome.group.game.service.bo.citrus.AppCashConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -14,6 +13,6 @@ public class CitrusAppService {
public AppBasicInfo getAppDetail(String appCode) { public AppBasicInfo getAppDetail(String appCode) {
MatrixApp app = appMapper.queryByCode(appCode); MatrixApp app = appMapper.queryByCode(appCode);
return new AppBasicInfo(app); return AppBasicInfo.getBasic(app);
} }
} }

11
game-service/src/main/java/awesome/group/game/service/citrus/UserService.java

@ -9,6 +9,7 @@ import awesome.group.game.dao.mapper.MatrixUserMapper;
import awesome.group.game.service.SmsService; import awesome.group.game.service.SmsService;
import awesome.group.game.service.UMengService; import awesome.group.game.service.UMengService;
import awesome.group.game.service.bo.citrus.*; import awesome.group.game.service.bo.citrus.*;
import awesome.group.game.service.bo.matrix.AppNormalConfig;
import awesome.group.game.service.bo.matrix.UmengConfigBo; import awesome.group.game.service.bo.matrix.UmengConfigBo;
import awesome.group.game.service.common.exception.PaganiException; import awesome.group.game.service.common.exception.PaganiException;
import awesome.group.game.service.common.exception.PaganiExceptionCode; import awesome.group.game.service.common.exception.PaganiExceptionCode;
@ -173,15 +174,15 @@ public class UserService {
Assert.isTrue(StringUtils.hasText(u.getName()), "请先填写支付宝实名姓名"); Assert.isTrue(StringUtils.hasText(u.getName()), "请先填写支付宝实名姓名");
MatrixApp app = appMapper.selectById(u.getAppId()); MatrixApp app = appMapper.selectById(u.getAppId());
AppCashConfig appCashConfig = new AppCashConfig(app); AppNormalConfig appNormalConfig = AppNormalConfig.getConfig(app);
Assert.isTrue(appCashConfig.moneyLadder.contains(cent), "提现金额不合法"); Assert.isTrue(appNormalConfig.moneyLadder.contains(cent), "提现金额不合法");
Timestamp todayBegin = new Timestamp(DateUtil.getDayBeginTimestamp(System.currentTimeMillis())); Timestamp todayBegin = new Timestamp(DateUtil.getDayBeginTimestamp(System.currentTimeMillis()));
int size = moneyRecordMapper.queryAfter(uid, todayBegin); int size = moneyRecordMapper.queryAfter(uid, todayBegin);
Assert.isTrue(size < appCashConfig.dayLimit, "每天最多提现" + appCashConfig.dayLimit + "次"); Assert.isTrue(size < appNormalConfig.dayLimit, "每天最多提现" + appNormalConfig.dayLimit + "次");
size = moneyRecordMapper.queryByAliPayAccount(aliPayAccount, todayBegin); size = moneyRecordMapper.queryByAliPayAccount(aliPayAccount, todayBegin);
Assert.isTrue(size < appCashConfig.dayLimit, "每天最多提现" + appCashConfig.dayLimit + "次"); Assert.isTrue(size < appNormalConfig.dayLimit, "每天最多提现" + appNormalConfig.dayLimit + "次");
userService.doApply(u, appCashConfig.noAuditMoney, cent); userService.doApply(u, appNormalConfig.noAuditMoney, cent);
} }
@Transactional @Transactional

15
game-service/src/main/java/awesome/group/game/service/matrix/MatrixAppConfigService.java

@ -8,7 +8,6 @@ import org.apache.commons.lang.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@Service @Service
@ -20,7 +19,7 @@ public class MatrixAppConfigService {
public AppNormalConfig getNormalConfig(String appCode) { public AppNormalConfig getNormalConfig(String appCode) {
MatrixApp app = appMapper.queryByCode(appCode); MatrixApp app = appMapper.queryByCode(appCode);
return new AppNormalConfig(app); return AppNormalConfig.getConfig(app);
} }
public UmengConfigBo getUMengConfig(String appCode) { public UmengConfigBo getUMengConfig(String appCode) {
@ -46,17 +45,7 @@ public class MatrixAppConfigService {
public void saveNormalConfig(String appCode, AppNormalConfig config) { public void saveNormalConfig(String appCode, AppNormalConfig config) {
MatrixApp app = appMapper.queryByCode(appCode); MatrixApp app = appMapper.queryByCode(appCode);
if (!CollectionUtils.isEmpty(config.dayRates)) { app.setNormalConfig(gson.toJson(config));
app.setDayRates(gson.toJson(config.dayRates));
}
app.setDefaultRate(config.defaultRate);
app.setDayLimit(config.dayLimit);
app.setMaxIncomeEachVideo(config.maxIncomeEachVideo);
app.setNoAuditMoney(config.noAuditMoney);
if (!CollectionUtils.isEmpty(config.moneyLadder)) {
app.setMoneyLadder(gson.toJson(config.moneyLadder));
}
app.setQqUrl(config.qqUrl);
appMapper.updateById(app); appMapper.updateById(app);
} }

Loading…
Cancel
Save