网页支付
parent
299a608590
commit
08c8b779bc
|
|
@ -20,6 +20,8 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CoreService implements RPCRequestIFace.Iface {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CoreService.class);
|
||||
|
|
@ -54,16 +56,15 @@ public class CoreService implements RPCRequestIFace.Iface {
|
|||
}
|
||||
|
||||
@Override
|
||||
public RechargeResult getRecharge(int uid) throws TException {
|
||||
public RechargeResult getRecharge(int uid) {
|
||||
try {
|
||||
HashSet<Integer> integers = new HashSet<>();
|
||||
// BuyGoodsLogic.getGoodsBagInfoFromDelive(uid,integers);
|
||||
Set<Integer> list = BuyGoodsNewLogic.getGoodsBagInfoFromDelive(uid);
|
||||
RechargeResult result = new RechargeResult();
|
||||
result.setResultCode(1);
|
||||
result.setSubNodeSet(integers);
|
||||
result.setSubNodeSet(list);
|
||||
return result;
|
||||
}catch (Exception e){
|
||||
User user = UserManager.getUserInMem(uid);
|
||||
User user = UserManager.getUserInMem(uid);
|
||||
RechargeResult result = new RechargeResult();
|
||||
result.setResultCode(0);
|
||||
if(user == null){
|
||||
|
|
|
|||
|
|
@ -622,20 +622,44 @@ public class BuyGoodsNewLogic {
|
|||
giftGoodsInfoList.add(buildGoodsInfo(bag));
|
||||
}
|
||||
}
|
||||
giftGoodsInfoList.sort(new Comparator<CommonProto.GiftGoodsInfo>() {
|
||||
@Override
|
||||
public int compare(CommonProto.GiftGoodsInfo o1, CommonProto.GiftGoodsInfo o2) {
|
||||
if(o1.getGoodsId() > o2.getGoodsId()){
|
||||
return 1;
|
||||
}else if(o1.getGoodsId() < o2.getGoodsId()){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
giftGoodsInfoList.sort((o1, o2) -> {
|
||||
if(o1.getGoodsId() > o2.getGoodsId()){
|
||||
return 1;
|
||||
}else if(o1.getGoodsId() < o2.getGoodsId()){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
return needChange;
|
||||
}
|
||||
|
||||
public static Set<Integer> getGoodsBagInfoFromDelive(int uid) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
Set<Integer> list = new HashSet<>();
|
||||
NewRechargeInfo rechargeInfo = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getPerpetualMap().values()){
|
||||
if(bag.isOpen()){
|
||||
list.add(bag.getModId());
|
||||
}
|
||||
}
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getTimeLimitMap().values()){
|
||||
if(bag.isOpen()){
|
||||
list.add(bag.getModId());
|
||||
}
|
||||
}
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getReceiveMap().values()){
|
||||
if(bag.isOpen()){
|
||||
list.add(bag.getModId());
|
||||
}
|
||||
}
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getPushMap().values()){
|
||||
if(bag.isOpen()){
|
||||
list.add(bag.getModId());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static CommonProto.GiftGoodsInfo buildGoodsInfo(AbstractWelfareBag bag){
|
||||
CommonProto.GiftGoodsInfo.Builder builder = CommonProto.GiftGoodsInfo.newBuilder();
|
||||
builder.setGoodsId(bag.getModId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue