feat: palyer action and update common card

This commit is contained in:
wzdwc
2020-04-23 00:01:14 +08:00
parent 7e81a76195
commit 60fe711929
20 changed files with 614 additions and 187 deletions
-1
View File
@@ -4,6 +4,5 @@ dist/
npm-debug.log
yarn-error.log
test/unit/coverage
/.idea/
run/
npm-debug.*
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Generated Executable
+36
View File
@@ -0,0 +1,36 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JSCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="ALIGN_OBJECT_PROPERTIES" value="2" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
<option name="OBJECT_LITERAL_WRAP" value="2" />
<option name="IMPORTS_WRAP" value="0" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
<option name="CHAINED_CALL_DOT_ON_NEW_LINE" value="false" />
</JSCodeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="RIGHT_MARGIN" value="80" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
+5
View File
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
Generated Executable
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/TexasPokerGame.iml" filepath="$PROJECT_DIR$/.idea/TexasPokerGame.iml" />
</modules>
</component>
</project>
Generated Executable
+100
View File
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="f9039135-aa11-4abd-ad74-f40c84e4fdb2" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/App.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/App.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/views/game.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/game.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/logs/ELKLog/error.log" beforeDir="false" afterPath="$PROJECT_DIR$/server/logs/ELKLog/error.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/logs/ELKLog/info.log" beforeDir="false" afterPath="$PROJECT_DIR$/server/logs/ELKLog/info.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/logs/game-node-center/agent.log" beforeDir="false" afterPath="$PROJECT_DIR$/server/logs/game-node-center/agent.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/logs/game-node-center/app.log" beforeDir="false" afterPath="$PROJECT_DIR$/server/logs/game-node-center/app.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/logs/game-node-center/core.log" beforeDir="false" afterPath="$PROJECT_DIR$/server/logs/game-node-center/core.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/logs/game-node-center/egg-schedule.log" beforeDir="false" afterPath="$PROJECT_DIR$/server/logs/game-node-center/egg-schedule.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/logs/game-node-center/error.log" beforeDir="false" afterPath="$PROJECT_DIR$/server/logs/game-node-center/error.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/src/app/core/Player.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/core/Player.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/src/app/core/PokerGame.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/core/PokerGame.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/src/app/io/controller/game.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/io/controller/game.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/test/app/core/pokerGame.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/test/app/core/pokerGame.test.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="TypeScript File" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1ahwXO0WADZQzSECEEPPaWdpY8B" />
<component name="ProjectViewState">
<option name="autoscrollFromSource" value="true" />
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="settings.editor.selected.configurable" value="preferences.keymap" />
<property name="ts.external.directory.path" value="$PROJECT_DIR$/server/node_modules/typescript/lib" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="f9039135-aa11-4abd-ad74-f40c84e4fdb2" name="Default Changelist" comment="" />
<created>1586870120922</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1586870120922</updated>
<workItem from="1586870126995" duration="5800000" />
<workItem from="1587201178537" duration="19314000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="WindowStateProjectService">
<state x="184" y="112" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1587141749678">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="184" y="112" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1440.900@0.0.1440.900" timestamp="1587141749678" />
<state x="533" y="173" key="#com.intellij.ide.util.MemberChooser" timestamp="1587206645912">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="533" y="173" key="#com.intellij.ide.util.MemberChooser/0.0.1440.900@0.0.1440.900" timestamp="1587206645912" />
<state x="221" y="89" key="SettingsEditor" timestamp="1587202477947">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="221" y="89" key="SettingsEditor/0.0.1440.900@0.0.1440.900" timestamp="1587202477947" />
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1587480585643">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.0.1440.900@0.0.1440.900" timestamp="1587480585643" />
<state x="378" y="207" width="683" height="486" key="find.popup" timestamp="1587207727777">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="378" y="207" width="683" height="486" key="find.popup/0.0.1440.900@0.0.1440.900" timestamp="1587207727777" />
<state x="385" y="196" width="670" height="676" key="search.everywhere.popup" timestamp="1587141886851">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="385" y="196" width="670" height="676" key="search.everywhere.popup/0.0.1440.900@0.0.1440.900" timestamp="1587141886851" />
<state x="450" y="369" key="vcs.readOnlyHandler.ReadOnlyStatusDialog" timestamp="1587138649507">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="450" y="369" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.0.1440.900@0.0.1440.900" timestamp="1587138649507" />
</component>
</project>
+68 -68
View File
@@ -1,68 +1,68 @@
<template>
<div id="app">
<router-view/>
</div>
</template>
<script lang="ts">
import { Vue } from 'vue-property-decorator';
export default class App extends Vue {}
</script>
<style lang="less">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
*{
padding: 0;
margin: 0;
}
body{
box-sizing: border-box;
}
.container{
margin-top: 30px;
.input-bd{
line-height: 30px;
margin: 10px;
.input-name{
display: inline-block;
width: 100px;
text-align: right;
}
.input-text{
display: inline-block;
padding-left: 10px;
input{
height: 30px;
width: 180px;
padding:0 5px;
}
}
}
.btn {
margin-top: 15px;
span{
color: #fff;
background-color: #6796ff;
border-radius: 8px;
padding: 5px 20px;
display: inline-block;
margin: 10px;
}
b{
display: inline-block;
border: aliceblue;
border-radius: 8px;
padding: 5px 20px;
margin-left: 10px;
}
}
}
</style>
<template>
<div id="app">
<router-view/>
</div>
</template>
<script lang="ts">
import { Vue } from 'vue-property-decorator';
export default class App extends Vue {}
</script>
<style lang="less">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
*{
padding: 0;
margin: 0;
}
body{
box-sizing: border-box;
}
.container{
margin-top: 30px;
.input-bd{
line-height: 30px;
margin: 10px;
.input-name{
display: inline-block;
width: 100px;
text-align: right;
}
.input-text{
display: inline-block;
padding-left: 10px;
input{
height: 30px;
width: 180px;
padding:0 5px;
}
}
}
.btn {
margin-top: 15px;
span{
color: #fff;
background-color: #6796ff;
border-radius: 8px;
padding: 5px 20px;
display: inline-block;
margin: 10px;
}
b{
display: inline-block;
border: aliceblue;
border-radius: 8px;
padding: 5px 20px;
margin-left: 10px;
}
}
}
</style>
+9 -12
View File
@@ -1,8 +1,9 @@
<template>
<div class="game-container container">
<div class="game-player-info">
<div class="users">
<span v-for="user in users"> {{user.nick_name}}: {{user.counter}}</span>
<div class="users" v-for="user in users">
<span> {{user.nick_name}}: {{user.counter}}</span>
<span> actionSize:{{user.actionSize}} </span>
</div>
<div class="join">
{{joinMsg}}
@@ -17,7 +18,7 @@
<span @click="action('check')">check</span>
<span @click="action('fold')">fold</span>
<span @click="action('call')">call</span>
<span @click="action('raise')">raise</span>
<span @click="isRaise = true">raise</span>
</div>
<div class="raise-size" v-show="isRaise">
<i @click="raise(pot / 3)">1/3 pot</i>
@@ -26,7 +27,7 @@
<i @click="raise(pot)">1 pot</i>
<i @click="raise(pot * 2)">2 pot</i>
<i @click="raise(pot * 3)">3 pot</i>
<i @click="raise(-1)">allin</i>
<i @click="action('allin')">allin</i>
</div>
</div>
<div class="btn play"><span @click="play">play game</span></div>
@@ -113,17 +114,13 @@
}
private raise(size: number) {
if (size === -1) {
size = this.userInfo.counter;
}
this.emit('action', { command: `raise:${size}` });
this.action(`raise:${size}`);
}
private action(type: string) {
private action(command: string) {
this.emit('action', { command });
this.isAction = false;
if (type === ECommand.RAISE) {
this.isRaise = true;
}
this.isRaise = false;
}
private socketInit() {
+3
View File
@@ -1,3 +1,6 @@
{"pid":48633,"nodeVersion":"v12.16.1","launchTime":"2020-04-21 00:28:45","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-21 00:28:45","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":49495,"nodeVersion":"v12.16.1","launchTime":"2020-04-21 23:04:55","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-21 23:04:55","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":49588,"nodeVersion":"v12.16.1","launchTime":"2020-04-21 23:40:05","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"game already paling","requestTime":"2020-04-21 23:40:05","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51857,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:38:24","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"Handshake inactivity timeout","requestTime":"2020-04-22 23:38:24","stack":"Error: Handshake inactivity timeout\n at Handshake.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:160:17)\n at Handshake.emit (events.js:311:20)\n at Handshake._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/sequences/Sequence.js:124:8)\n at Timer._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Timer.js:32:23)\n at listOnTimeout (internal/timers.js:549:17)\n at processTimers (internal/timers.js:492:7)\n --------------------\n at Protocol._enqueue (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:144:48)\n at Protocol.handshake (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:51:23)\n at PoolConnection.connect (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Connection.js:116:18)\n at Pool.getConnection (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:48:16)\n at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7\n at new Promise (<anonymous>)\n at Pool.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:12:10)\n at Pool.ret [as getConnection] (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:56:34)\n at Pool.query (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:202:8)\n at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7\n sql: select now() as currentTime;","total":null,"requestBody":{},"method":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:39:39","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-22 23:39:39","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:43:45","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"game already paling","requestTime":"2020-04-22 23:43:45","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
+13
View File
@@ -24,3 +24,16 @@
{"pid":49495,"nodeVersion":"v12.16.1","launchTime":"2020-04-21 23:05:14","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoSIsImFjY291bnQiOiJjYWkxMTEiLCJ1c2VySWQiOjJ9LCJpYXQiOjE1ODc0ODE1MTQsImV4cCI6MTU4NzUwMzExNH0.C9J4r3Xp_Uf9eslayzzu8f_JOLdaAJd53NeeUsOvhx4","requestTime":"2020-04-21 23:05:14","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":49495,"nodeVersion":"v12.16.1","launchTime":"2020-04-21 23:05:14","osUser":"root","osUid":0,"fetchConsumeTime":180,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-21 23:05:14","status":200,"total":null,"requestBody":{"userAccount":"cai111","password":"123"},"url":"/node/user/login"}
{"pid":49588,"nodeVersion":"v12.16.1","launchTime":"2020-04-21 23:40:05","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"game already paling","requestTime":"2020-04-21 23:40:05","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51857,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:38:24","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"Handshake inactivity timeout","requestTime":"2020-04-22 23:38:24","stack":"Error: Handshake inactivity timeout\n at Handshake.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:160:17)\n at Handshake.emit (events.js:311:20)\n at Handshake._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/sequences/Sequence.js:124:8)\n at Timer._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Timer.js:32:23)\n at listOnTimeout (internal/timers.js:549:17)\n at processTimers (internal/timers.js:492:7)\n --------------------\n at Protocol._enqueue (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:144:48)\n at Protocol.handshake (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:51:23)\n at PoolConnection.connect (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Connection.js:116:18)\n at Pool.getConnection (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:48:16)\n at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7\n at new Promise (<anonymous>)\n at Pool.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:12:10)\n at Pool.ret [as getConnection] (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:56:34)\n at Pool.query (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:202:8)\n at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7\n sql: select now() as currentTime;","total":null,"requestBody":{},"method":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:39:39","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"room service tick","requestTime":"2020-04-22 23:39:39","stack":null,"status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:40:04","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6ImMiLCJhY2NvdW50IjoiY2FpIiwidXNlcklkIjoxfSwiaWF0IjoxNTg3NTcwMDA0LCJleHAiOjE1ODc1OTE2MDR9.qCv_9sbRdWKY2lYPVz6imLwUkvpRXr1ImmLIPLnwxf4","requestTime":"2020-04-22 23:40:04","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:40:04","osUser":"root","osUid":0,"fetchConsumeTime":208,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-22 23:40:04","status":200,"total":null,"requestBody":{"userAccount":"cai","password":"123"},"url":"/node/user/login"}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:40:05","osUser":"root","osUid":0,"fetchConsumeTime":109,"level":"INFO","message":"POST /node/game/room info","requestTime":"2020-04-22 23:40:05","status":200,"total":null,"requestBody":{},"url":"/node/game/room"}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:41:20","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6ImMiLCJhY2NvdW50IjoiY2FpIiwidXNlcklkIjoxfSwiaWF0IjoxNTg3NTcwMDgwLCJleHAiOjE1ODc1OTE2ODB9.S73RaBIpGQVhaELO6yfvBwDNUlrDdo1WUpfE4J_HwZs","requestTime":"2020-04-22 23:41:20","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:41:20","osUser":"root","osUid":0,"fetchConsumeTime":206,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-22 23:41:20","status":200,"total":null,"requestBody":{"userAccount":"cai","password":"123"},"url":"/node/user/login"}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:41:22","osUser":"root","osUid":0,"fetchConsumeTime":102,"level":"INFO","message":"POST /node/game/room info","requestTime":"2020-04-22 23:41:22","status":200,"total":null,"requestBody":{},"url":"/node/game/room"}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:41:48","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoTEiLCJhY2NvdW50IjoiY2FpMTEiLCJ1c2VySWQiOjN9LCJpYXQiOjE1ODc1NzAxMDgsImV4cCI6MTU4NzU5MTcwOH0.1kZQu3oihvSnCIkyBl9vFK8BK_6wxM7QvlMv0-cfggs","requestTime":"2020-04-22 23:41:48","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:41:48","osUser":"root","osUid":0,"fetchConsumeTime":203,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-22 23:41:48","status":200,"total":null,"requestBody":{"userAccount":"cai11","password":"123"},"url":"/node/user/login"}
{"pid":51873,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:43:45","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"ERROR","message":"game already paling","requestTime":"2020-04-22 23:43:45","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51959,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:45:53","osUser":"root","osUid":0,"fetchConsumeTime":0,"level":"INFO","message":"AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoSIsImFjY291bnQiOiJjYWkxMTEiLCJ1c2VySWQiOjJ9LCJpYXQiOjE1ODc1NzAzNTMsImV4cCI6MTU4NzU5MTk1M30.QCROHyWqK_5kwhIpE3i2AwOfqsktIcRC7J9FwoZFTX8","requestTime":"2020-04-22 23:45:53","stack":"","status":"","timestamp":"","total":0,"requestBody":{},"method":"","url":""}
{"pid":51959,"nodeVersion":"v12.16.1","launchTime":"2020-04-22 23:45:53","osUser":"root","osUid":0,"fetchConsumeTime":209,"level":"INFO","message":"POST /node/user/login info","requestTime":"2020-04-22 23:45:53","status":200,"total":null,"requestBody":{"userAccount":"cai111","password":"123"},"url":"/node/user/login"}
+38
View File
@@ -36,3 +36,41 @@
2020-04-21 23:40:30,609 INFO 51406 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/interface.ts"
2020-04-21 23:40:30,609 INFO 51406 [egg-watcher:agent] watcher start success
2020-04-21 23:40:30,621 INFO 51406 [egg:core] dump config after ready, 5ms
2020-04-22 23:38:13,556 INFO 51855 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"agent"}
2020-04-22 23:38:13,566 INFO 51855 [egg:core] dump config after load, 6ms
2020-04-22 23:38:13,628 INFO 51855 [egg-watcher] Start watching: ["/Users/jorky/code/TexasPokerGame/server/src/app","/Users/jorky/code/TexasPokerGame/server/src/lib","/Users/jorky/code/TexasPokerGame/server/src/service","/Users/jorky/code/TexasPokerGame/server/src/config","/Users/jorky/code/TexasPokerGame/server/src/app.ts","/Users/jorky/code/TexasPokerGame/server/src/agent.ts","/Users/jorky/code/TexasPokerGame/server/src/interface.ts"]
2020-04-22 23:38:13,629 INFO 51855 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app"
2020-04-22 23:38:13,629 INFO 51855 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/lib"
2020-04-22 23:38:13,629 INFO 51855 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/service"
2020-04-22 23:38:13,629 INFO 51855 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/config"
2020-04-22 23:38:13,630 INFO 51855 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app.ts"
2020-04-22 23:38:13,630 INFO 51855 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/agent.ts"
2020-04-22 23:38:13,631 INFO 51855 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/interface.ts"
2020-04-22 23:38:13,631 INFO 51855 [egg-watcher:agent] watcher start success
2020-04-22 23:38:13,805 INFO 51855 [egg:core] dump config after ready, 163ms
2020-04-22 23:39:33,398 INFO 51872 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"agent"}
2020-04-22 23:39:33,406 INFO 51872 [egg:core] dump config after load, 5ms
2020-04-22 23:39:33,436 INFO 51872 [egg-watcher] Start watching: ["/Users/jorky/code/TexasPokerGame/server/src/app","/Users/jorky/code/TexasPokerGame/server/src/lib","/Users/jorky/code/TexasPokerGame/server/src/service","/Users/jorky/code/TexasPokerGame/server/src/config","/Users/jorky/code/TexasPokerGame/server/src/app.ts","/Users/jorky/code/TexasPokerGame/server/src/agent.ts","/Users/jorky/code/TexasPokerGame/server/src/interface.ts"]
2020-04-22 23:39:33,436 INFO 51872 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app"
2020-04-22 23:39:33,436 INFO 51872 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/lib"
2020-04-22 23:39:33,436 INFO 51872 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/service"
2020-04-22 23:39:33,436 INFO 51872 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/config"
2020-04-22 23:39:33,436 INFO 51872 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app.ts"
2020-04-22 23:39:33,437 INFO 51872 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/agent.ts"
2020-04-22 23:39:33,437 INFO 51872 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/interface.ts"
2020-04-22 23:39:33,437 INFO 51872 [egg-watcher:agent] watcher start success
2020-04-22 23:39:33,452 INFO 51872 [egg:core] dump config after ready, 8ms
2020-04-22 23:44:42,430 INFO 51958 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"agent"}
2020-04-22 23:44:42,439 INFO 51958 [egg:core] dump config after load, 4ms
2020-04-22 23:44:42,488 INFO 51958 [egg-watcher] Start watching: ["/Users/jorky/code/TexasPokerGame/server/src/app","/Users/jorky/code/TexasPokerGame/server/src/lib","/Users/jorky/code/TexasPokerGame/server/src/service","/Users/jorky/code/TexasPokerGame/server/src/config","/Users/jorky/code/TexasPokerGame/server/src/app.ts","/Users/jorky/code/TexasPokerGame/server/src/agent.ts","/Users/jorky/code/TexasPokerGame/server/src/interface.ts"]
2020-04-22 23:44:42,488 INFO 51958 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app"
2020-04-22 23:44:42,488 INFO 51958 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/lib"
2020-04-22 23:44:42,488 INFO 51958 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/service"
2020-04-22 23:44:42,488 INFO 51958 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/config"
2020-04-22 23:44:42,488 INFO 51958 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/app.ts"
2020-04-22 23:44:42,489 INFO 51958 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/agent.ts"
2020-04-22 23:44:42,489 INFO 51958 [egg-watcher] Start watching: "/Users/jorky/code/TexasPokerGame/server/src/interface.ts"
2020-04-22 23:44:42,489 INFO 51958 [egg-watcher:agent] watcher start success
2020-04-22 23:44:42,500 INFO 51958 [egg:core] dump config after ready, 5ms
2020-04-22 23:51:32,377 INFO 51958 [egg-watcher] Recieved a change event from eventSource: {"event":"change","path":"/Users/jorky/code/TexasPokerGame/server/src/app/core/PokerGame.ts","stat":{"dev":16777220,"mode":33188,"nlink":1,"uid":501,"gid":20,"rdev":0,"blksize":4096,"ino":8594144547,"size":13522,"blocks":32,"atimeMs":1587569691708.252,"mtimeMs":1587570690863.5278,"ctimeMs":1587570690863.5278,"birthtimeMs":1587545680156.9385,"atime":"2020-04-22T15:34:51.708Z","mtime":"2020-04-22T15:51:30.864Z","ctime":"2020-04-22T15:51:30.864Z","birthtime":"2020-04-22T08:54:40.157Z"},"remove":false,"isDirectory":false,"isFile":true}
2020-04-22 23:51:32,585 WARN 51958 [agent:development] reload worker because /Users/jorky/code/TexasPokerGame/server/src/app/core/PokerGame.ts change
+86
View File
@@ -128,3 +128,89 @@
fetchEnd: 1587481514041
}
2020-04-21 23:40:05,073 ERROR 49588 game already paling
2020-04-22 23:38:24,980 ERROR 51857 [-/127.0.0.1/-/1ms GET /] nodejs.PROTOCOL_SEQUENCE_TIMEOUTError: Handshake inactivity timeout
at Handshake.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:160:17)
at Handshake.emit (events.js:311:20)
at Handshake._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/sequences/Sequence.js:124:8)
at Timer._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Timer.js:32:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
--------------------
at Protocol._enqueue (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:48:16)
at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7
at new Promise (<anonymous>)
at Pool.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:12:10)
at Pool.ret [as getConnection] (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:56:34)
at Pool.query (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:202:8)
at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7
sql: select now() as currentTime;
code: "PROTOCOL_SEQUENCE_TIMEOUT"
fatal: true
timeout: 10000
name: "PROTOCOL_SEQUENCE_TIMEOUTError"
pid: 51857
hostname: 192.168.0.105
2020-04-22 23:39:39,501 ERROR 51873 [-/192.168.0.105/-/12ms GET /socket.io/?room=751675&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoTEiLCJhY2NvdW50IjoiY2FpMTEiLCJ1c2VySWQiOjN9LCJpYXQiOjE1ODc0ODEyOTUsImV4cCI6MTU4NzUwMjg5NX0.04tWzzIEspNyYmtY-EzyesrnpVwD7zx-0zG7K9Rdb2s&EIO=3&transport=websocket] room service tick null
2020-04-22 23:40:04,092 INFO 51873 [-/192.168.0.105/-/209ms POST /node/user/login] AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6ImMiLCJhY2NvdW50IjoiY2FpIiwidXNlcklkIjoxfSwiaWF0IjoxNTg3NTcwMDA0LCJleHAiOjE1ODc1OTE2MDR9.qCv_9sbRdWKY2lYPVz6imLwUkvpRXr1ImmLIPLnwxf4
2020-04-22 23:40:04,094 INFO 51873 [-/192.168.0.105/-/211ms POST /node/user/login] {
fetchStart: 1587570003886,
url: '/node/user/login',
requestBody: { userAccount: 'cai', password: '123' },
message: 'POST /node/user/login info',
level: 'INFO',
status: 200,
fetchEnd: 1587570004094
}
2020-04-22 23:40:05,232 INFO 51873 [-/192.168.0.105/-/110ms POST /node/game/room] {
fetchStart: 1587570005123,
url: '/node/game/room',
requestBody: {},
message: 'POST /node/game/room info',
level: 'INFO',
status: 200,
fetchEnd: 1587570005232
}
2020-04-22 23:41:20,878 INFO 51873 [-/192.168.0.105/-/205ms POST /node/user/login] AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6ImMiLCJhY2NvdW50IjoiY2FpIiwidXNlcklkIjoxfSwiaWF0IjoxNTg3NTcwMDgwLCJleHAiOjE1ODc1OTE2ODB9.S73RaBIpGQVhaELO6yfvBwDNUlrDdo1WUpfE4J_HwZs
2020-04-22 23:41:20,879 INFO 51873 [-/192.168.0.105/-/206ms POST /node/user/login] {
fetchStart: 1587570080673,
url: '/node/user/login',
requestBody: { userAccount: 'cai', password: '123' },
message: 'POST /node/user/login info',
level: 'INFO',
status: 200,
fetchEnd: 1587570080879
}
2020-04-22 23:41:22,229 INFO 51873 [-/192.168.0.105/-/103ms POST /node/game/room] {
fetchStart: 1587570082127,
url: '/node/game/room',
requestBody: {},
message: 'POST /node/game/room info',
level: 'INFO',
status: 200,
fetchEnd: 1587570082229
}
2020-04-22 23:41:48,445 INFO 51873 [-/192.168.0.105/-/202ms POST /node/user/login] AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoTEiLCJhY2NvdW50IjoiY2FpMTEiLCJ1c2VySWQiOjN9LCJpYXQiOjE1ODc1NzAxMDgsImV4cCI6MTU4NzU5MTcwOH0.1kZQu3oihvSnCIkyBl9vFK8BK_6wxM7QvlMv0-cfggs
2020-04-22 23:41:48,446 INFO 51873 [-/192.168.0.105/-/203ms POST /node/user/login] {
fetchStart: 1587570108243,
url: '/node/user/login',
requestBody: { userAccount: 'cai11', password: '123' },
message: 'POST /node/user/login info',
level: 'INFO',
status: 200,
fetchEnd: 1587570108446
}
2020-04-22 23:43:45,866 ERROR 51873 game already paling
2020-04-22 23:45:53,762 INFO 51959 [-/192.168.0.101/-/233ms POST /node/user/login] AccountService getToken token--eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoSIsImFjY291bnQiOiJjYWkxMTEiLCJ1c2VySWQiOjJ9LCJpYXQiOjE1ODc1NzAzNTMsImV4cCI6MTU4NzU5MTk1M30.QCROHyWqK_5kwhIpE3i2AwOfqsktIcRC7J9FwoZFTX8
2020-04-22 23:45:53,766 INFO 51959 [-/192.168.0.101/-/237ms POST /node/user/login] {
fetchStart: 1587570353557,
url: '/node/user/login',
requestBody: { userAccount: 'cai111', password: '123' },
message: 'POST /node/user/login info',
level: 'INFO',
status: 200,
fetchEnd: 1587570353766
}
+51
View File
@@ -145,3 +145,54 @@ hostname: 192.168.0.105
2020-04-21 23:40:32,009 INFO 51407 [egg-watcher:application] watcher start success
2020-04-21 23:40:32,220 INFO 51407 [egg-mysql] instance[0] status OK, rds currentTime: Tue Apr 21 2020 23:40:32 GMT+0800 (China Standard Time)
2020-04-21 23:40:32,250 INFO 51407 [egg:core] dump config after ready, 6ms
2020-04-22 23:38:14,656 INFO 51857 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"application"}
2020-04-22 23:38:14,680 INFO 51857 [egg-multipart] stream mode enable
2020-04-22 23:38:14,746 INFO 51857 [egg-redis] server connecting redis://:***@127.0.0.1:6379/0
2020-04-22 23:38:14,765 INFO 51857 [egg-mysql] connecting root@47.104.172.100:3306/poker
2020-04-22 23:38:14,942 INFO 51857 [egg-static] starting static serve /public/ -> /Users/jorky/code/TexasPokerGame/server/src/app/public
2020-04-22 23:38:14,944 INFO 51857 [egg-security] use noopen middleware
2020-04-22 23:38:14,944 INFO 51857 [egg-security] use nosniff middleware
2020-04-22 23:38:14,945 INFO 51857 [egg-security] use xssProtection middleware
2020-04-22 23:38:14,945 INFO 51857 [egg-security] use xframe middleware
2020-04-22 23:38:14,946 INFO 51857 [egg-security] use dta middleware
2020-04-22 23:38:14,946 INFO 51857 [egg-security] compose 5 middlewares into one security middleware
2020-04-22 23:38:14,957 INFO 51857 [egg:core] dump config after load, 8ms
2020-04-22 23:38:14,970 INFO 51857 [egg-redis] client connect success
2020-04-22 23:38:14,975 INFO 51857 [egg-redis] instance[0] status OK, client ready
2020-04-22 23:38:14,977 INFO 51857 [egg-watcher:application] watcher start success
2020-04-22 23:38:25,007 INFO 51857 [egg:core] dump config after ready, 8ms
2020-04-22 23:39:34,340 INFO 51873 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"application"}
2020-04-22 23:39:34,362 INFO 51873 [egg-multipart] stream mode enable
2020-04-22 23:39:34,422 INFO 51873 [egg-redis] server connecting redis://:***@127.0.0.1:6379/0
2020-04-22 23:39:34,439 INFO 51873 [egg-mysql] connecting root@47.104.172.100:3306/poker
2020-04-22 23:39:34,605 INFO 51873 [egg-static] starting static serve /public/ -> /Users/jorky/code/TexasPokerGame/server/src/app/public
2020-04-22 23:39:34,607 INFO 51873 [egg-security] use noopen middleware
2020-04-22 23:39:34,608 INFO 51873 [egg-security] use nosniff middleware
2020-04-22 23:39:34,609 INFO 51873 [egg-security] use xssProtection middleware
2020-04-22 23:39:34,610 INFO 51873 [egg-security] use xframe middleware
2020-04-22 23:39:34,611 INFO 51873 [egg-security] use dta middleware
2020-04-22 23:39:34,611 INFO 51873 [egg-security] compose 5 middlewares into one security middleware
2020-04-22 23:39:34,620 INFO 51873 [egg:core] dump config after load, 5ms
2020-04-22 23:39:34,631 INFO 51873 [egg-redis] client connect success
2020-04-22 23:39:34,636 INFO 51873 [egg-redis] instance[0] status OK, client ready
2020-04-22 23:39:34,639 INFO 51873 [egg-watcher:application] watcher start success
2020-04-22 23:39:34,880 INFO 51873 [egg-mysql] instance[0] status OK, rds currentTime: Wed Apr 22 2020 23:39:34 GMT+0800 (China Standard Time)
2020-04-22 23:39:34,926 INFO 51873 [egg:core] dump config after ready, 8ms
2020-04-22 23:44:43,668 INFO 51959 [egg:logger] init all loggers with options: {"dir":"/Users/jorky/code/TexasPokerGame/server/logs/game-node-center","encoding":"utf8","env":"local","level":"INFO","consoleLevel":"INFO","disableConsoleAfterReady":false,"outputJSON":false,"buffer":true,"appLogName":"app.log","coreLogName":"core.log","agentLogName":"agent.log","errorLogName":"error.log","coreLogger":{"consoleLevel":"WARN"},"allowDebugAtProd":false,"type":"application"}
2020-04-22 23:44:43,690 INFO 51959 [egg-multipart] stream mode enable
2020-04-22 23:44:43,735 INFO 51959 [egg-redis] server connecting redis://:***@127.0.0.1:6379/0
2020-04-22 23:44:43,755 INFO 51959 [egg-mysql] connecting root@47.104.172.100:3306/poker
2020-04-22 23:44:43,970 INFO 51959 [egg-static] starting static serve /public/ -> /Users/jorky/code/TexasPokerGame/server/src/app/public
2020-04-22 23:44:43,973 INFO 51959 [egg-security] use noopen middleware
2020-04-22 23:44:43,974 INFO 51959 [egg-security] use nosniff middleware
2020-04-22 23:44:43,975 INFO 51959 [egg-security] use xssProtection middleware
2020-04-22 23:44:43,976 INFO 51959 [egg-security] use xframe middleware
2020-04-22 23:44:43,977 INFO 51959 [egg-security] use dta middleware
2020-04-22 23:44:43,977 INFO 51959 [egg-security] compose 5 middlewares into one security middleware
2020-04-22 23:44:43,989 INFO 51959 [egg:core] dump config after load, 7ms
2020-04-22 23:44:44,008 INFO 51959 [egg-redis] client connect success
2020-04-22 23:44:44,015 INFO 51959 [egg-redis] instance[0] status OK, client ready
2020-04-22 23:44:44,017 INFO 51959 [egg-watcher:application] watcher start success
2020-04-22 23:44:44,198 INFO 51959 [egg-mysql] instance[0] status OK, rds currentTime: Wed Apr 22 2020 23:44:44 GMT+0800 (China Standard Time)
2020-04-22 23:44:44,224 INFO 51959 [egg:core] dump config after ready, 9ms
2020-04-22 23:50:16,776 ERROR 51959 incorrect action: check
@@ -28,3 +28,18 @@
2020-04-21 23:40:31,699 INFO 51407 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js
2020-04-21 23:40:31,699 INFO 51407 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js
2020-04-21 23:40:31,699 INFO 51407 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js
2020-04-22 23:38:14,679 INFO 51857 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js
2020-04-22 23:38:14,679 INFO 51857 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js
2020-04-22 23:38:14,679 INFO 51857 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js
2020-04-22 23:39:34,361 INFO 51873 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js
2020-04-22 23:39:34,361 INFO 51873 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js
2020-04-22 23:39:34,361 INFO 51873 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js
2020-04-22 23:39:34,932 INFO 51872 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js next time will execute after 17425071ms at 2020-04-23 04:30:00.003
2020-04-22 23:39:34,932 INFO 51872 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js next time will execute after 1225068ms at 2020-04-23 00:00:00.000
2020-04-22 23:39:34,933 INFO 51872 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js next time will execute after 1226068ms at 2020-04-23 00:00:01.001
2020-04-22 23:44:44,233 INFO 51958 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js next time will execute after 17115770ms at 2020-04-23 04:30:00.003
2020-04-22 23:44:44,234 INFO 51958 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js next time will execute after 915767ms at 2020-04-23 00:00:00.001
2020-04-22 23:44:44,234 INFO 51958 [Timer] /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js next time will execute after 916766ms at 2020-04-23 00:00:01.000
2020-04-22 23:44:43,690 INFO 51959 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-multipart/app/schedule/clean_tmpdir.js
2020-04-22 23:44:43,690 INFO 51959 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/clean_log.js
2020-04-22 23:44:43,690 INFO 51959 [egg-schedule]: register schedule /Users/jorky/code/TexasPokerGame/server/node_modules/egg-logrotator/app/schedule/rotate_by_file.js
+29
View File
@@ -11,3 +11,32 @@ hostname: 192.168.0.105
2020-04-21 23:04:55,154 ERROR 49495 [-/192.168.0.101/-/13ms GET /socket.io/?room=751675&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoSIsImFjY291bnQiOiJjYWkxMTEiLCJ1c2VySWQiOjJ9LCJpYXQiOjE1ODczOTk4ODQsImV4cCI6MTU4NzQyMTQ4NH0.CVCe19KN0vg_4m1-axLTR6pz7DQPRQkcOWvBN5mn6PE&EIO=3&transport=websocket] room service tick null
2020-04-21 23:40:05,072 ERROR 49588 game already paling
2020-04-22 23:38:24,979 ERROR 51857 [-/127.0.0.1/-/1ms GET /] nodejs.PROTOCOL_SEQUENCE_TIMEOUTError: Handshake inactivity timeout
at Handshake.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:160:17)
at Handshake.emit (events.js:311:20)
at Handshake._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/sequences/Sequence.js:124:8)
at Timer._onTimeout (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Timer.js:32:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
--------------------
at Protocol._enqueue (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:48:16)
at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7
at new Promise (<anonymous>)
at Pool.<anonymous> (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:12:10)
at Pool.ret [as getConnection] (/Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:56:34)
at Pool.query (/Users/jorky/code/TexasPokerGame/server/node_modules/mysql/lib/Pool.js:202:8)
at /Users/jorky/code/TexasPokerGame/server/node_modules/ali-rds/node_modules/pify/index.js:29:7
sql: select now() as currentTime;
code: "PROTOCOL_SEQUENCE_TIMEOUT"
fatal: true
timeout: 10000
name: "PROTOCOL_SEQUENCE_TIMEOUTError"
pid: 51857
hostname: 192.168.0.105
2020-04-22 23:39:39,501 ERROR 51873 [-/192.168.0.105/-/12ms GET /socket.io/?room=751675&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Im5pY2tfbmFtZSI6IuiUoTEiLCJhY2NvdW50IjoiY2FpMTEiLCJ1c2VySWQiOjN9LCJpYXQiOjE1ODc0ODEyOTUsImV4cCI6MTU4NzUwMjg5NX0.04tWzzIEspNyYmtY-EzyesrnpVwD7zx-0zG7K9Rdb2s&EIO=3&transport=websocket] room service tick null
2020-04-22 23:43:45,865 ERROR 51873 game already paling
2020-04-22 23:50:16,775 ERROR 51959 incorrect action: check
+5 -4
View File
@@ -76,7 +76,7 @@ export class Player {
let size = 0;
if (command !== ECommand.ALL_IN
&& (prevSize > (this.counter + this.actionSize) || raiseSize > this.counter)) {
throw 'error action, overflow action size';
throw 'player: error action, overflow action size';
}
// BLIND
@@ -90,7 +90,7 @@ export class Player {
if (this.position === 3) {
size = raiseSize;
} else {
throw 'error action STRADDLE';
throw 'player: error action STRADDLE';
}
}
@@ -98,9 +98,9 @@ export class Player {
if (command === ECommand.RAISE) {
// raise must double to prevSize
if ((raiseSize + this.actionSize) >= prevSize * 2) {
size = raiseSize + this.actionSize;
size = raiseSize;
} else {
throw 'error action: raise size too small';
throw 'player: error action: raise size too small';
}
}
@@ -109,6 +109,7 @@ export class Player {
}
if (command === ECommand.CALL) {
console.log('player: call----------------', prevSize, this.actionSize);
size = prevSize - this.actionSize;
}
+42 -35
View File
@@ -24,6 +24,8 @@ export enum EGameStatus {
GAME_OVER,
}
const ACTION_TIME = 60 * 1000;
export class PokerGame {
commonCard: string[] = [];
fireCards: string[] = [];
@@ -88,9 +90,12 @@ export class PokerGame {
play() {
this.status = EGameStatus.GAME_START;
this.sendCard();
}
startActionRound() {
this.actionTimeOut = setTimeout(async () => {
this.action('fold');
}, 6000);
}, ACTION_TIME);
}
action(commandString: string) {
@@ -120,7 +125,8 @@ export class PokerGame {
&& this.prevSize === this.smallBlind * 2, 'big blind', this.currPlayer);
// prev player must be check
if (!(this.prevSize === 0 ||
(this.currPlayer.node.type === EPlayerType.BIG_BLIND
((this.currPlayer.node.type === EPlayerType.BIG_BLIND
|| this.playerSize === 2 && this.currPlayer.node.type === EPlayerType.DEALER)
&& this.prevSize === this.smallBlind * 2))) {
throw 'incorrect action: check';
}
@@ -134,39 +140,41 @@ export class PokerGame {
throw 'incorrect action: raise';
}
}
this.currPlayer.node.action(commandString, this.prevSize);
this.prevSize = size;
const nextPlayer = this.currPlayer.next.node;
// all check actionSize === -1
// all player allin
// only 2 player, curr player fold, next player already action
// only one player ,one player fold,other player allin
// pre flop big blind check and other player call
// console.log('this.currPlayer----------', this.currPlayer, nextPlayer, command);
if (this.playerSize === 0
|| (command === ECommand.FOLD && this.currPlayer.next.node.actionSize !== 0)
|| (nextPlayer.actionSize === this.currPlayer.node.actionSize && command !== ECommand.FOLD)
|| (this.commonCard.length === 0
&& this.currPlayer.node.type === EPlayerType.BIG_BLIND
&& command === ECommand.CHECK)) {
// console.log('ccc------', this.currPlayer, nextPlayer, command, this.playerSize);
console.log('actionComplete');
this.actionComplete();
try {
clearTimeout(this.actionTimeOut);
return;
}
this.currPlayer = this.currPlayer.next;
// action time is 60s
clearTimeout(this.actionTimeOut);
console.log('action auto');
this.actionTimeOut = setTimeout(async () => {
if (command === ECommand.CHECK || command === ECommand.FOLD) {
this.action('check');
} else {
this.action('fold');
this.currPlayer.node.action(commandString, this.prevSize);
this.prevSize = size;
const nextPlayer = this.currPlayer.next.node;
// all check actionSize === -1
// all player allin
// only 2 player, curr player fold, next player already action
// only one player ,one player fold,other player allin
// pre flop big blind check and other player call
console.log('this.currPlayer----------', this.currPlayer, nextPlayer, command);
if (this.playerSize === 0
|| (nextPlayer.actionSize === size)
|| (this.commonCard.length === 0
&& (this.currPlayer.node.type === EPlayerType.BIG_BLIND
|| this.playerSize === 2 && this.currPlayer.node.type === EPlayerType.DEALER)
&& command === ECommand.CHECK)) {
// console.log('ccc------', this.currPlayer, nextPlayer, command, this.playerSize);
console.log('actionComplete');
this.actionComplete();
return;
}
}, 6000);
this.currPlayer = this.currPlayer.next;
// action time is 60s
console.log('action auto');
this.actionTimeOut = setTimeout(() => {
if (command === ECommand.CHECK || command === ECommand.FOLD) {
this.action('check');
} else {
this.action('fold');
}
}, ACTION_TIME);
} catch (e) {
throw 'action:' + e;
}
} else {
throw 'incorrect action flow';
}
@@ -216,6 +224,7 @@ export class PokerGame {
if (this.status === EGameStatus.GAME_SHOWDOWN || this.playerSize <= 1) {
this.gameOver();
}
this.updateCommonCard();
}
setSate() {
if (this.status === EGameStatus.GAME_ACTION) {
@@ -246,14 +255,12 @@ export class PokerGame {
this.fireCards.push(this.poker.getCard());
this.flop();
this.setSate();
this.updateCommonCard();
return;
}
if (this.status === EGameStatus.GAME_TURN || this.status === EGameStatus.GAME_RIVER) {
this.fireCards.push(this.poker.getCard());
this.commonCard.push(this.poker.getCard());
this.setSate();
this.updateCommonCard();
return;
}
throw 'error flow sendCard';
+83 -58
View File
@@ -26,66 +26,49 @@ class GameController extends BaseSocketController {
users: roomInfo.players,
smallBlind: 1,
updateCommonCard: () => {
console.log('send common card');
this.nsp.adapter.clients([ this.roomNumber ], (err: any, clients: any) => {
if (roomInfo.game) {
// 更新common card
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'commonCard',
target: 'participator',
data: {
commonCard: roomInfo.game.commonCard,
},
});
}
});
// game over
if (roomInfo.game?.status !== 6) {
roomInfo.game?.startActionRound();
roomInfo.game?.sendCard();
} else {
console.log('game over-------------');
console.log(roomInfo.game.commonCard);
console.log(roomInfo.game.pot);
console.log(roomInfo.game.getPlayers());
console.log(roomInfo.game.winner);
}
console.log('send common card', roomInfo.game?.status);
this.nsp.adapter.clients([ this.roomNumber ],
(err: any, clients: any) => {
if (roomInfo.game) {
// 更新common card
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'commonCard',
target: 'participator',
data: {
commonCard: roomInfo.game.commonCard,
},
});
}
});
},
});
roomInfo.game.play();
roomInfo.game.startActionRound();
console.log('hand card', roomInfo.game.allPlayer);
// update counter, pot
this.nsp.adapter.clients([ this.roomNumber ], (err: any, clients: any) => {
if (roomInfo.game) {
roomInfo.players.forEach(p => {
const currPlayer = roomInfo.game && roomInfo.game.allPlayer.find(player => player.userId === p.userId);
p.counter = currPlayer && currPlayer.counter || 0;
});
const gameInfo = {
players: roomInfo.game.allPlayer.map(p => Object.assign({}, {
counter: p.counter,
actionSize: p.actionSize,
nick_name: p.nick_name,
type: p.type,
}, {})),
pot: roomInfo.game.pot,
prevSize: roomInfo.game.prevSize,
currPlayer: {
userId: roomInfo.game.currPlayer.node.userId,
},
};
// 广播信息
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'gameInfo',
target: 'participator',
data: gameInfo,
});
}
});
await this.updateGameInfo();
roomInfo.players.forEach(p => {
if (roomInfo.game) {
// console.log('game msg---------1');
const player = roomInfo.game.allPlayer.find(player => player.socketId === p.socketId);
// console.log(player, 'game msg---------1');
if (player) {
const msg = this.ctx.helper.parseMsg('handCard', {
handCard: player.getHandCard(),
}, { client: p.socketId });
console.log(msg, 'game msg---------', p.socketId);
this.nsp.emit(p.socketId, msg);
}
}
// console.log('game msg---------1');
const player = roomInfo.game?.allPlayer.find(
player => player.socketId === p.socketId);
// console.log(player, 'game msg---------1');
const msg = this.ctx.helper.parseMsg('handCard', {
handCard: player?.getHandCard(),
}, { client: p.socketId });
console.log(msg, 'game msg---------', p.socketId);
this.nsp.emit(p.socketId, msg);
});
} else {
throw 'game already paling';
@@ -101,7 +84,8 @@ class GameController extends BaseSocketController {
const roomInfo: IRoomInfo = await this.getRoomInfo();
const { payload } = this.ctx.args[0] || {};
const { buyInSize } = payload;
const player = roomInfo.players.find((p: IPlayer) => p.nick_name === userInfo.nick_name);
const player = roomInfo.players.find(
(p: IPlayer) => p.nick_name === userInfo.nick_name);
console.log(userInfo, 'userInfo------');
if (player) {
player.counter = buyInSize;
@@ -132,10 +116,12 @@ class GameController extends BaseSocketController {
try {
const userInfo: IPlayer = await this.getUserInfo();
const roomInfo: IRoomInfo = await this.getRoomInfo();
const player = roomInfo.players.find((p: IPlayer) => p.nick_name === userInfo.nick_name);
const player = roomInfo.players.find(
(p: IPlayer) => p.nick_name === userInfo.nick_name);
console.log(userInfo, 'userInfo------');
if (player && roomInfo.game) {
const gamePlayer = roomInfo.game.allPlayer.find(p => player.socketId === p.socketId);
const gamePlayer = roomInfo.game.allPlayer.find(
p => player.socketId === p.socketId);
if (gamePlayer) {
const msg = this.ctx.helper.parseMsg('handCard', {
handCard: gamePlayer.getHandCard(),
@@ -151,14 +137,53 @@ class GameController extends BaseSocketController {
}
}
async updateGameInfo() {
const roomInfo = await this.getRoomInfo();
this.nsp.adapter.clients([ this.roomNumber ], (err: any, clients: any) => {
if (roomInfo.game) {
roomInfo.players.forEach(p => {
const currPlayer = roomInfo.game &&
roomInfo.game.allPlayer.find(player => player.userId === p.userId);
p.counter = currPlayer && currPlayer.counter || 0;
});
const gameInfo = {
players: roomInfo.game.allPlayer.map(p => Object.assign({}, {
counter: p.counter,
actionSize: p.actionSize,
nick_name: p.nick_name,
type: p.type,
}, {})),
pot: roomInfo.game.pot,
prevSize: roomInfo.game.prevSize,
currPlayer: {
userId: roomInfo.game.currPlayer.node.userId,
},
};
// 广播信息
this.nsp.to(this.roomNumber).emit('online', {
clients,
action: 'gameInfo',
target: 'participator',
data: gameInfo,
});
}
});
}
async action() {
try {
const { payload } = this.message;
const userInfo: IPlayer = await this.getUserInfo();
const roomInfo = await this.getRoomInfo();
if (roomInfo.game && roomInfo.game.currPlayer.node.userId === userInfo.userId) {
console.log('action', payload.command);
console.log('action', roomInfo.game && roomInfo.game.currPlayer.node,
userInfo);
if (roomInfo.game && roomInfo.game.currPlayer.node.userId ===
userInfo.userId) {
roomInfo.game.action(payload.command);
// todo notice next player action
await this.updateGameInfo();
console.log('curr player', roomInfo.game.currPlayer.node);
} else {
throw 'action flow incorrect';
}
+9 -9
View File
@@ -19,13 +19,13 @@ describe('test/app/core/pokerGame.test.ts', () => {
account: '2',
socketId: '2',
},
{
userId: '3',
counter: 50,
nick_name: '3',
account: '3',
socketId: '3',
},
// {
// userId: '3',
// counter: 50,
// nick_name: '3',
// account: '3',
// socketId: '3',
// },
];
/**
@@ -39,7 +39,6 @@ describe('test/app/core/pokerGame.test.ts', () => {
});
game.play();
expect(game.status).to.equal(EGameStatus.GAME_ACTION);
expect(game.currPlayer.node.actionSize).to.equal(0);
expect(game.pot).to.equal(3);
expect(game.pot).to.equal(3);
expect(game.playerLink.getNode(1).node.actionSize).to.equal(1);
@@ -55,7 +54,8 @@ describe('test/app/core/pokerGame.test.ts', () => {
updateCommonCard: () => {},
});
game.play();
// game.action('call');
game.action('raise:9');
game.action('call');
// game.action('call');
// game.action('call');
// game.action('call');