Browse Source

app配置

master
nili 6 months ago
parent
commit
ebb7bda52e
  1. 3
      game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java
  2. 2
      game-service/src/main/java/awesome/group/game/service/bo/citrus/AppCashConfig.java
  3. 34
      game-service/src/main/java/awesome/group/game/service/bo/matrix/AppNormalConfig.java
  4. 5
      game-service/src/main/java/awesome/group/game/service/bo/matrix/MatrixAppBo.java
  5. 38
      game-service/src/main/java/awesome/group/game/service/matrix/MatrixAppService.java
  6. 30
      game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixAppController.java

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

@ -25,4 +25,7 @@ public class MatrixApp {
private Integer noAuditMoney; private Integer noAuditMoney;
private String qqUrl; private String qqUrl;
private Integer dayLimit;//每日提现次数限制 private Integer dayLimit;//每日提现次数限制
private Integer maxIncomeEachVideo;//0正常,1停用
private String dayRates;
private Integer defaultRate;
} }

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

@ -20,7 +20,7 @@ public class AppCashConfig {
public AppCashConfig(MatrixApp app) { public AppCashConfig(MatrixApp app) {
Gson gson = new Gson(); Gson gson = new Gson();
if (StringUtils.hasText(app.getMoneyLadder())) { if (StringUtils.hasText(app.getMoneyLadder())) {
this.moneyLadder = gson.fromJson(app.getMoneyLadder(), new TypeToken<List<Long>>() { this.moneyLadder = gson.fromJson(app.getMoneyLadder(), new TypeToken<List<Integer>>() {
}.getType()); }.getType());
} else { } else {
moneyLadder = Arrays.asList(30, 50, 100, 10000, 30000, 50000); moneyLadder = Arrays.asList(30, 50, 100, 10000, 30000, 50000);

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

@ -0,0 +1,34 @@
package awesome.group.game.service.bo.matrix;
import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.service.bo.citrus.AppCashConfig;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.springframework.util.StringUtils;
import java.util.List;
public class AppNormalConfig extends AppCashConfig {
public Integer maxIncomeEachVideo;//每个视频最大收益,单位分
public List<DayRate> dayRates;
public Integer defaultRate;//默认收益率
public AppNormalConfig() {
}
public AppNormalConfig(MatrixApp app) {
super(app);
this.maxIncomeEachVideo = app.getMaxIncomeEachVideo();
if (StringUtils.hasText(app.getDayRates())) {
Gson gson = new Gson();
this.dayRates = gson.fromJson(app.getDayRates(), new TypeToken<List<DayRate>>() {
}.getType());
}
this.defaultRate = app.getDefaultRate();
}
public static class DayRate {
public Integer day;
public Integer rate;
}
}

5
game-service/src/main/java/awesome/group/game/service/bo/matrix/MatrixAppBo.java

@ -1,7 +1,6 @@
package awesome.group.game.service.bo.matrix; 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.service.bo.citrus.AppCashConfig;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
public class MatrixAppBo { public class MatrixAppBo {
@ -14,7 +13,7 @@ public class MatrixAppBo {
public Integer hide; public Integer hide;
public String secret; public String secret;
public boolean enableCash; public boolean enableCash;
public AppCashConfig config; // public AppNormalConfig config;
public MatrixAppBo() { public MatrixAppBo() {
@ -30,6 +29,6 @@ public class MatrixAppBo {
this.hide = app.getHide(); this.hide = app.getHide();
this.secret = app.getSecret(); this.secret = app.getSecret();
this.enableCash = StringUtils.hasText(app.getAliPay()); this.enableCash = StringUtils.hasText(app.getAliPay());
this.config = new AppCashConfig(app); // this.config = new AppNormalConfig(app);
} }
} }

38
game-service/src/main/java/awesome/group/game/service/matrix/MatrixAppService.java

@ -0,0 +1,38 @@
package awesome.group.game.service.matrix;
import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.dao.mapper.MatrixAppMapper;
import awesome.group.game.service.bo.matrix.AppNormalConfig;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
public class MatrixAppService {
@Autowired
private MatrixAppMapper appMapper;
private Gson gson = new Gson();
public AppNormalConfig getNormalConfig(String appCode) {
MatrixApp app = appMapper.queryByCode(appCode);
return new AppNormalConfig(app);
}
public void saveNormalConfig(String appCode, AppNormalConfig config) {
MatrixApp app = appMapper.queryByCode(appCode);
if (!CollectionUtils.isEmpty(config.dayRates)) {
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);
}
}

30
game-web/src/main/java/awesome/group/game/web/rest/matrix/MatrixAppController.java

@ -0,0 +1,30 @@
package awesome.group.game.web.rest.matrix;
import awesome.group.game.service.bo.matrix.AppNormalConfig;
import awesome.group.game.service.common.response.R;
import awesome.group.game.service.matrix.MatrixAppService;
import awesome.group.game.web.aop.RestApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/matrix/app")
public class MatrixAppController {
@Autowired
private MatrixAppService appService;
@GetMapping("/normalConfig")
@RestApi
public R<AppNormalConfig> getAppNormalConfig(@RequestParam String appCode) {
AppNormalConfig data = appService.getNormalConfig(appCode);
return new R<>(data);
}
@PostMapping("/normalConfig")
@RestApi
public R<Void> saveNormalConfig(@RequestParam String appCode, @RequestBody AppNormalConfig config) {
appService.saveNormalConfig(appCode, config);
return new R<>(null);
}
}
Loading…
Cancel
Save