活动礼包刷新
parent
20f6e75d12
commit
0370572c7c
|
|
@ -460,14 +460,10 @@ public class BuyGoodsNewLogic {
|
||||||
}
|
}
|
||||||
if(bag.getType() == RechargeType.timeLimit.getType()){
|
if(bag.getType() == RechargeType.timeLimit.getType()){
|
||||||
//活动类型特殊处理
|
//活动类型特殊处理
|
||||||
//todo 其他的也要改 直接读表里的 不读数据库里的
|
for(String[] s : configById.getCondition()){
|
||||||
String onSaleRule = configById.getOnSaleRule();
|
if(s[0].equals("3")){
|
||||||
int[] condition = null;
|
if(ActivityLogic.checkActivityOpen(user,Integer.parseInt(s[1]))){
|
||||||
if(!onSaleRule.contains("|")){
|
long[] time = ActivityLogic.getStartAndEndTime(user,Integer.parseInt(s[1]));
|
||||||
condition = StringUtil.parseFiledInt(onSaleRule);
|
|
||||||
if(condition[0]==3){
|
|
||||||
if(ActivityLogic.checkActivityOpen(user,condition[1])){
|
|
||||||
long[] time = ActivityLogic.getStartAndEndTime(user,condition[1]);
|
|
||||||
bag.setStartTime(time[0]);
|
bag.setStartTime(time[0]);
|
||||||
bag.setEndTime(time[1]);
|
bag.setEndTime(time[1]);
|
||||||
bag.setOpen(true);
|
bag.setOpen(true);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
private long refreshTime;
|
private long refreshTime;
|
||||||
private int[] privilege;
|
private int[] privilege;
|
||||||
private int timeType;
|
private int timeType;
|
||||||
private String[][] condition;
|
|
||||||
private boolean isUserBuyRefresh;
|
private boolean isUserBuyRefresh;
|
||||||
|
|
||||||
public AbstractWelfareBag(User user,SRechargeCommodityNewConfig config){
|
public AbstractWelfareBag(User user,SRechargeCommodityNewConfig config){
|
||||||
|
|
@ -41,6 +40,7 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
setContinueDays(config.getContiueDays());
|
setContinueDays(config.getContiueDays());
|
||||||
setPrivilege(config.getOpenPrivilege());
|
setPrivilege(config.getOpenPrivilege());
|
||||||
if(!config.getOnSaleRule().equals("")){
|
if(!config.getOnSaleRule().equals("")){
|
||||||
|
String[][] condition;
|
||||||
String[] s = config.getOnSaleRule().split("\\|");
|
String[] s = config.getOnSaleRule().split("\\|");
|
||||||
condition = new String[s.length][3];
|
condition = new String[s.length][3];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
@ -56,7 +56,6 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
setCondition(condition);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +73,6 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
this.refreshTime = refreshTime;
|
this.refreshTime = refreshTime;
|
||||||
this.privilege = privilege;
|
this.privilege = privilege;
|
||||||
this.timeType = timeType;
|
this.timeType = timeType;
|
||||||
this.condition = condition;
|
|
||||||
this.isUserBuyRefresh = isUserBuyRefresh;
|
this.isUserBuyRefresh = isUserBuyRefresh;
|
||||||
this.setMongoKey(mongoKey);
|
this.setMongoKey(mongoKey);
|
||||||
this.setRootId(rootId);
|
this.setRootId(rootId);
|
||||||
|
|
@ -126,6 +124,9 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
* 刷新时间到刷新礼包状态
|
* 刷新时间到刷新礼包状态
|
||||||
*/
|
*/
|
||||||
public void refresh(){
|
public void refresh(){
|
||||||
|
if(!isOpen()){
|
||||||
|
setRefreshTime(TimeUtils.getTodayZero());
|
||||||
|
}
|
||||||
if(getTimeType() == 7){//每周刷新
|
if(getTimeType() == 7){//每周刷新
|
||||||
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
|
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
|
||||||
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
|
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
|
||||||
|
|
@ -170,12 +171,7 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
updateString("open",open);
|
updateString("open",open);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[][] getCondition() { return condition; }
|
public String[][] getCondition() { return SRechargeCommodityNewConfig.getConditon(modId); }
|
||||||
|
|
||||||
public void setCondition(String[][] condition) {
|
|
||||||
this.condition = condition;
|
|
||||||
updateString("condition",condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStartTime() { return startTime; }
|
public long getStartTime() { return startTime; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import config.SRechargeCommodityNewConfig;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时限礼包(活动)
|
* 时限礼包(活动)
|
||||||
|
|
@ -28,6 +29,9 @@ public class TimeLimitWelfareBag extends AbstractWelfareBag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(getDailyUpdate() > 0){
|
||||||
|
setRefreshTime(TimeUtils.getBeginOfDay(getStartTime())+ getDailyUpdate() * TimeUtils.DAY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeLimitWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {
|
public TimeLimitWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
||||||
|
|
||||||
private int[] forbid;
|
private int[] forbid;
|
||||||
|
|
||||||
|
private String[][] condition;
|
||||||
|
|
||||||
|
|
||||||
public static Map<Integer,SRechargeCommodityNewConfig> configMap;
|
public static Map<Integer,SRechargeCommodityNewConfig> configMap;
|
||||||
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
|
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
|
||||||
|
|
@ -68,6 +70,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
||||||
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
|
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
|
||||||
Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>();
|
Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>();
|
||||||
for(SRechargeCommodityNewConfig newConfig : config.values()){
|
for(SRechargeCommodityNewConfig newConfig : config.values()){
|
||||||
|
newConfig.setCondition(initConditon(newConfig));
|
||||||
tempConfigMap.put(newConfig.getId(),newConfig);
|
tempConfigMap.put(newConfig.getId(),newConfig);
|
||||||
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
|
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
|
||||||
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
|
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
|
||||||
|
|
@ -87,6 +90,26 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[][] getConditon(int id){
|
||||||
|
return configMap.get(id).getCondition();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[][] initConditon(SRechargeCommodityNewConfig config){
|
||||||
|
String[] s = config.getOnSaleRule().split("\\|");
|
||||||
|
condition = new String[s.length][3];
|
||||||
|
int i = 0;
|
||||||
|
for (String s0 : s) {
|
||||||
|
String[] s1 = s0.split("#");
|
||||||
|
condition[i][0] = s1[0];
|
||||||
|
condition[i][1] = s1[1];
|
||||||
|
if(s1.length > 2){
|
||||||
|
condition[i][2] = s1[2];
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
|
||||||
public static SRechargeCommodityNewConfig getConfigById(int id){
|
public static SRechargeCommodityNewConfig getConfigById(int id){
|
||||||
return configMap.get(id);
|
return configMap.get(id);
|
||||||
}
|
}
|
||||||
|
|
@ -150,4 +173,12 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
||||||
public String getRechargeId6() {
|
public String getRechargeId6() {
|
||||||
return rechargeId6;
|
return rechargeId6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String[][] getCondition() {
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCondition(String[][] condition) {
|
||||||
|
this.condition = condition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue