use of com.code.server.login.config.ServerConfig in project summer by foxsugar.
the class LoginApplication method main.
public static void main(String[] args) {
SpringApplication.run(LoginApplication.class, args);
ServerConfig serverConfig = SpringUtil.getBean(ServerConfig.class);
ServerManager.init();
System.out.println(ServerManager.constant.toString());
// 中心服务器有的职能
if (serverConfig.getIsCenter() == 1) {
// timer
ThreadPool.execute(GameTimer.getInstance()::fire);
CenterService.work();
// rpc服务
RpcManager.getInstance().startGameRpcServer();
// 检测rpc
RpcManager.getInstance().checkGameRpcServerWork();
}
// 俱乐部 逻辑
ClubManager.getInstance().loadAll();
// MsgConsumer.startAConsumer("userService",0,new UserServiceConsumer());
// MsgConsumer.startAConsumer("userService",1,new UserServiceConsumer());
// MsgConsumer.startAConsumer("userService",2,new UserServiceConsumer());
// MsgConsumer.startAConsumer("userService",3,new UserServiceConsumer());
// MsgConsumer.startAConsumer("userService",4,new UserServiceConsumer());
}
use of com.code.server.login.config.ServerConfig in project summer by foxsugar.
the class LoginAction method createUser.
/**
* 创建玩家
*
* @param account
* @param password
* @return
*/
private User createUser(String account, String password) {
ServerConfig serverConfig = SpringUtil.getBean(ServerConfig.class);
User newUser = new User();
newUser.setAccount(account);
newUser.setPassword(password);
newUser.setOpenId("" + new IdWorker(serverConfig.getServerId(), 1).nextId());
newUser.setUsername(decodeStr(account));
newUser.setImage("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=253777390,947512827&fm=23&gp=0.jpg/96");
newUser.setSex(1);
newUser.setVip(0);
newUser.setUuid("0");
newUser.setMoney(getConstant().getInitMoney());
newUser.setRegistDate(new Date());
newUser.setLastLoginDate(new Date());
return newUser;
}
Aggregations