kingston-csj / mmorpg

springboot编写的高性能分布式mmorpg手游服务端框架,包含中心服,网关服,游戏服,战斗服等。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

针对net 注解的建议

herton7362 opened this issue · comments

建议把@MessageMeta的参数放到@RequestMapping,然后把@MessageMeta类型改为参数,例如下面这种:

@RequestMapping(module = Modules.PLAYER, cmd = PlayerService.CMD_REQ_LOGIN)
public void reqPlayerLogin(IoSession session, @MessageMeta ReqPlayerLogin request) {
	long playerId = request.getPlayerId();
	System.out.println("角色[" + playerId + "]登录");
	SessionManager.getInstance().registerSession(playerId, session);

	session.sendPacket(new ResPlayerLogin());
}

参考spring mvc的注解,因为是请求响应模型,我觉得这样比较好理解一些

commented

mvc里的requestmapper映射的是路径url,而消息模块号属于消息本身的元数据,放在消息比较好吧。另外,按你的格式,方法参数里的meta注解貌似可以直接去掉吧?