充值前接口检测
parent
346feae774
commit
3048f8a305
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ljsd.jieling.handler.store;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import rpc.protocols.MessageTypeProto;
|
||||||
|
import rpc.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2021/5/10
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class CheckBuyGoodsHandler extends BaseHandler<PlayerInfoProto.CheckBuyGoodsRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.CHECK_BUY_GOODS_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processWithProto(ISession iSession, PlayerInfoProto.CheckBuyGoodsRequest proto) throws Exception {
|
||||||
|
BuyGoodsNewLogic.checkBuyGoods(iSession,proto.getGoodsId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,8 @@ import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
|
|
@ -723,7 +725,7 @@ public class BuyGoodsNewLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int judgePushCondition(User user,SPackPushConfig con){
|
private static int judgePushCondition(User user,SPackPushConfig con){
|
||||||
int[] scope = con.getScopeId();
|
int[] scope = con.getScopeId();
|
||||||
if(scope[0] == 1){//主线关卡
|
if(scope[0] == 1){//主线关卡
|
||||||
int mainLevel = user.getMainLevelManager().getFightId();
|
int mainLevel = user.getMainLevelManager().getFightId();
|
||||||
|
|
@ -850,4 +852,30 @@ public class BuyGoodsNewLogic {
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
public static void checkBuyGoods(ISession session,int goodsId) throws Exception {
|
||||||
|
int uid = session.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
SRechargeCommodityNewConfig sRechargeCommodityConfig =SRechargeCommodityNewConfig.getConfigById(goodsId);
|
||||||
|
if(null ==sRechargeCommodityConfig) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
String order ;
|
||||||
|
if(sRechargeCommodityConfig.getPrice()==0){
|
||||||
|
order = "0";//免费礼包不需要订单号
|
||||||
|
}else {
|
||||||
|
//生成cp订单号
|
||||||
|
order = createOrder(user);
|
||||||
|
// CPOrder cpOrder = new CPOrder(order, String.valueOf(TimeUtils.now()), String.valueOf(goodsId));
|
||||||
|
// RedisUtil.getInstence().set(RedisKey.CP_ORDER,order,cpOrder);
|
||||||
|
}
|
||||||
|
PlayerInfoProto.CheckBuyGoodsResponse response = PlayerInfoProto.CheckBuyGoodsResponse.newBuilder().setOrderId(order).build();
|
||||||
|
|
||||||
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.CHECK_BUY_GOODS_RESPONSE_VALUE,response);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private static String createOrder(User user){
|
||||||
|
return KeyGenUtils.produceIdByModule(UUIDEnum.ORDER, user.getId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ public enum UUIDEnum {
|
||||||
JEWEL(10),
|
JEWEL(10),
|
||||||
SpecialMonster(11),
|
SpecialMonster(11),
|
||||||
ROBOT_UUID(12),
|
ROBOT_UUID(12),
|
||||||
|
ORDER(13),
|
||||||
HardStage(15),
|
HardStage(15),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue