补单逻辑补充2

master_zzxx
grimm 2024-07-01 19:02:09 +08:00
parent befad45243
commit e8ea1a6961
3 changed files with 129 additions and 4 deletions

View File

@ -10,6 +10,8 @@ import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildLogic;
import com.ljsd.jieling.network.server.SessionManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.ItemUtil;
import java.util.HashMap;
@ -105,6 +107,19 @@ public class Cmd_general extends GmAbstract {
}
LOGGER.info("查询用户字符串......{}",args[1]);
break;
case "offline":
try {
int uid = Integer.parseInt(args[1]);
ISession session = OnlineUserManager.getSessionByUid(uid);
if (session == null){
LOGGER.error("用户找不到");
}
SessionManager.getInstance().offLine(session);
} catch (Exception e) {
e.printStackTrace();
}
LOGGER.info("offline 玩家掉线......{}",args[1]);
break;
case "onlineuser":
try {
int uid = Integer.parseInt(args[1]);

View File

@ -193,7 +193,7 @@ public class EveryDayDiscountActivity extends AbstractActivity {
int updateState = event1.getUpdateState();
SEveryDayGift dayGift = SEveryDayGift.activitygiftmap.getOrDefault(id, new HashMap<>()).get(giftId);
if (dayGift == null){
LOGGER.error("天天0.1折扣活动查验购买次数退出EveryDayGift未找到对应档位{}礼包id{},耗时:{}",id,giftId,TimeUtils.now()-now);
LOGGER.info("天天0.1折扣活动查验购买次数退出EveryDayGift未找到对应档位{}礼包id{},耗时:{}",id,giftId,TimeUtils.now()-now);
return;
}
ActivityLogic.getInstance().EveryDayDiscountBuyCheckAndUpdate(user,id,dayGift.getId(),updateState);

View File

@ -351,13 +351,125 @@ public class BuyGoodsNewLogic {
return resultRes;
}
// public static Result sendGoodstest(int uid, String sdkGoodsId, String openId, String orderId, long orderTime, int amount) throws Exception {
// LOGGER.info("sendGoods to uid={},the goods={},openID={},orderId={},orderTime={},amount={}",uid,sdkGoodsId,openId,orderId,orderTime,amount);
// long now = TimeUtils.now();
// Result resultRes = new Result();
// resultRes.setResultCode(0);
// ISession session = OnlineUserManager.getSessionByUid(uid);
// if (session == null) {
// Order order = new Order(uid, sdkGoodsId, openId, orderId, orderTime, amount);
// String key = RedisKey.ANEW_RECHARGE_ORDER + ":" + uid;
// RedisUtil.getInstence().putmap(key, order.getId(), order);
// RedisUtil.getInstence().expireMills(key, TimeUtils.DAY * 30);
// LOGGER.error("sendGoods 玩家不在缓存中,补单信息已放入redis缓存 uid={}order{}",uid, order);
//
// resultRes.setResultCode(1);
// resultRes.setResultMsg("Session is null");
// return resultRes;
// }
// if (!StringUtil.isNumeric(sdkGoodsId)){
// resultRes.setResultMsg("sdkGoodsId is error");
// LOGGER.error("sendGoods 礼包id不是纯数字, uid={}, goodId={}",uid, sdkGoodsId);
// return resultRes;
// }
// SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(Integer.parseInt(sdkGoodsId));
// if(null == config){
// resultRes.setResultMsg("SRechargeCommodityNewConfig is null");
// LOGGER.error("sendGoods 礼包表找不到, uid={}, goodId={}",uid, sdkGoodsId);
// return resultRes;
// }
//
// int goodsId = config.getId();
// // 支付金额用分
// double price = config.getPrice();
//// int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
//// double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
// if(amount != price*100){
// resultRes.setResultMsg("compared amount fail");
// LOGGER.error("sendGoods 金额校验失败, uid={}, goodId={}, amount={}, price={}",uid,goodsId, amount, price*100);
// return resultRes;
// }
//
// User user = UserManager.getUser(uid);
// if (user == null) {
// resultRes.setResultMsg("User not found");
// LOGGER.error("sendGoods 玩家找不到, uid={}",uid);
// return resultRes;
// }
//
// RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
// AbstractWelfareBag bag = rechargeHandler.getBag(user, goodsId);
// if (bag == null) {
// resultRes.setResultMsg("Welfare bag not found");
// LOGGER.error("sendGoods 玩家身上找不到礼包, uid={}, goodId={}",uid, goodsId);
// return resultRes;
// }
//
// // 礼包购买
// bag.buy();
// int[] forbid = config.getForbid();
// if(forbid != null){
// //每日礼包一键购买之后,把所有单个的每日礼包的购买次数加一
// for (int gId : forbid) {
// rechargeHandler.getBag(user, gId).addBuyTimes(1);
// }
// }
// //处理特权
// activePrivilege(user,config);
// // 校验
// NewRechargeInfo rechargeInfo = user.getPlayerInfoManager().getNewRechargeInfo();
// if(config.getAccumulativeRecharge() == 1){
// //处理月卡
// activeMonthCard(user,config.getId());
// //活动
// changeActivity(user,price,rechargeInfo);
// }
// if(getFirstRechargeTime(uid) == 0){
// setFirstRecharge(uid);
// }
// // 全部礼包状态推送
// sendGiftGoodsWithoutJudge(uid);
// // 推送礼包
// openPush(session, user, PushRechargeType.point_recharge.getType(), goodsId);
// // 基础掉落
// List<int[][]> list = bag.getDropByBag();
// // 购买礼包额外补助
// int[][] gainFame = config.getGainFame();
// if (gainFame != null && gainFame.length > 0){
// list.add(gainFame);
// }
// // 相关处理
// rechargeHandler(user, orderId, config.getId(), (int) config.getPrice(), list);
// // 发货
// sendGoodsByType(user,config,list);
// // 通知前端
// notifyPaySuccessFul(uid,goodsId,amount != -999);
// //发送邮件
// int[] mail = config.getMail();
// if(config.getPrice() != 0 && mail != null && mail.length >= 2){
// String title = SErrorCodeEerverConfig.getI18NMessage(SErrorCodeEerverConfig.errorMap.get(mail[0]).getkey());
// String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert(SErrorCodeEerverConfig.errorMap.get(mail[1]).getkey(), new Object[]{config.getName()}, new int[]{1}, "#");
// MailLogic.getInstance().sendMail(uid,title,content,"",TimeUtils.nowInt(),Global.MAIL_EFFECTIVE_TIME);
// }
// // 更新入库
// MongoUtil.getLjsdMongoTemplate().lastUpdate();
// MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.RECHARGE_SUCCESS_INDICATION_VALUE, PlayerInfoProto.RechargeSuccessIndication.newBuilder().setOrderId(orderId).build(), true);
// LOGGER.info("购买礼包耗时16{}", TimeUtils.now() - now);
//
// resultRes.setResultCode(1);
// return resultRes;
// }
/**
*
*/
public static void anewRecharge(ISession session){
PlayerInfoProto.AnewRechargeOrderResponse.Builder builder = PlayerInfoProto.AnewRechargeOrderResponse.newBuilder();
String key = RedisKey.ANEW_RECHARGE_ORDER + ":" + session.getUid();
Map<String, Order> orderMap = RedisUtil.getInstence().getmapvaluekeyclass(key, String.class, Order.class);
if (orderMap == null || orderMap.isEmpty()){
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.AnewRechargeOrderResponse_VALUE, builder.build(), true);
return;
}
for (Map.Entry<String, Order> entry : orderMap.entrySet()) {
@ -373,9 +485,7 @@ public class BuyGoodsNewLogic {
}
}
RedisUtil.getInstence().del(key);
// PlayerInfoProto.AnewRechargeOrderResponse.Builder builder = PlayerInfoProto.AnewRechargeOrderResponse.newBuilder();
// MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.AnewRechargeOrderResponse_VALUE, builder.build(), true);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.AnewRechargeOrderResponse_VALUE, builder.build(), true);
}
public static void setFirstRecharge(int uid){