first
commit
a7241242f3
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="game_mj_changsha" />
|
||||
<module name="robot_mj_changsha" />
|
||||
<module name="taurus-core" />
|
||||
<module name="pack_tools" />
|
||||
<module name="robot_common" />
|
||||
<module name="game_pk_paodekuai" />
|
||||
<module name="data_cache" />
|
||||
<module name="game_mj_hongzhong" />
|
||||
<module name="web_group" />
|
||||
<module name="robot_mgr" />
|
||||
<module name="web_login" />
|
||||
<module name="taurus-permanent" />
|
||||
<module name="event_mgr" />
|
||||
<module name="taurus-web" />
|
||||
<module name="game_common" />
|
||||
<module name="group_mgr" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/game_web/event_mgr/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/event_mgr/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/group_room_mgr/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/group_room_mgr/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/pack_tools/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/pack_tools/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/robot_mgr/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/robot_mgr/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/web_group/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/web_group/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/web_login20/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/game_web/web_login20/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/data_cache/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/data_cache/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/game_common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/game_common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/robot_common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/robot_common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/robot_common_bak/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/robot_common_bak/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/taurus-core/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/taurus-core/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/taurus-permanent/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/taurus-permanent/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/taurus-web/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/libs/taurus-server/taurus-web/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/majiang/changsha/game_mj_cs/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/majiang/changsha/game_mj_cs/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/majiang/hongzhong/game_mj_hz/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/majiang/hongzhong/game_mj_hz/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/puke/paodekuai/game_pk_paodekuai/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/puke/paodekuai/game_pk_paodekuai/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/robots/majiang/robot_mj_cs/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/robots/majiang/robot_mj_cs/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/libs/taurus-server/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/libs/robot_common/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/libs/game_common/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/libs/data_cache/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/game_web/web_login20/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/game_web/web_group/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/game_web/group_room_mgr/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/game_web/event_mgr/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/game_web/robot_mgr/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/majiang/changsha/game_mj_cs/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/robots/majiang/robot_mj_cs/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/puke/paodekuai/game_pk_paodekuai/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/majiang/hongzhong/game_mj_hz/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/game_web/pack_tools/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/xtserver_anchou.iml" filepath="$PROJECT_DIR$/.idea/xtserver_anchou.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<serivce-core>
|
||||
<log4jPath>log4j.properties</log4jPath>
|
||||
|
||||
<plugin>
|
||||
<id>database</id>
|
||||
<class>com.taurus.core.plugin.database.DataBasePlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认10个 -->
|
||||
<maxPool>100</maxPool>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>10</minIdle>
|
||||
<!-- 配置获取连接等待超时的时间,单位是毫秒, 默认180000 -->
|
||||
<maxLifetime>180000</maxLifetime>
|
||||
<!--hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
Oracle - "select 1 from dual"
|
||||
DB2 - "select 1 from sysibm.sysdummy1"
|
||||
mysql - "select 1" -->
|
||||
<validationQuery>select 1</validationQuery>
|
||||
<!-- 连接超时时间,默认30000-->
|
||||
<connectionTimeout>10000</connectionTimeout>
|
||||
<!-- 待机超时时间,单位是毫秒, 默认60000 -->
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
|
||||
<!-- jdbc 属性 -->
|
||||
<props>
|
||||
<useSSL>false</useSSL>
|
||||
<useUnicode>true</useUnicode>
|
||||
<characterEncoding>utf-8</characterEncoding>
|
||||
<!-- 服务器时区 -->
|
||||
<serverTimezone>UTC</serverTimezone>
|
||||
<!-- 预编译缓存 -->
|
||||
<cachePrepStmts>true</cachePrepStmts>
|
||||
<!-- 预编译缓存大小 -->
|
||||
<prepStmtCacheSize>250</prepStmtCacheSize>
|
||||
<!-- 控制长度多大的sql可以被缓存 -->
|
||||
<prepStmtCacheSqlLimit>2048</prepStmtCacheSqlLimit>
|
||||
</props>
|
||||
</poolConfig>
|
||||
|
||||
<databases>
|
||||
<db>
|
||||
<name>db1</name>
|
||||
<driverName>com.mysql.cj.jdbc.Driver</driverName>
|
||||
<jdbcUrl>jdbc:mysql://192.168.0.11:6060/wb_game</jdbcUrl>
|
||||
<userName>proto_ff</userName>
|
||||
<password>37du_game</password>
|
||||
</db>
|
||||
</databases>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<id>redis</id>
|
||||
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>80</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>20</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>5</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" password="123456" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" password="123456" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db5" host="127.0.0.1" password="123456" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="127.0.0.1" password="123456" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" password="123456" port="6379" database="10" timeout="5000"/>
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||
|
||||
|
||||
# Regular FileAppender
|
||||
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||
log4j.appender.fileAppender.Encoding=UTF-8
|
||||
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.dailyFile.Append=true
|
||||
|
||||
# The file is rolled over very day
|
||||
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<serivce-core>
|
||||
<log4jPath>log4j.properties</log4jPath>
|
||||
|
||||
<plugin>
|
||||
<id>database</id>
|
||||
<class>com.taurus.core.plugin.database.DataBasePlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认10个 -->
|
||||
<maxPool>100</maxPool>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>5</minIdle>
|
||||
<!-- 配置获取连接等待超时的时间,单位是毫秒, 默认180000 -->
|
||||
<maxLifetime>180000</maxLifetime>
|
||||
<!--hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
Oracle - "select 1 from dual"
|
||||
DB2 - "select 1 from sysibm.sysdummy1"
|
||||
mysql - "select 1" -->
|
||||
<validationQuery>select 1</validationQuery>
|
||||
<!-- 连接超时时间,默认30000-->
|
||||
<connectionTimeout>10000</connectionTimeout>
|
||||
<!-- 待机超时时间,单位是毫秒, 默认60000 -->
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
|
||||
<!-- jdbc 属性 -->
|
||||
<props>
|
||||
<useSSL>false</useSSL>
|
||||
<useUnicode>true</useUnicode>
|
||||
<characterEncoding>utf-8</characterEncoding>
|
||||
<!-- 服务器时区 -->
|
||||
<serverTimezone>UTC</serverTimezone>
|
||||
<!-- 预编译缓存 -->
|
||||
<cachePrepStmts>true</cachePrepStmts>
|
||||
<!-- 预编译缓存大小 -->
|
||||
<prepStmtCacheSize>250</prepStmtCacheSize>
|
||||
<!-- 控制长度多大的sql可以被缓存 -->
|
||||
<prepStmtCacheSqlLimit>2048</prepStmtCacheSqlLimit>
|
||||
</props>
|
||||
</poolConfig>
|
||||
|
||||
<databases>
|
||||
<db>
|
||||
<name>db1</name>
|
||||
<driverName>com.mysql.cj.jdbc.Driver</driverName>
|
||||
<jdbcUrl>jdbc:mysql://192.168.0.11:6060/wb_game</jdbcUrl>
|
||||
<userName>proto_ff</userName>
|
||||
<password>37du_game</password>
|
||||
</db>
|
||||
</databases>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<id>redis</id>
|
||||
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>80</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>8</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>2</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" password="123456" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" password="123456" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db2" host="127.0.0.1" password="123456" port="6379" database="2" timeout="5000"/>
|
||||
<info name="group1_db5" host="127.0.0.1" password="123456" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="127.0.0.1" password="123456" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db9" host="127.0.0.1" password="123456" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" password="123456" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="127.0.0.1" password="123456" port="6379" database="11" timeout="5000"/>
|
||||
<info name="group1_db15" host="127.0.0.1" password="123456" port="6379" database="15" timeout="5000"/>
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||
|
||||
|
||||
# Regular FileAppender
|
||||
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||
log4j.appender.fileAppender.Encoding=UTF-8
|
||||
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.dailyFile.Append=true
|
||||
|
||||
# The file is rolled over very day
|
||||
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<serivce-core>
|
||||
<log4jPath>log4j.properties</log4jPath>
|
||||
|
||||
<plugin>
|
||||
<id>database</id>
|
||||
<class>com.taurus.core.plugin.database.DataBasePlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认10个 -->
|
||||
<maxPool>100</maxPool>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>1</minIdle>
|
||||
<!-- 配置获取连接等待超时的时间,单位是毫秒, 默认180000 -->
|
||||
<maxLifetime>180000</maxLifetime>
|
||||
<!--hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
Oracle - "select 1 from dual"
|
||||
DB2 - "select 1 from sysibm.sysdummy1"
|
||||
mysql - "select 1" -->
|
||||
<validationQuery>select 1</validationQuery>
|
||||
<!-- 连接超时时间,默认30000-->
|
||||
<connectionTimeout>10000</connectionTimeout>
|
||||
<!-- 待机超时时间,单位是毫秒, 默认60000 -->
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
|
||||
<!-- jdbc 属性 -->
|
||||
<props>
|
||||
<useSSL>false</useSSL>
|
||||
<useUnicode>true</useUnicode>
|
||||
<characterEncoding>utf-8</characterEncoding>
|
||||
<!-- 服务器时区 -->
|
||||
<serverTimezone>UTC</serverTimezone>
|
||||
<!-- 预编译缓存 -->
|
||||
<cachePrepStmts>true</cachePrepStmts>
|
||||
<!-- 预编译缓存大小 -->
|
||||
<prepStmtCacheSize>250</prepStmtCacheSize>
|
||||
<!-- 控制长度多大的sql可以被缓存 -->
|
||||
<prepStmtCacheSqlLimit>2048</prepStmtCacheSqlLimit>
|
||||
</props>
|
||||
</poolConfig>
|
||||
|
||||
<databases>
|
||||
<db>
|
||||
<name>db1</name>
|
||||
<driverName>com.mysql.cj.jdbc.Driver</driverName>
|
||||
<jdbcUrl>jdbc:mysql://192.168.0.11:6060/wb_game</jdbcUrl>
|
||||
<userName>proto_ff</userName>
|
||||
<password>37du_game</password>
|
||||
</db>
|
||||
</databases>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<id>redis</id>
|
||||
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>80</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>8</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>2</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" password="123456" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" password="123456" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db2" host="127.0.0.1" password="123456" port="6379" database="2" timeout="5000"/>
|
||||
<info name="group1_db5" host="127.0.0.1" password="123456" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="127.0.0.1" password="123456" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db9" host="127.0.0.1" password="123456" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" password="123456" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="127.0.0.1" password="123456" port="6379" database="11" timeout="5000"/>
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.evt</groupId>
|
||||
<artifactId>event_mgr</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.0</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<build.type>pro</build.type>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--依赖 data_cache -->
|
||||
<dependency>
|
||||
<groupId>com.data</groupId>
|
||||
<artifactId>data_cache</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--依赖 taurus-core -->
|
||||
<dependency>
|
||||
<groupId>com.taurus</groupId>
|
||||
<artifactId>taurus-core</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--依赖 taurus-web -->
|
||||
<dependency>
|
||||
<groupId>com.taurus</groupId>
|
||||
<artifactId>taurus-web</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 需要用redis时导入 -->
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 需要用HikariCP时导入 ,自己在项目中添加 -->
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>3.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 需要用mysql时导入 ,自己在项目中添加 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.16</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/jdom/jdom -->
|
||||
<dependency>
|
||||
<groupId>jdom</groupId>
|
||||
<artifactId>jdom</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>2.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-webapp -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
<version>8.2.0.v20160908</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>ROOT</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<warSourceExcludes>logs/**,config/**</warSourceExcludes>
|
||||
<webResources>
|
||||
<resource>
|
||||
<targetPath>config/</targetPath>
|
||||
<directory>${project.basedir}/build/${build.type}/</directory>
|
||||
</resource>
|
||||
</webResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package com.evt.mgr;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.data.util.CountUtil;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.entity.TArray;
|
||||
import com.taurus.core.entity.TObject;
|
||||
import com.taurus.core.plugin.database.DataBase;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.util.StringUtil;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
public class EventController {
|
||||
private static final String EVENT_TYPE = "E";
|
||||
private static final String EVENT_GID = "gid";
|
||||
private static final String EVENT_UID = "uid";
|
||||
|
||||
public static final int execEvt(String key,boolean isGroupEvt) {
|
||||
int count = 0;
|
||||
do {
|
||||
String jsonStr = Redis.use(EventReceiver.CHACHE_KEY).rpop(key);
|
||||
if(StringUtil.isEmpty(jsonStr))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
ITObject data = null;
|
||||
try {
|
||||
data = TObject.newFromJsonData(jsonStr);
|
||||
} catch (Exception e) {
|
||||
EventServer.log.error(jsonStr + ":event json error!", e);
|
||||
}
|
||||
int type = 0;
|
||||
int uid = 0;
|
||||
int groupId =0;
|
||||
int reulst = 0;
|
||||
try {
|
||||
type = data.getInt(EVENT_TYPE);
|
||||
|
||||
if(isGroupEvt) {
|
||||
groupId = data.getInt(EVENT_GID);
|
||||
}else {
|
||||
uid = data.getInt(EVENT_UID);
|
||||
}
|
||||
|
||||
IHandler handler = EventServer.eventReceiver.getHandler(type);
|
||||
if(handler!=null) {
|
||||
if(isGroupEvt) {
|
||||
reulst = handler.processGroup(groupId, data);
|
||||
EventServer.log.info(jsonStr + " use time:" + (System.currentTimeMillis() - startTime) + " ms");
|
||||
}else {
|
||||
reulst = handler.process(uid, data);
|
||||
EventServer.log.info(jsonStr + " use time:" + (System.currentTimeMillis() - startTime) + " ms");
|
||||
}
|
||||
if(reulst!=0) {
|
||||
if(reulst == -1) {
|
||||
jsonStr = data.toJson();
|
||||
}
|
||||
Redis.use(EventReceiver.CHACHE_KEY).lpush(key, jsonStr);
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Redis.use("group1_db15").lpush(key, jsonStr);
|
||||
break;
|
||||
}
|
||||
|
||||
if(reulst == 0) {
|
||||
count++;
|
||||
}
|
||||
} while(true);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param uid
|
||||
* @param pay
|
||||
* @param cur_diamo
|
||||
* @param reason
|
||||
* @param gameId
|
||||
* @param groupId
|
||||
* @param pid
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static final void payDiamo(int uid,int pay,int cur_diamo,int reason,int gameId,int groupId,int pid) throws SQLException{
|
||||
ITArray data = TArray.newInstance();
|
||||
data.addInt(uid);
|
||||
data.addInt(pay);
|
||||
data.addInt(reason);
|
||||
data.addInt(gameId);
|
||||
data.addInt(groupId);
|
||||
data.addInt(cur_diamo);
|
||||
DataBase.use().prepareCallNonResult("sp_transfer_diamo", data);
|
||||
if(groupId>0) {
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
CountUtil.countLog(String.format("g%s:diamo_cost",groupId), pay, jedis9);
|
||||
if(pid > 0) {
|
||||
CountUtil.countLog(String.format("g%s:diamo_cost:p%s",groupId,pid), pay, jedis9,false,true);
|
||||
}
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final int execSql(String key) {
|
||||
int count = 0;
|
||||
do {
|
||||
String str = Redis.use(EventReceiver.CHACHE_KEY).rpop(key);
|
||||
//EventServer.log.info( " execsql:"+str);
|
||||
if(StringUtil.isEmpty(str))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
int reulst = 0;
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
int type = Integer.parseInt(str.substring(0,1));
|
||||
String sql = str.substring(1);
|
||||
if(type==1) {
|
||||
DataBase.use().executeUpdate(sql);
|
||||
EventServer.log.info(sql + " use time:" + (System.currentTimeMillis() - startTime) + " ms");
|
||||
}else {
|
||||
DataBase.use().executeCall(sql, false);
|
||||
EventServer.log.info(sql + " use time:" + (System.currentTimeMillis() - startTime) + " ms");
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Redis.use("group1_db15").lpush(key, str);
|
||||
break;
|
||||
}
|
||||
|
||||
if(reulst == 0) {
|
||||
count++;
|
||||
}
|
||||
} while(true);
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.evt.mgr;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.taurus.core.util.Logger;
|
||||
|
||||
public class EventReceiver {
|
||||
private final static String GROUP_EVT_KEY = "evt_group_";
|
||||
private final static String EVT_KEY = "event_";
|
||||
private final static String EVT_DB_KEY = "evt_db_";
|
||||
public final static String CHACHE_KEY = "group1_db8";
|
||||
|
||||
Map<Integer, IHandler> handlerMap;
|
||||
volatile boolean run;
|
||||
|
||||
public EventReceiver() {
|
||||
handlerMap = new HashMap<>();
|
||||
}
|
||||
|
||||
void start() {
|
||||
run = true;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
new GroupRunnable(i, this, 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
new GroupRunnable(i, this, 2);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
new GroupRunnable(i, this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
run = false;
|
||||
}
|
||||
|
||||
IHandler getHandler(int type) {
|
||||
IHandler handler = handlerMap.get(type);
|
||||
return handler;
|
||||
}
|
||||
|
||||
private static final class GroupRunnable implements Runnable {
|
||||
private Logger log = Logger.getLogger(GroupRunnable.class);
|
||||
EventReceiver receiver;
|
||||
int type;
|
||||
int id;
|
||||
Thread thread;
|
||||
|
||||
public GroupRunnable(int id, EventReceiver receiver, int type) {
|
||||
this.receiver = receiver;
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
this.thread = new Thread(this, id + "");
|
||||
this.thread.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (receiver.run) {
|
||||
int count=0;
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
switch (type) {
|
||||
case 1:
|
||||
count = EventController.execEvt(GROUP_EVT_KEY + this.id, true);
|
||||
break;
|
||||
case 2:
|
||||
count = EventController.execEvt(EVT_KEY + id, false);
|
||||
break;
|
||||
case 3:
|
||||
count = EventController.execSql(EVT_DB_KEY+id);
|
||||
break;
|
||||
}
|
||||
|
||||
long useTime = (System.currentTimeMillis() - startTime);
|
||||
if (count > 0)
|
||||
{
|
||||
EventServer.log.info("handle event:" + count + " use time:" + useTime + " ms");
|
||||
}
|
||||
if (useTime >= 30 || count >= 30)
|
||||
{
|
||||
Thread.sleep(1);
|
||||
}
|
||||
else if (count > 0){
|
||||
Thread.sleep(5);
|
||||
}
|
||||
else {
|
||||
Thread.sleep(20);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.evt.mgr;
|
||||
|
||||
import static org.quartz.CronScheduleBuilder.cronSchedule;
|
||||
import static org.quartz.JobBuilder.newJob;
|
||||
import static org.quartz.TriggerBuilder.newTrigger;
|
||||
|
||||
import com.evt.mgr.job.CleanGroupLogJob;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerFactory;
|
||||
import org.quartz.impl.StdSchedulerFactory;
|
||||
|
||||
import com.data.util.ConsumeCode;
|
||||
import com.data.util.EventType;
|
||||
import com.evt.mgr.handler.HandlerGroupMemberRound;
|
||||
import com.evt.mgr.handler.HandlerGroupRound;
|
||||
import com.evt.mgr.handler.HandlerHpConsume;
|
||||
import com.evt.mgr.handler.HandlerLose;
|
||||
import com.evt.mgr.handler.HandlerOver;
|
||||
import com.evt.mgr.handler.HandlerPay;
|
||||
import com.evt.mgr.handler.HandlerWin;
|
||||
import com.evt.mgr.job.CleanTimeOutRoomJob;
|
||||
import com.taurus.core.routes.Extension;
|
||||
import com.taurus.core.routes.Routes;
|
||||
import com.taurus.core.util.Logger;
|
||||
|
||||
public class EventServer extends Extension{
|
||||
static EventReceiver eventReceiver;
|
||||
static Logger log;
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
log = Logger.getLogger(EventServer.class);
|
||||
eventReceiver = new EventReceiver();
|
||||
initHandler();
|
||||
|
||||
initJob();
|
||||
|
||||
eventReceiver.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configRoute(Routes me) {
|
||||
}
|
||||
|
||||
public void initJob() {
|
||||
|
||||
try {
|
||||
log.info("clean invalid room, no diamond");
|
||||
|
||||
SchedulerFactory sf = new StdSchedulerFactory();
|
||||
Scheduler sched = sf.getScheduler();
|
||||
|
||||
JobDetail job = newJob(CleanTimeOutRoomJob.class).withIdentity("clean_group_room", "group").build();
|
||||
CronTrigger trigger= newTrigger().withIdentity("clean_group_room_trigger", "group").withSchedule(cronSchedule("0 0 5 * * ? ")).build();
|
||||
sched.scheduleJob(job, trigger);
|
||||
|
||||
job = newJob(CleanTimeOutRoomJob.class).withIdentity("clean_invalid_room", "group").build();
|
||||
trigger= newTrigger().withIdentity("clean_invalid_room_trigger", "group").withSchedule(cronSchedule("0 30 5 * * ? ")).build();
|
||||
sched.scheduleJob(job, trigger);
|
||||
|
||||
JobDetail log_job = newJob(CleanGroupLogJob.class).withIdentity("clean_group_member_log", "group").build();
|
||||
CronTrigger log_trigger= newTrigger().withIdentity("clean_group_member_log_trigger", "group").withSchedule(cronSchedule("0 0 0/1 * * ? ")).build();
|
||||
sched.scheduleJob(log_job, log_trigger);
|
||||
|
||||
log_job = newJob(CleanGroupLogJob.class).withIdentity("clean_group_hp_log", "group").build();
|
||||
log_trigger= newTrigger().withIdentity("clean_group_hp_log_trigger", "group").withSchedule(cronSchedule("0 0 0/1 * * ? ")).build();
|
||||
sched.scheduleJob(log_job, log_trigger);
|
||||
|
||||
log_job = newJob(CleanGroupLogJob.class).withIdentity("clean_rec_room_log", "group").build();
|
||||
log_trigger= newTrigger().withIdentity("clean_rec_room_log_trigger", "group").withSchedule(cronSchedule("0 0 0/1 * * ? ")).build();
|
||||
sched.scheduleJob(log_job, log_trigger);
|
||||
|
||||
sched.start();
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initHandler() {
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_OVER, new HandlerOver());
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_LOSE, new HandlerLose());
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_WIN, new HandlerWin());
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_PAY, new HandlerPay(ConsumeCode.DIAMO_JOIN_ROOM,true));
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_BACK_PAY, new HandlerPay(ConsumeCode.DIAMO_REFUND,false));
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_GROUP_ROOM, new HandlerPay(ConsumeCode.DIAMO_AGENT_ROOM,true));
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_CREATE_ROOM, new HandlerPay(ConsumeCode.DIAMO_CREAT_ROOM,true));
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_MAIL, new HandlerPay(ConsumeCode.DIAMO_MAIL,false));
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_WHEEL, new HandlerPay(ConsumeCode.DIAMO_WHEEL,false));
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_GROUP_ROUND, new HandlerGroupRound());
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_GROUP_MEMBER_ROUND, new HandlerGroupMemberRound());
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_GROUP_HP, new HandlerHpConsume());
|
||||
eventReceiver.handlerMap.put(EventType.REDIS_EVENT_ADDPAY, new HandlerPay(ConsumeCode.DIAMO_ADD,false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
eventReceiver.destroy();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.evt.mgr;
|
||||
|
||||
import com.data.util.EventType;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.entity.TObject;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
|
||||
public class GroupPublisherService {
|
||||
public static final String CHANNEL_NAME = "mgr_group";
|
||||
|
||||
private static final String CMD_UPDATE_MEMBER = "update_member";
|
||||
|
||||
private static final String CMD_DEL_ROOM = "del_room";
|
||||
|
||||
private final static String EVT_TYPE = "E";
|
||||
private final static String EVT_UID = "uid";
|
||||
|
||||
private final static String EVT_KEY = "event_";
|
||||
|
||||
/**
|
||||
* 1 hp 2 等级 3 合伙人等级
|
||||
*
|
||||
* @param groupId
|
||||
* @param uid
|
||||
* @param type
|
||||
* @param value
|
||||
*/
|
||||
public static void updateMemberEvt(int groupId, int uid, int type, int value) {
|
||||
ITObject data = TObject.newInstance();
|
||||
data.putInt("gid", groupId);
|
||||
data.putInt("uid", uid);
|
||||
data.putInt("type", type);
|
||||
data.putInt("value", value);
|
||||
data.putString("cmd", CMD_UPDATE_MEMBER);
|
||||
Redis.use("group1_db11").publish(CHANNEL_NAME, data.toJson());
|
||||
}
|
||||
|
||||
public static void delRoomEvt(int groupId, String roomid) {
|
||||
ITObject data = TObject.newInstance();
|
||||
data.putInt("gid", groupId);
|
||||
data.putString("roomid", roomid);
|
||||
data.putString("cmd", CMD_DEL_ROOM);
|
||||
Redis.use("group1_db11").publish(CHANNEL_NAME, data.toJson());
|
||||
}
|
||||
|
||||
/**
|
||||
* 返还钻石
|
||||
*
|
||||
* @param uid
|
||||
* @param pay
|
||||
* @param groupId
|
||||
*/
|
||||
public static void refundDiamo(int uid, int pay, int groupId, int gameId) {
|
||||
ITObject data = TObject.newInstance();
|
||||
data.putInt("pay", -pay);
|
||||
data.putInt("game", gameId);
|
||||
if (groupId > 0) {
|
||||
data.putInt("group", groupId);
|
||||
}
|
||||
//sendEvt(EventType.REDIS_EVENT_BACK_PAY, uid, data);
|
||||
}
|
||||
|
||||
private static void sendEvt(int type, int uid, ITObject data) {
|
||||
int id = uid % 10;
|
||||
data.putInt(EVT_UID, uid);
|
||||
data.putInt(EVT_TYPE, type);
|
||||
Redis.use(EventReceiver.CHACHE_KEY).lpush(EVT_KEY + id, data.toJson());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.evt.mgr;
|
||||
|
||||
import com.taurus.core.entity.ITObject;
|
||||
|
||||
public interface IHandler {
|
||||
|
||||
public int process(int uid,ITObject param) throws Exception;
|
||||
|
||||
public int processGroup(int groupId,ITObject param) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
package com.evt.mgr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.data.cache.GroupCache;
|
||||
import com.data.util.CountUtil;
|
||||
import com.data.util.Utility;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.util.DateUtils;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.Pipeline;
|
||||
|
||||
public class Utils {
|
||||
|
||||
|
||||
public static final void countValidAndTotal(Jedis jedis10, Pipeline pipeline9,int uid,int groupId,int pid, int valid_count, int valid_diamo, int all_count) {
|
||||
|
||||
if(valid_count > 0) {
|
||||
String gmv = String.format("g{%s}:m%s:valid_round", groupId,uid);
|
||||
CountUtil.countLogByDay30(gmv, valid_count, pipeline9);
|
||||
CountUtil.countLogByDay30(gmv + "_self", valid_count, pipeline9);
|
||||
}
|
||||
|
||||
if (valid_diamo > 0)
|
||||
{
|
||||
String gmv = String.format("g{%s}:m%s:valid_diamo", groupId,uid);
|
||||
CountUtil.countLogByDay30(gmv, valid_diamo, pipeline9);
|
||||
CountUtil.countLogByDay30(gmv + "_self", valid_diamo, pipeline9);
|
||||
}
|
||||
|
||||
String gmr = String.format("g{%s}:m%s:round_log", groupId, uid);
|
||||
CountUtil.countLogByDay30(gmr, 1, pipeline9,true);
|
||||
CountUtil.countLogByDay30(gmr + "_self", 1, pipeline9,true);
|
||||
|
||||
List<Integer> temp = Utility.getMemberParents(jedis10, groupId, uid, true);
|
||||
if(temp != null && temp.size() > 0) {
|
||||
|
||||
if(valid_count > 0) {
|
||||
|
||||
for(int i=0;i<temp.size();++i) {
|
||||
|
||||
int par = temp.get(i);
|
||||
if(par != uid) {
|
||||
String gmv = String.format("g{%s}:m%s:valid_round", groupId,par);
|
||||
CountUtil.countLogByDay30(gmv, valid_count, pipeline9);
|
||||
}
|
||||
|
||||
String gmvp = String.format("g{%s}:m%s:valid_round:p%s", groupId,par,pid);
|
||||
CountUtil.countLogByDay30(gmvp, valid_count, pipeline9);
|
||||
|
||||
String gmvp2 = String.format("g{%s}:m%s:valid_round2:p%s", groupId,par,pid);
|
||||
CountUtil.countLogByDay30(gmvp2, valid_count, pipeline9);
|
||||
|
||||
boolean add_uid = (uid == par || i == 0);
|
||||
if(add_uid == true) {
|
||||
String gmv = String.format("g{%s}:m%s:d_valid_round", groupId,par);
|
||||
CountUtil.countLogByDay30(gmv, valid_count, pipeline9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<temp.size();++i) {
|
||||
int par = temp.get(i);
|
||||
if(par != uid) {
|
||||
gmr = String.format("g{%s}:m%s:round_log", groupId,par);
|
||||
CountUtil.countLogByDay30(gmr, 1, pipeline9,true);
|
||||
}
|
||||
|
||||
gmr = String.format("g{%s}:m%s:valid_diamo:p%s", groupId,par,pid);
|
||||
CountUtil.countLogByDay30(gmr, valid_diamo, pipeline9);
|
||||
|
||||
gmr = String.format("g{%s}:m%s:all_count:p%s", groupId,par,pid);
|
||||
CountUtil.countLogByDay30(gmr, all_count, pipeline9,true);
|
||||
|
||||
boolean add_uid = (uid == par || i == 0);
|
||||
if(add_uid == true) {
|
||||
gmr = String.format("g{%s}:m%s:d_round_log", groupId,par);
|
||||
CountUtil.countLogByDay30(gmr, 1, pipeline9,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final void countValidAndTotal(Pipeline pipeline9,ITArray playerList, int groupId,int pid, int valid_count, int valid_diamo, int all_count) {
|
||||
|
||||
Jedis jedis10 = Redis.use("group1_db10").getJedis();
|
||||
try {
|
||||
|
||||
for(int i = 0; i < playerList.size(); i++) {
|
||||
|
||||
int uid = playerList.getInt(i);
|
||||
countValidAndTotal(jedis10, pipeline9, uid, groupId, pid, valid_count, valid_diamo, all_count);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
jedis10.close();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 统计合伙人局数和赢
|
||||
* @param jedis9
|
||||
* @param groupId
|
||||
* @param uid
|
||||
* @param win
|
||||
*/
|
||||
public static final void countRoundWin(Pipeline pipeline9,int groupId,int pid, int uid,boolean win,int score) {
|
||||
List<Integer> par_list = null;
|
||||
Jedis jedis10 = Redis.use("group1_db10").getJedis();
|
||||
try {
|
||||
par_list = Utility.getMemberParents(jedis10, groupId, uid, true);
|
||||
|
||||
Pipeline pipeline10 = jedis10.pipelined();
|
||||
|
||||
if(par_list==null)return;
|
||||
|
||||
String key = String.format("g{%s}:m%s:total_win",groupId,uid);
|
||||
CountUtil.countLogByDay30(key, score, pipeline9);
|
||||
CountUtil.countLogByDay30(key + "_self", score, pipeline9);
|
||||
|
||||
for(int i=0;i<par_list.size();++i) {
|
||||
|
||||
int par = par_list.get(i);
|
||||
|
||||
boolean add_uid = (uid == par || i == 0);
|
||||
if(add_uid == true) {
|
||||
|
||||
key = String.format("g{%s}:m%s:d_total_win",groupId,par);
|
||||
CountUtil.countLogByDay30(key, score, pipeline9);
|
||||
}
|
||||
|
||||
String mlk = GroupCache.genMemberListKey(groupId, par);
|
||||
pipeline10.sadd(mlk, uid+"");
|
||||
|
||||
if(par != uid) {
|
||||
key = String.format("g{%s}:m%s:total_win",groupId,par);
|
||||
CountUtil.countLogByDay30(key, score, pipeline9);
|
||||
}
|
||||
}
|
||||
|
||||
pipeline10.sync();
|
||||
|
||||
}finally {
|
||||
jedis10.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计合伙人体力值消耗,输赢统计
|
||||
* @param jedis9
|
||||
* @param groupId
|
||||
* @param uid
|
||||
* @param pump
|
||||
* @param hp
|
||||
*/
|
||||
public static final void countHpconsume(Pipeline pipeline9,int groupId,int uid,int pump,int hp) {
|
||||
List<Integer> par_list = null;
|
||||
Jedis jedis10 = Redis.use("group1_db10").getJedis();
|
||||
try {
|
||||
par_list = Utility.getMemberParents(jedis10, groupId, uid, true);
|
||||
}finally {
|
||||
jedis10.close();
|
||||
}
|
||||
if(par_list==null)return;
|
||||
String key;
|
||||
|
||||
if(hp!=0) {
|
||||
|
||||
key = String.format("g{%s}:m%s:hp_consume_log",groupId,uid);
|
||||
CountUtil.countLogByDay(key, hp, pipeline9);
|
||||
}
|
||||
|
||||
int day = DateUtils.getBeginDay();
|
||||
boolean self = par_list.get(0) == uid;
|
||||
for(int i=0;i<par_list.size();++i) {
|
||||
|
||||
int par = par_list.get(i);
|
||||
boolean add_uid = i==0||(i<=1&&self);
|
||||
|
||||
if(pump>0) {
|
||||
|
||||
key = String.format("g%s:hp_cost:par%s_%s",groupId,par,day);
|
||||
pipeline9.hincrBy(key, "total", pump);
|
||||
if(add_uid) {
|
||||
pipeline9.hincrBy(key, uid+"", pump);
|
||||
}
|
||||
|
||||
pipeline9.expire(key, 3600*24*2);
|
||||
}
|
||||
|
||||
if(hp!=0) {
|
||||
|
||||
if(uid != par) {
|
||||
key = String.format("g{%s}:m%s:hp_consume_log",groupId,par);
|
||||
CountUtil.countLogByDay(key, hp, pipeline9);
|
||||
}
|
||||
|
||||
key = String.format("g%s:hp_consume:par%s_%s",groupId,par,day);
|
||||
pipeline9.hincrBy(key, "total", hp);
|
||||
if(add_uid) {
|
||||
pipeline9.hincrBy(key, uid+"", hp);
|
||||
}
|
||||
|
||||
pipeline9.expire(key, 3600*24*2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import com.data.util.ConsumeCode;
|
||||
import com.data.util.CountUtil;
|
||||
import com.data.util.Utility;
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.evt.mgr.Utils;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.entity.TArray;
|
||||
import com.taurus.core.plugin.database.DataBase;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.util.DateUtils;
|
||||
|
||||
import com.taurus.core.util.Logger;
|
||||
import com.taurus.core.util.StringUtil;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.Pipeline;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class HandlerGroupMemberRound implements IHandler{
|
||||
static Logger log = Logger.getLogger(HandlerHpConsume.class);
|
||||
@Override
|
||||
public int process(int uid, ITObject param) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static boolean addMemberLog(int gid, int pid,int uid, int score, int win, int time, int perfectRound,int valid_count) throws SQLException {
|
||||
String sql = String.format("{call sp_add_member_log(%s,%s,%s,%s,%s,%s,%s,%s)}",
|
||||
gid,pid,uid,score,win,time,perfectRound,valid_count);
|
||||
Utility.evtdbLog(gid, 2, sql);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
|
||||
int pid = param.getInt("pid");
|
||||
int score = param.getInt("score");
|
||||
int uid = param.getInt("uid");
|
||||
int win = param.getInt("win");
|
||||
int time = DateUtils.getBeginDay();
|
||||
int perfectRound = param.getInt("perfect_round");
|
||||
int valid_count = param.getInt("valid_count");
|
||||
int pump = param.getInt("pump");
|
||||
int cur_hp = param.getInt("cur_hp");
|
||||
int xipai_total = param.getInt("xi_pai_total");
|
||||
int anchou_total = param.getInt("an_chou_total");
|
||||
|
||||
String roomid = param.getString("room");
|
||||
int cur_time = (int)(System.currentTimeMillis() / 1000);
|
||||
if (param.containsKey("time"))
|
||||
{
|
||||
cur_time = param.getInt("time");
|
||||
}
|
||||
log.info("uid:"+uid+"anchou_total:"+ anchou_total+"xipai_total:"+xipai_total);
|
||||
//ITArray param1 = TArray.newInstance();
|
||||
//param1.addInt(groupId);
|
||||
//param1.addInt(pid);
|
||||
//param1.addInt(uid);
|
||||
//param1.addInt(score - pump - xipai_total);
|
||||
//param1.addInt(win);
|
||||
//param1.addInt(time);
|
||||
//param1.addInt(perfectRound);
|
||||
//param1.addInt(valid_count);
|
||||
//DataBase.use().prepareCallNonResult("sp_add_member_log", param1);
|
||||
addMemberLog(groupId, pid, uid, score - pump - xipai_total-anchou_total, win, time, perfectRound, valid_count);
|
||||
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
|
||||
groupId,uid,ConsumeCode.HP_PUMP_TOTAL,score - pump - xipai_total-anchou_total,
|
||||
cur_hp,pid,roomid,(int) (cur_time));
|
||||
Utility.evtdb(groupId, 1, sql);
|
||||
//DataBase.use().executeUpdate(sql);
|
||||
|
||||
String gmrp_key = String.format("g%s:m%s:round:p%s",groupId,uid,pid);
|
||||
String gmr_key = String.format("g%s:m%s:round",groupId,uid);
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
|
||||
try {
|
||||
CountUtil.countLog(gmrp_key, 1, jedis9);
|
||||
CountUtil.countLog(gmr_key, 1, jedis9);
|
||||
|
||||
Pipeline pipeline9 = jedis9.pipelined();
|
||||
Utils.countRoundWin(pipeline9, groupId, pid, uid, win==1,score - pump);
|
||||
pipeline9.sync();
|
||||
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import com.data.util.CountUtil;
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.evt.mgr.Utils;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.Pipeline;
|
||||
|
||||
public class HandlerGroupRound implements IHandler{
|
||||
|
||||
@Override
|
||||
public int process(int uid, ITObject param) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
int pid = param.getInt("pid");
|
||||
int valid = param.getInt("valid");
|
||||
ITArray playerList = param.getTArray("player_list");
|
||||
int valid_count = param.getInt("valid_count");
|
||||
int valid_diamo = 0;
|
||||
int all_count = 0;
|
||||
if (param.containsKey("valid_diamo"))
|
||||
{
|
||||
valid_diamo = param.getInt("valid_diamo");
|
||||
}
|
||||
|
||||
if (param.containsKey("all_count"))
|
||||
{
|
||||
all_count = param.getInt("all_count");
|
||||
}
|
||||
|
||||
String rp_key = String.format("g%s:round:p%s",groupId,pid);
|
||||
String round_key = String.format("g%s:round",groupId);
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
Pipeline pipeline9 = jedis9.pipelined();
|
||||
|
||||
CountUtil.countLog(rp_key, 1, pipeline9,false,true);
|
||||
CountUtil.countLog(round_key, 1, pipeline9,true);
|
||||
|
||||
if(valid == 1) {
|
||||
|
||||
String valid_key = String.format("g%s:valid_room",groupId);
|
||||
String p_valid_key = String.format("g%s:valid_room:p%s",groupId,pid);
|
||||
CountUtil.countLogByDay(p_valid_key, 1, pipeline9,true);
|
||||
CountUtil.countLog(valid_key, 1, pipeline9);
|
||||
}else {
|
||||
|
||||
String no_valid_key = String.format("g%s:no_valid_room",groupId);
|
||||
String p_no_valid_key = String.format("g%s:no_valid_room:p%s",groupId,pid);
|
||||
CountUtil.countLogByDay(p_no_valid_key, 1, pipeline9,true);
|
||||
CountUtil.countLog(no_valid_key, 1, pipeline9);
|
||||
}
|
||||
Utils.countValidAndTotal(pipeline9, playerList, groupId, pid, valid_count, valid_diamo, all_count);
|
||||
|
||||
pipeline9.sync();
|
||||
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,695 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.data.bean.GroupBean;
|
||||
import com.data.cache.GroupCache;
|
||||
import com.data.cache.GroupMemberCache;
|
||||
import com.data.util.ConsumeCode;
|
||||
import com.data.util.CountUtil;
|
||||
import com.data.util.Utility;
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.entity.TArray;
|
||||
import com.taurus.core.plugin.database.DataBase;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.util.Logger;
|
||||
import com.taurus.core.util.StringUtil;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.Pipeline;
|
||||
|
||||
public class HandlerHpConsume implements IHandler{
|
||||
static Logger log = Logger.getLogger(HandlerHpConsume.class);
|
||||
final static String DB = "group1_db10";
|
||||
|
||||
private static boolean hpConsume(int gid, int uid,int pid, int hp,int cur_hp,int reason, String roomid, int time,String desc) throws SQLException {
|
||||
String sql = String.format("{call sp_update_hp(%s,%s,%s,%s,%s,%s,'%s',%s,'%s')}",
|
||||
gid,uid,hp,cur_hp,reason,pid,roomid,time,desc);
|
||||
Utility.evtdb(gid, 2, sql);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int process(int uid, ITObject param) throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void to_reward(Pipeline pipeline, int uid, String prs,int rewardType, int valueType, int real_pump, int pump,int groupId,int pid,String roomid,int time,int max_player) throws Exception {
|
||||
|
||||
int useValue = 0;
|
||||
if(StringUtil.isNotEmpty(prs)) {
|
||||
|
||||
int round = 100 / max_player;
|
||||
ITArray list = TArray.newFromJsonData(prs);
|
||||
|
||||
for(int i=list.size()-1;i>=0;--i) {
|
||||
|
||||
ITObject obj1 = list.getTObject(i);
|
||||
int parentId = obj1.getInt("p");
|
||||
int rewardPercent = 0;
|
||||
if (obj1.containsKey("r"))
|
||||
{
|
||||
rewardPercent = obj1.getInt("r");
|
||||
}
|
||||
int rv = 0;
|
||||
if(i > 0) {
|
||||
ITObject obj2 = list.getTObject(i - 1);
|
||||
if (!obj2.containsKey("r"))
|
||||
{
|
||||
rv =rewardPercent - 0;
|
||||
}
|
||||
else {
|
||||
rv =rewardPercent -obj2.getInt("r");
|
||||
}
|
||||
}else {
|
||||
|
||||
rv=rewardPercent;
|
||||
}
|
||||
int reward_value = rv;
|
||||
if(valueType == 1) {
|
||||
reward_value = Math.round(pump * (rv / 100f));
|
||||
}
|
||||
else {
|
||||
if(rewardType == 2) {
|
||||
reward_value = reward_value / max_player;
|
||||
}
|
||||
}
|
||||
|
||||
if (reward_value < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId,parentId);
|
||||
Redis.use(DB).incrBy(key, reward_value);
|
||||
String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s", Redis.use(DB).get(key), parentId,groupId);
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
//String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,parentId);
|
||||
//Redis.use(DB).incrBy(all_key, reward_value);
|
||||
useValue += reward_value;
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s",groupId,parentId), reward_value, jedis9);
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round, info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", groupId,parentId,ConsumeCode.HP_PARTNER_REWARD,reward_value,cur_hp,pid,roomid,time,round, desc);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
|
||||
// 记录代理每天的推广奖励
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:reward_log", groupId,parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:p%s:reward_log", groupId,parentId,pid);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
// 记录每个人对上级的推广奖励是多少
|
||||
key = String.format("g{%s}:m%s:reward_log_to:par%s", groupId,uid, parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
boolean add_uid = (uid == parentId || i == 0);
|
||||
if(add_uid == true) {
|
||||
key = String.format("g{%s}:m%s:d_reward", groupId,parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
}
|
||||
|
||||
if(i>0) {
|
||||
|
||||
for(int j = i - 1; j >= 0; j--) {
|
||||
|
||||
ITObject obj2 = list.getTObject(j);
|
||||
int temp = obj2.getInt("p");
|
||||
if(temp != uid) {
|
||||
key = String.format("g{%s}:m%s:reward_log_to:par%s", groupId,temp, parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//某个玩法的抽水总值
|
||||
CountUtil.countLogByDay30(String.format("g%s:hp_cost:m%s:p%s",groupId,parentId,pid),pump,pipeline);
|
||||
|
||||
CountUtil.countLogByDay30(String.format("g%s:hp_reward",groupId), reward_value, pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
if (gb != null) {
|
||||
int round = 100 / max_player;
|
||||
int leftValue = real_pump - useValue;
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId,gb.owner);
|
||||
Redis.use(DB).incrBy(key, leftValue);
|
||||
String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s", Redis.use(DB).get(key), gb.owner,groupId);
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
//String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,gb.owner);
|
||||
//Redis.use(DB).incrBy(all_key, leftValue);
|
||||
// 记录代理每天的推广奖励
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:reward_log", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:p%s:reward_log", groupId,gb.owner,pid);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
// 记录每个人对上级的推广奖励是多少
|
||||
key = String.format("g{%s}:m%s:reward_log_to:par%s", groupId,uid, gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
boolean add_uid = (uid == gb.owner);
|
||||
if(add_uid == true) {
|
||||
key = String.format("g{%s}:m%s:d_reward", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
}
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s",groupId,gb.owner), leftValue, jedis9);
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round,info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", groupId,gb.owner,ConsumeCode.HP_PARTNER_REWARD,leftValue,cur_hp,pid,roomid,time,round,desc);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void anchou_to_reward(Pipeline pipeline, int uid, String prs,int rewardType, int valueType, int real_pump, int pump,int groupId,int pid,String roomid,int time,int max_player) throws Exception {
|
||||
|
||||
log.info("uid:"+uid+"prs:"+prs+"valueType:"+valueType+"real_pump:"+real_pump+"pump:"+pump+"groupId:"+groupId+"pid:"+pid+"time:"+time+"max_player:"+max_player);
|
||||
|
||||
|
||||
int useValue = 0;
|
||||
log.info("uid:"+uid+"prs:"+StringUtil.isNotEmpty(prs)+"time:"+time);
|
||||
if(StringUtil.isNotEmpty(prs)) {
|
||||
int round = 100 / max_player;
|
||||
ITArray list = TArray.newFromJsonData(prs);
|
||||
log.info("uid:"+uid+"size:"+list.size()+"time:"+time);
|
||||
for(int i=list.size()-1;i>=0;--i) {
|
||||
|
||||
ITObject obj1 = list.getTObject(i);
|
||||
int parentId = obj1.getInt("p");
|
||||
int rewardPercent = 0;
|
||||
if (obj1.containsKey("a"))
|
||||
{
|
||||
rewardPercent = obj1.getInt("a");
|
||||
}
|
||||
int rv = 0;
|
||||
if(i > 0) {
|
||||
ITObject obj2 = list.getTObject(i - 1);
|
||||
if (!obj2.containsKey("a"))
|
||||
{
|
||||
rv = rewardPercent - 0;
|
||||
}
|
||||
else {
|
||||
rv = rewardPercent -obj2.getInt("a");
|
||||
}
|
||||
}else {
|
||||
|
||||
rv=rewardPercent;
|
||||
}
|
||||
int reward_value = rv;
|
||||
if(valueType == 1) {
|
||||
reward_value = Math.round(pump * (rv / 100f));
|
||||
}
|
||||
|
||||
log.info("uid:"+uid+"reward_value:"+reward_value+"time:"+time);
|
||||
|
||||
if (reward_value < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId,parentId);
|
||||
Redis.use(DB).incrBy(key, reward_value);
|
||||
String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s", Redis.use(DB).get(key), parentId,groupId);
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
//String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,parentId);
|
||||
//Redis.use(DB).incrBy(all_key, reward_value);
|
||||
useValue += reward_value;
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s",groupId,parentId), reward_value, jedis9);
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round,info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", groupId,parentId,ConsumeCode.HP_PARTNER_ANCHOU_REWARD,reward_value,cur_hp,pid,roomid,time,round,desc);
|
||||
log.info("uid:"+uid+"sql:"+sql+"time:"+time);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
|
||||
// 记录代理每天的推广奖励
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:anchou_reward_log", groupId,parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:p%s:anchou_reward_log", groupId,parentId,pid);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
// 记录每个人对上级的推广奖励是多少
|
||||
key = String.format("g{%s}:m%s:anchou_reward_log_to:par%s", groupId,uid, parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
boolean add_uid = (uid == parentId || i == 0);
|
||||
if(add_uid == true) {
|
||||
key = String.format("g{%s}:m%s:d_anchou_reward", groupId,parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
}
|
||||
|
||||
if(i>0) {
|
||||
|
||||
for(int j = i - 1; j >= 0; j--) {
|
||||
|
||||
ITObject obj2 = list.getTObject(j);
|
||||
int temp = obj2.getInt("p");
|
||||
if(temp != uid) {
|
||||
key = String.format("g{%s}:m%s:anchou_reward_log_to:par%s", groupId,temp, parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//某个玩法的抽水总值
|
||||
CountUtil.countLogByDay30(String.format("g%s:anchou_hp_cost:m%s:p%s",groupId,parentId,pid),pump,pipeline);
|
||||
|
||||
CountUtil.countLogByDay30(String.format("g%s:anchou_hp_reward",groupId), reward_value, pipeline);
|
||||
}
|
||||
}
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
if (gb != null) {
|
||||
int round = 100 / max_player;
|
||||
int leftValue = real_pump - useValue;
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId,gb.owner);
|
||||
Redis.use(DB).incrBy(key, leftValue);
|
||||
String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s", Redis.use(DB).get(key), gb.owner,groupId);
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
//String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,gb.owner);
|
||||
//Redis.use(DB).incrBy(all_key, leftValue);
|
||||
// 记录代理每天的推广奖励
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:anchou_reward_log", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:p%s:anchou_reward_log", groupId,gb.owner,pid);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
// 记录每个人对上级的推广奖励是多少
|
||||
key = String.format("g{%s}:m%s:anchou_reward_log_to:par%s", groupId,uid, gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
boolean add_uid = (uid == gb.owner);
|
||||
if(add_uid == true) {
|
||||
key = String.format("g{%s}:m%s:d_anchou_reward", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
}
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s",groupId,gb.owner), leftValue, jedis9);
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round,info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", groupId,gb.owner,ConsumeCode.HP_PARTNER_ANCHOU_REWARD,leftValue,cur_hp,pid,roomid,time,round,desc);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void xipai_to_reward(Pipeline pipeline, int uid, String prs,int rewardType, int valueType, int real_pump, int pump,int groupId,int pid,String roomid,int time,int max_player) throws Exception {
|
||||
log.info("xipai uid:"+uid+"prs:"+prs+"time:"+time);
|
||||
int useValue = 0;
|
||||
log.info("xipaiuid:"+uid+"prs:"+StringUtil.isNotEmpty(prs)+"time:"+time);
|
||||
if(StringUtil.isNotEmpty(prs)) {
|
||||
log.info("xipaiok uid:"+uid+"prs:"+prs+"time:"+time);
|
||||
int round = 100 / max_player;
|
||||
ITArray list = TArray.newFromJsonData(prs);
|
||||
|
||||
for(int i=list.size()-1;i>=0;--i) {
|
||||
|
||||
ITObject obj1 = list.getTObject(i);
|
||||
int parentId = obj1.getInt("p");
|
||||
int rewardPercent = 0;
|
||||
if (obj1.containsKey("x"))
|
||||
{
|
||||
rewardPercent = obj1.getInt("x");
|
||||
}
|
||||
int rv = 0;
|
||||
if(i > 0) {
|
||||
ITObject obj2 = list.getTObject(i - 1);
|
||||
if (!obj2.containsKey("x"))
|
||||
{
|
||||
rv = rewardPercent - 0;
|
||||
}
|
||||
else {
|
||||
rv = rewardPercent -obj2.getInt("x");
|
||||
}
|
||||
}else {
|
||||
|
||||
rv=rewardPercent;
|
||||
}
|
||||
int reward_value = rv;
|
||||
if(valueType == 1) {
|
||||
reward_value = Math.round(pump * (rv / 100f));
|
||||
}
|
||||
|
||||
if (reward_value < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId,parentId);
|
||||
Redis.use(DB).incrBy(key, reward_value);
|
||||
String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s", Redis.use(DB).get(key), parentId,groupId);
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
//String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,parentId);
|
||||
//Redis.use(DB).incrBy(all_key, reward_value);
|
||||
useValue += reward_value;
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s",groupId,parentId), reward_value, jedis9);
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round,info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", groupId,parentId,ConsumeCode.HP_PARTNER_XIPAI_REWARD,reward_value,cur_hp,pid,roomid,time,round,desc);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
|
||||
// 记录代理每天的推广奖励
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:xipai_reward_log", groupId,parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:p%s:xipai_reward_log", groupId,parentId,pid);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
// 记录每个人对上级的推广奖励是多少
|
||||
key = String.format("g{%s}:m%s:xipai_reward_log_to:par%s", groupId,uid, parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
|
||||
boolean add_uid = (uid == parentId || i == 0);
|
||||
if(add_uid == true) {
|
||||
key = String.format("g{%s}:m%s:d_xipai_reward", groupId,parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
}
|
||||
|
||||
if(i>0) {
|
||||
|
||||
for(int j = i - 1; j >= 0; j--) {
|
||||
|
||||
ITObject obj2 = list.getTObject(j);
|
||||
int temp = obj2.getInt("p");
|
||||
if(temp != uid) {
|
||||
key = String.format("g{%s}:m%s:xipai_reward_log_to:par%s", groupId,temp, parentId);
|
||||
CountUtil.countLogByDay30(key, reward_value, pipeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//某个玩法的抽水总值
|
||||
CountUtil.countLogByDay30(String.format("g%s:xipai_hp_cost:m%s:p%s",groupId,parentId,pid),pump,pipeline);
|
||||
|
||||
CountUtil.countLogByDay30(String.format("g%s:xipai_hp_reward",groupId), reward_value, pipeline);
|
||||
}
|
||||
}
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
if (gb != null) {
|
||||
int round = 100 / max_player;
|
||||
int leftValue = real_pump - useValue;
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId,gb.owner);
|
||||
Redis.use(DB).incrBy(key, leftValue);
|
||||
String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s", Redis.use(DB).get(key), gb.owner,groupId);
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
//String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,gb.owner);
|
||||
//Redis.use(DB).incrBy(all_key, leftValue);
|
||||
// 记录代理每天的推广奖励
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:xipai_reward_log", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:p%s:xipai_reward_log", groupId,gb.owner,pid);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
// 记录每个人对上级的推广奖励是多少
|
||||
key = String.format("g{%s}:m%s:xipai_reward_log_to:par%s", groupId,uid, gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
boolean add_uid = (uid == gb.owner);
|
||||
if(add_uid == true) {
|
||||
key = String.format("g{%s}:m%s:d_xipai_reward", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
}
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s",groupId,gb.owner), leftValue, jedis9);
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round,info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", groupId,gb.owner,ConsumeCode.HP_PARTNER_XIPAI_REWARD,leftValue,cur_hp,pid,roomid,time,round,desc);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void to_mengzhu_reward(Pipeline pipeline, int uid, String prs,int rewardType, int valueType, int real_pump, int pump,int groupId,int pid,String roomid,int time,int max_player) throws Exception {
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
if (gb != null) {
|
||||
int round = 100 / max_player;
|
||||
int leftValue = real_pump;
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId,gb.owner);
|
||||
Redis.use(DB).incrBy(key, leftValue);
|
||||
String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s", Redis.use(DB).get(key), gb.owner,groupId);
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
//String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,gb.owner);
|
||||
//Redis.use(DB).incrBy(all_key, leftValue);
|
||||
// 记录代理每天的推广奖励
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:reward_log", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
key = String.format("g{%s}:m%s:p%s:reward_log", groupId,gb.owner,pid);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
// 记录每个人对上级的推广奖励是多少
|
||||
key = String.format("g{%s}:m%s:reward_log_to:par%s", groupId,uid, gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
|
||||
boolean add_uid = (uid == gb.owner);
|
||||
if(add_uid == true) {
|
||||
key = String.format("g{%s}:m%s:d_reward", groupId,gb.owner);
|
||||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
}
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s",groupId,gb.owner), leftValue, jedis9);
|
||||
String sql = String.format("INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round,info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", groupId,gb.owner,ConsumeCode.HP_PARTNER_REWARD,leftValue,cur_hp,pid,roomid,time,round,desc);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
log.info("processGroup",param);
|
||||
int uid = param.getInt("uid");
|
||||
try {
|
||||
int hp = param.getInt("hp");
|
||||
int cur_hp = param.getInt("cur_hp");
|
||||
boolean is_pump = param.containsKey("pump");
|
||||
int pump = 0;
|
||||
String roomid = param.getString("room");
|
||||
int pid = param.getInt("pid");
|
||||
int time = param.getInt("time");
|
||||
int reward_value = 0;
|
||||
int xipai_reward_value = 0;
|
||||
int max_player = 0;
|
||||
int rewardValueType = 0;
|
||||
int xipai_rewardValueType = 0;
|
||||
int rewardType = 1;
|
||||
int xipai_rewardType = 1;
|
||||
int anchou_rewardType = 1;
|
||||
int anchou_reward_value = 0;
|
||||
int anchou_rewardValueType = 0;
|
||||
|
||||
boolean is_xipai = param.containsKey("xipai");
|
||||
int xipai = 0;
|
||||
|
||||
|
||||
String prs =null;
|
||||
if(is_pump) {
|
||||
pump = param.getInt("pump");
|
||||
max_player = param.getInt("max_player");
|
||||
if(param.containsKey("reward_value")) {
|
||||
reward_value = param.getInt("reward_value");
|
||||
prs = param.getString("prs");
|
||||
}
|
||||
if(param.containsKey("reward_type")) {
|
||||
rewardType = param.getInt("reward_type");
|
||||
}
|
||||
if(param.containsKey("rewardValueType")) {
|
||||
rewardValueType = param.getInt("rewardValueType");
|
||||
}
|
||||
}
|
||||
|
||||
if (is_xipai)
|
||||
{
|
||||
xipai = param.getInt("xipai");
|
||||
max_player = param.getInt("max_player");
|
||||
if(param.containsKey("xipai_reward_value")) {
|
||||
xipai_reward_value = param.getInt("xipai_reward_value");
|
||||
prs = param.getString("prs");
|
||||
}
|
||||
if(param.containsKey("xipai_reward_type")) {
|
||||
xipai_rewardType = param.getInt("xipai_reward_type");
|
||||
}
|
||||
|
||||
if(param.containsKey("xipai_rewardValueType")) {
|
||||
xipai_rewardValueType = param.getInt("xipai_rewardValueType");
|
||||
}
|
||||
}
|
||||
int anchou = 0;
|
||||
if(param.containsKey("anchou")) {
|
||||
anchou = param.getInt("anchou");
|
||||
}
|
||||
|
||||
if(param.containsKey("anchou_reward_value")) {
|
||||
max_player = param.getInt("max_player");
|
||||
anchou_reward_value = param.getInt("anchou_reward_value");
|
||||
prs = param.getString("prs");
|
||||
}
|
||||
|
||||
if(param.containsKey("anchou_reward_type")) {
|
||||
anchou_rewardType = param.getInt("anchou_reward_type");
|
||||
}
|
||||
|
||||
if(param.containsKey("anchou_rewardValueType")) {
|
||||
anchou_rewardValueType = param.getInt("anchou_rewardValueType");
|
||||
}
|
||||
log.info("jefe anchou_reward_value:"+anchou_reward_value);
|
||||
|
||||
if (param.containsKey("hp_than_max_value"))
|
||||
{
|
||||
int more_hp = param.getInt("hp_than_max_value");
|
||||
String gm_key = GroupMemberCache.genKey(groupId, uid);
|
||||
String bank_hp = Redis.use("group1_db10").hget(gm_key, "bank_hp");
|
||||
String sql = String.format("{call sp_bank_hp(%s,%s,%s,%s)}", groupId, uid, more_hp, cur_hp);
|
||||
Utility.evtdb(groupId, 2, sql);
|
||||
String sql2 = String.format("update group_member set bank_hp = %s where uid = %s AND groupId = %s", bank_hp, uid, groupId);
|
||||
Utility.evtdb(groupId, 1, sql2);
|
||||
}
|
||||
|
||||
String desc = param.getString("desc");
|
||||
desc = StringUtil.isNotEmpty(desc) ? desc : StringUtil.Empty;
|
||||
if(hp!=0) {
|
||||
hpConsume(groupId, uid,pid, hp,cur_hp + pump,ConsumeCode.HP_CLEARING, roomid,time, desc);
|
||||
}
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db9").getJedis();
|
||||
try {
|
||||
|
||||
String key = String.format("g%s:m%s:consume_hp", groupId,uid);
|
||||
if(hp!=0) {
|
||||
CountUtil.countLogByDay(key, hp, jedis9, 691200);
|
||||
}
|
||||
|
||||
if(pump>0) {
|
||||
|
||||
CountUtil.countLogByDay(key, -pump, jedis9, 691200);
|
||||
time += 1;
|
||||
hpConsume(groupId, uid,pid, -pump,cur_hp, ConsumeCode.HP_PUMP, roomid,time, desc);
|
||||
|
||||
CountUtil.countLog(String.format("g%s:hp_cost",groupId), pump, jedis9);
|
||||
CountUtil.countLogByDay(String.format("g%s:hp_cost:p%s",groupId,pid),pump,jedis9);
|
||||
CountUtil.countLogByDay(String.format("g%s:hp_cost:m%s",groupId,uid),pump,jedis9);
|
||||
}
|
||||
|
||||
if (xipai > 0)
|
||||
{
|
||||
CountUtil.countLogByDay(key, -xipai, jedis9, 691200);
|
||||
time += 1;
|
||||
hpConsume(groupId, uid,pid, -xipai,cur_hp, ConsumeCode.HP_XIPAI_PUMP, roomid,time, desc);
|
||||
|
||||
CountUtil.countLog(String.format("g%s:hp_cost",groupId), xipai, jedis9);
|
||||
CountUtil.countLogByDay(String.format("g%s:hp_cost:p%s",groupId,pid),xipai,jedis9);
|
||||
CountUtil.countLogByDay(String.format("g%s:hp_cost:m%s",groupId,uid),xipai,jedis9);
|
||||
}
|
||||
|
||||
if (anchou > 0)
|
||||
{
|
||||
CountUtil.countLogByDay(key, -anchou, jedis9, 691200);
|
||||
time += 1;
|
||||
hpConsume(groupId, uid,pid, -anchou,cur_hp, ConsumeCode.HP_ANCHOU_PUMP, roomid,time, desc);
|
||||
|
||||
CountUtil.countLog(String.format("g%s:hp_cost",groupId), anchou, jedis9);
|
||||
CountUtil.countLogByDay(String.format("g%s:hp_cost:p%s",groupId,pid),anchou,jedis9);
|
||||
CountUtil.countLogByDay(String.format("g%s:hp_cost:m%s",groupId,uid),anchou,jedis9);
|
||||
}
|
||||
|
||||
Pipeline pipeline = jedis9.pipelined();
|
||||
if(reward_value > 0 || (rewardValueType == 2 && is_pump)) {
|
||||
|
||||
time += 1;
|
||||
to_reward(pipeline,uid,prs,rewardType,rewardValueType, pump, reward_value ,groupId,pid,roomid,time,max_player);
|
||||
}
|
||||
/*
|
||||
else {
|
||||
if (is_pump && pump > 0)
|
||||
{
|
||||
log.error("pump to_mengzhu_reward:"+pump+" uid:" + uid + " groupId:" + groupId);
|
||||
to_mengzhu_reward(pipeline,uid,prs,rewardType,rewardValueType, pump, reward_value ,groupId,pid,roomid,time,max_player);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if(xipai_reward_value > 0 || (xipai_rewardValueType == 2 && is_xipai)) {
|
||||
|
||||
time += 1;
|
||||
xipai_to_reward(pipeline,uid,prs,xipai_rewardType,xipai_rewardValueType, xipai, xipai_reward_value ,groupId,pid,roomid,time,max_player);
|
||||
}
|
||||
if (anchou_reward_value>0){
|
||||
time += 1;
|
||||
anchou_to_reward(pipeline,uid,prs,anchou_rewardType,anchou_rewardValueType, anchou, anchou_reward_value ,groupId,pid,roomid,time,max_player);
|
||||
}
|
||||
|
||||
/*
|
||||
else {
|
||||
if (is_xipai && xipai > 0)
|
||||
{
|
||||
log.error("xipai to_mengzhu_reward:"+pump+" uid:" + uid + " groupId:" + groupId);
|
||||
to_mengzhu_reward(pipeline,uid,prs,xipai_rewardType,xipai_rewardValueType, xipai, xipai_reward_value ,groupId,pid,roomid,time,max_player);
|
||||
}
|
||||
}
|
||||
*/
|
||||
pipeline.sync();
|
||||
|
||||
}finally {
|
||||
jedis9.close();
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
|
||||
public class HandlerLose implements IHandler{
|
||||
|
||||
@Override
|
||||
public int process(int uid, ITObject param) throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import com.data.cache.GroupMemberCache;
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.plugin.database.DataBase;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.util.StringUtil;
|
||||
|
||||
public class HandlerOver implements IHandler {
|
||||
|
||||
public static final int _SHARE_NUM = 20;
|
||||
|
||||
private static void share(String id) throws Exception {
|
||||
if (!Redis.use("group1_db1").sismember("shares", id)) {
|
||||
return;
|
||||
}
|
||||
String sql = "SELECT succ,playtimes FROM shares WHERE uid = " + id;
|
||||
ITArray resultArray = DataBase.use().executeQueryByTArray(sql);
|
||||
if (resultArray.size() == 0) {
|
||||
return;
|
||||
}
|
||||
ITObject dbData = resultArray.getTObject(0);
|
||||
if (dbData.getInt("succ") != 0) {
|
||||
Redis.use("group1_db1").srem("shares", id);
|
||||
return;
|
||||
}
|
||||
int playTimes = dbData.getInt("playtimes") + 1;
|
||||
dbData.putInt("playtimes", playTimes);
|
||||
if (playTimes >= _SHARE_NUM) {
|
||||
dbData.putInt("succ", 1);
|
||||
Redis.use("group1_db1").srem("shares", id);
|
||||
}
|
||||
DataBase.use().update("shares", dbData, "uid=" + id);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int process(int uid,ITObject param) throws Exception {
|
||||
int is_rec = param.getInt("is_rec");
|
||||
if(is_rec == 1) {
|
||||
String roomid =param.getString("roomid");
|
||||
String rec_key =param.getString("rec_key");
|
||||
int gid =param.containsKey("gid")?param.getInt("gid"):0;
|
||||
int time =param.getInt("time");
|
||||
int par = 0;
|
||||
if(gid>0) {
|
||||
String gm_key = GroupMemberCache.genKey(gid, uid);
|
||||
String parentId = Redis.use("group1_db10").hget(gm_key, "parentId");
|
||||
par = StringUtil.isEmpty(parentId)?0:Integer.parseInt(parentId);
|
||||
}
|
||||
String sql =String.format("insert into room_rec_log(roomid,gid,uid,rec_key,time,parentId) values('%s',%s,%s,'%s',%s,%s)",
|
||||
roomid,gid,uid,rec_key,time,par);
|
||||
DataBase.use().executeUpdate(sql);
|
||||
}
|
||||
|
||||
share(uid+"");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.data.cache.AccountCache;
|
||||
import com.data.util.ConsumeCode;
|
||||
import com.data.util.Utility;
|
||||
import com.evt.mgr.EventController;
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
public class HandlerPay implements IHandler{
|
||||
|
||||
int reason;
|
||||
boolean isPay;
|
||||
public HandlerPay(int reason,boolean isPay) {
|
||||
this.reason = reason;
|
||||
this.isPay = isPay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int process(int uid, ITObject param) throws Exception {
|
||||
int pay = param.getInt("pay");
|
||||
if(pay==0) {
|
||||
return 0;
|
||||
}
|
||||
int result = 1;
|
||||
int gameId =param.getInt("game");
|
||||
int groupId = 0;
|
||||
int pid = 0;
|
||||
if(param.containsKey("group")) {
|
||||
groupId = param.getInt("group");
|
||||
}
|
||||
if(param.containsKey("pid")) {
|
||||
pid = param.getInt("pid");
|
||||
}
|
||||
|
||||
if(reason == ConsumeCode.DIAMO_JOIN_ROOM) {
|
||||
pay = Math.abs(pay);
|
||||
}
|
||||
if(reason == ConsumeCode.DIAMO_REFUND) {
|
||||
pay = -Math.abs(pay);
|
||||
}
|
||||
if(reason == ConsumeCode.DIAMO_ADD) {
|
||||
pay = -pay;
|
||||
}
|
||||
|
||||
if(isPay) {
|
||||
int cur_diamo = param.getInt("diamo");
|
||||
EventController.payDiamo(uid, pay, cur_diamo, reason, gameId, groupId, pid);
|
||||
result = 0;
|
||||
}else {
|
||||
String session = AccountCache.genKey(uid);
|
||||
Jedis jedis0 = Redis.use("group1_db0").getJedis();
|
||||
try {
|
||||
ArrayList<Long> result_list = Utility.payDiamo(jedis0, session,pay);
|
||||
if(result_list!=null) {
|
||||
result = result_list.get(0).intValue();
|
||||
if(result ==0) {
|
||||
long cur_diamo = result_list.get(1);
|
||||
EventController.payDiamo(uid, pay, (int)cur_diamo, reason, gameId, groupId, pid);
|
||||
}
|
||||
result = 0;
|
||||
}
|
||||
}finally {
|
||||
jedis0.close();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
|
||||
public class HandlerWin implements IHandler{
|
||||
|
||||
@Override
|
||||
public int process(int uid, ITObject param) throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.evt.mgr.job;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.taurus.core.plugin.database.DataBase;
|
||||
import com.taurus.core.util.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobKey;
|
||||
|
||||
import com.data.util.EventType;
|
||||
import com.data.util.Utility;
|
||||
import com.evt.mgr.GroupPublisherService;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.TArray;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.plugin.redis.RedisLock;
|
||||
import com.taurus.core.util.Logger;
|
||||
import com.taurus.core.util.StringUtil;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
|
||||
public class CleanGroupLogJob implements Job {
|
||||
private Logger logger = Logger.getLogger(CleanGroupLogJob.class);
|
||||
|
||||
public CleanGroupLogJob() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除亲友圈中无效的房间
|
||||
*/
|
||||
private void cleanGroupMemberLog() {
|
||||
int time = DateUtils.getBeginDay() - 5 * 24 * 3600;
|
||||
String deleteSql = String.format("delete from group_member_log where time < %s", time);
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
DataBase.use().executeUpdate(deleteSql);
|
||||
logger.info("cleanGroupMemberLog use time:"+(System.currentTimeMillis()-startTime)+ " " + deleteSql);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanGroupHpLog() {
|
||||
int time = DateUtils.getBeginDay() - 20 * 24 * 3600;
|
||||
String deleteSql3 = String.format("delete from group_hp_log where time < %s limit 1000000", time);
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
DataBase.use().executeUpdate(deleteSql3);
|
||||
logger.info("CleanGroupHpLog use time:"+(System.currentTimeMillis()-startTime)+ " " + deleteSql3);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanRecRoomLog() {
|
||||
int time = DateUtils.getBeginDay() - 5 * 24 * 3600;
|
||||
String deleteSql2 = String.format("delete from room_rec_log where time < %s limit 1000000", time);
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
DataBase.use().executeUpdate(deleteSql2);
|
||||
logger.info("CleanRecRoomLog use time:"+(System.currentTimeMillis()-startTime) + " " + deleteSql2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) {
|
||||
JobKey jobKey = context.getJobDetail().getKey();
|
||||
if(jobKey.getName().equals("clean_group_member_log")) {
|
||||
logger.info("执行成功" + jobKey.getName());
|
||||
cleanGroupMemberLog();
|
||||
}
|
||||
if(jobKey.getName().equals("clean_group_hp_log")) {
|
||||
logger.info("执行成功" + jobKey.getName());
|
||||
CleanGroupHpLog();
|
||||
}
|
||||
if(jobKey.getName().equals("clean_rec_room_log")) {
|
||||
logger.info("执行成功" + jobKey.getName());
|
||||
CleanRecRoomLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,322 @@
|
|||
package com.evt.mgr.job;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.taurus.core.util.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobKey;
|
||||
|
||||
import com.data.util.EventType;
|
||||
import com.data.util.Utility;
|
||||
import com.evt.mgr.GroupPublisherService;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.TArray;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.plugin.redis.RedisLock;
|
||||
import com.taurus.core.util.Logger;
|
||||
import com.taurus.core.util.StringUtil;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
|
||||
public class CleanTimeOutRoomJob implements Job{
|
||||
|
||||
private Logger logger = Logger.getLogger(CleanTimeOutRoomJob.class);
|
||||
|
||||
public CleanTimeOutRoomJob() {
|
||||
|
||||
}
|
||||
|
||||
private void deleteRoomFromRedis(String tag_key,Jedis jedis0) {
|
||||
|
||||
RedisLock room_lock = new RedisLock(tag_key, jedis0);
|
||||
try {
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
List<String> paramList = jedis0.hmget(tag_key, "AA", "payer", "pay", "group","game","delete_status","status","create_time","id","players");
|
||||
|
||||
if(StringUtil.isEmpty(paramList.get(4))) {
|
||||
Redis.use().expire(tag_key, 20);
|
||||
return;
|
||||
}
|
||||
|
||||
String delete_status = paramList.get(5);
|
||||
if(StringUtil.isEmpty(delete_status)) {
|
||||
|
||||
String status = paramList.get(6);
|
||||
int _status = Integer.parseInt(status);
|
||||
if(_status == 2 || _status == 3) {
|
||||
logger.info(tag_key + "房间的状态不对,此时房间的状态["+status + "]");
|
||||
Redis.use().expire(tag_key, 20);
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果房间的存活时间小于4个小时,考虑到游戏服务器也在删除 所以延时10分钟
|
||||
String create_time = paramList.get(7);
|
||||
String roomid = paramList.get(8);
|
||||
long now = System.currentTimeMillis() / 1000;
|
||||
if((now - Long.parseLong(create_time)) > 14400 + 600) {
|
||||
|
||||
deleteRoomFromServer(tag_key,jedis0,false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
boolean pay_AA = Integer.parseInt(paramList.get(0)) == 1;
|
||||
int payer = Integer.parseInt(paramList.get(1));
|
||||
int pay = Integer.parseInt(paramList.get(2));
|
||||
int gameId = Integer.parseInt(paramList.get(4));
|
||||
String group = paramList.get(3);
|
||||
int _gid = 0;
|
||||
if(StringUtil.isNotEmpty(group)) {
|
||||
_gid = Integer.parseInt(group);
|
||||
}
|
||||
int _delete_status = Integer.parseInt(delete_status);
|
||||
if(_delete_status == 0) {
|
||||
|
||||
// 如果需要支付钻石
|
||||
if(pay > 0) {
|
||||
|
||||
if (pay_AA) {
|
||||
|
||||
String players_json = paramList.get(9);
|
||||
if(StringUtil.isEmpty(players_json) == false) {
|
||||
ITArray players = TArray.newFromJsonData(players_json);
|
||||
for (int i = 0; i < players.size(); i++) {
|
||||
//GroupPublisherService.refundDiamo(players.getInt(i), pay, _gid, gameId);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
if(_gid == 0) {
|
||||
//GroupPublisherService.refundDiamo(payer, pay, _gid, gameId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Redis.use().hset(tag_key, "status", 3 + "");
|
||||
Redis.use().hincrBy(tag_key, "cache_ver", 1);
|
||||
Redis.use().expire(tag_key, 20);
|
||||
}
|
||||
catch(Exception e) {
|
||||
logger.info(tag_key + "删除房间发生异常["+e.getMessage() + "]");
|
||||
}
|
||||
finally {
|
||||
room_lock.unlock(false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean deleteRoomFromServer(String roomid,Jedis jedis0,boolean lock) {
|
||||
|
||||
String tag_key = roomid;
|
||||
RedisLock room_lock = null;
|
||||
|
||||
if(lock) {
|
||||
room_lock = new RedisLock(tag_key, jedis0);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if( jedis0.exists(tag_key) == false) {
|
||||
return false;
|
||||
}
|
||||
// 0 1 2 3 4 5 6 7
|
||||
List<String> paramList = jedis0.hmget(tag_key, "AA", "payer", "pay", "group","game","status","create_time","id");
|
||||
|
||||
String status = paramList.get(5);
|
||||
int _status = Integer.parseInt(status);
|
||||
if(_status == 2 || _status == 3) {
|
||||
logger.info("删除房间" + roomid + "失败,原因状态不对,此时的状态是[" + _status +"]");
|
||||
return true;
|
||||
}
|
||||
|
||||
String group = paramList.get(3);
|
||||
int _gid = 0;
|
||||
if(StringUtil.isNotEmpty(group)) {
|
||||
_gid = Integer.parseInt(group);
|
||||
}
|
||||
|
||||
// 如果房间的存活时间小于4个小时,考虑到游戏服务器也在删除 所以延时10分钟
|
||||
String create_time = paramList.get(6);
|
||||
long now = System.currentTimeMillis() / 1000;
|
||||
if((now - Long.parseLong(create_time)) < 14400 + 600) {
|
||||
logger.info("删除房间" + roomid + "失败,房间距离创建没有超过4个小时");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(_gid != 0) {
|
||||
|
||||
// 如果游戏没有开始_status = 0
|
||||
// 不是aa支付,则退出回创建者创建钻石的费用
|
||||
// aa支付,设置status=2之后,则交给游戏服务器去做(如果游戏服务器挂了呢,或者房间在游戏服务器中根本就不存在呢),
|
||||
// 如果游戏已经开始_status = 1,则不用考虑钻石回退的问题,下一次执行的时候,如果redis还存在房间的信息,则直接从redis删除就可以了
|
||||
if(_status==0) {
|
||||
|
||||
int gameId = Integer.parseInt(paramList.get(4));
|
||||
boolean pay_AA = Integer.parseInt(paramList.get(0)) == 1;
|
||||
if (!pay_AA) {
|
||||
int payer = Integer.parseInt(paramList.get(1));
|
||||
int pay = Integer.parseInt(paramList.get(2));
|
||||
//Utility.payDiamo(EventType.REDIS_EVENT_BACK_PAY, payer, gameId, pay, _gid,0);
|
||||
}
|
||||
}
|
||||
String strRoomID = "";
|
||||
if(StringUtil.isNotEmpty(paramList.get(7))) {
|
||||
strRoomID =paramList.get(7);
|
||||
}
|
||||
GroupPublisherService.delRoomEvt(_gid, strRoomID);
|
||||
}
|
||||
|
||||
jedis0.hset(tag_key, "status", "2");
|
||||
jedis0.hset(tag_key, "delete_status", "" + status);
|
||||
jedis0.hincrBy(tag_key, "cache_ver", 1);
|
||||
|
||||
logger.info("删除房间" + roomid + "成功");
|
||||
}
|
||||
catch(Exception e){
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
if(room_lock != null) {
|
||||
room_lock.unlock(false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除无效的房间
|
||||
*/
|
||||
private void cleanInvalidRoom() {
|
||||
try {
|
||||
|
||||
Jedis jedis0 = Redis.use("group1_db0").getJedis();
|
||||
try {
|
||||
|
||||
String cursor = ScanParams.SCAN_POINTER_START;
|
||||
String key = "room:*";
|
||||
ScanParams scanParams = new ScanParams();
|
||||
scanParams.match(key);
|
||||
scanParams.count(1000);
|
||||
|
||||
// 处理所有redis的房间
|
||||
while (true){
|
||||
|
||||
ScanResult<String> scanResult = jedis0.scan(cursor, scanParams);
|
||||
cursor = scanResult.getStringCursor();
|
||||
List<String> list = scanResult.getResult();
|
||||
|
||||
for(int m = 0; m < list.size(); m++){
|
||||
|
||||
String mapentry = list.get(m);
|
||||
logger.info("正在检查房间 " + mapentry);
|
||||
deleteRoomFromRedis(mapentry,jedis0);
|
||||
}
|
||||
|
||||
if ("0".equals(cursor)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
jedis0.close();
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除亲友圈中无效的房间
|
||||
*/
|
||||
private void cleanGroupRoom() {
|
||||
|
||||
try {
|
||||
|
||||
Jedis jedis11 = Redis.use("group1_db11").getJedis();
|
||||
Jedis jedis0 = Redis.use("group1_db0").getJedis();
|
||||
|
||||
RedisLock lock = new RedisLock("room_clean", jedis11);
|
||||
try {
|
||||
|
||||
String cursor = ScanParams.SCAN_POINTER_START;
|
||||
String key = "*:rooms*";
|
||||
ScanParams scanParams = new ScanParams();
|
||||
scanParams.match(key);
|
||||
scanParams.count(1000);
|
||||
|
||||
// 处理亲友圈的房间
|
||||
while (true){
|
||||
|
||||
ScanResult<String> scanResult = jedis11.scan(cursor, scanParams);
|
||||
cursor = scanResult.getStringCursor();
|
||||
List<String> list = scanResult.getResult();
|
||||
|
||||
for(int m = 0; m < list.size(); m++){
|
||||
|
||||
|
||||
String mapentry = list.get(m);
|
||||
logger.info("正在查询群" +mapentry + "的无效房间");
|
||||
Set<String> rooms = jedis11.zrangeByScore(mapentry, 100000, 1000000);
|
||||
|
||||
for (String roomId : rooms) {
|
||||
logger.info("正在查询群" +mapentry + "的无效房间" + roomId);
|
||||
boolean existed = deleteRoomFromServer(roomId,jedis0,true);
|
||||
if(!existed) {
|
||||
jedis11.zrem(mapentry, roomId);
|
||||
logger.info("删除群" +mapentry + "的无效房间" + roomId + "因为房间不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ("0".equals(cursor)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
lock.unlock();
|
||||
jedis0.close();
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除亲友圈中无效的房间
|
||||
*/
|
||||
private void cleanGroupMemberLog() {
|
||||
int time = DateUtils.getBeginDay() - 5 * 24 * 3600;
|
||||
String deleteSql = String.format("delete from group_member_log where time < %s", time);
|
||||
Utility.evtdbLog(1, 1, deleteSql);
|
||||
String deleteSql2 = String.format("delete from room_rec_log where time < %s and time > %s", time, time - 24 * 3600);
|
||||
Utility.evtdbLog(1, 1, deleteSql2);
|
||||
String deleteSql3 = String.format("delete from group_hp_log where time < %s and time > %s", time, time - 24 * 3600);
|
||||
Utility.evtdbLog(1, 1, deleteSql3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) {
|
||||
|
||||
JobKey jobKey = context.getJobDetail().getKey();
|
||||
if(jobKey.getName().equals("clean_group_room") || jobKey.getName().equals("clean_group_room1")) {
|
||||
logger.info("执行成功" + jobKey.getName());
|
||||
cleanGroupRoom();
|
||||
logger.info("执行成功cleanGroupMemberLog");
|
||||
cleanGroupMemberLog();
|
||||
}
|
||||
else if(jobKey.getName().equals("clean_invalid_room")|| jobKey.getName().equals("clean_invalid_room1")) {
|
||||
logger.info("执行成功" + jobKey.getName());
|
||||
cleanInvalidRoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<filter>
|
||||
<filter-name>taurus-web</filter-name>
|
||||
<filter-class>com.taurus.web.WebFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>main</param-name>
|
||||
<param-value>com.evt.mgr.EventServer</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>taurus-web</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
</web-app>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||
|
||||
|
||||
# Regular FileAppender
|
||||
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||
log4j.appender.fileAppender.Encoding=UTF-8
|
||||
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.dailyFile.Append=true
|
||||
|
||||
# The file is rolled over very day
|
||||
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<serivce-core>
|
||||
<log4jPath>log4j.properties</log4jPath>
|
||||
|
||||
<plugin>
|
||||
<id>database</id>
|
||||
<class>com.taurus.core.plugin.database.DataBasePlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认10个 -->
|
||||
<maxPool>100</maxPool>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>10</minIdle>
|
||||
<!-- 配置获取连接等待超时的时间,单位是毫秒, 默认180000 -->
|
||||
<maxLifetime>180000</maxLifetime>
|
||||
<!--hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
Oracle - "select 1 from dual"
|
||||
DB2 - "select 1 from sysibm.sysdummy1"
|
||||
mysql - "select 1" -->
|
||||
<validationQuery>select 1</validationQuery>
|
||||
<!-- 连接超时时间,默认30000-->
|
||||
<connectionTimeout>10000</connectionTimeout>
|
||||
<!-- 待机超时时间,单位是毫秒, 默认60000 -->
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
|
||||
<!-- jdbc 属性 -->
|
||||
<props>
|
||||
<useSSL>false</useSSL>
|
||||
<useUnicode>true</useUnicode>
|
||||
<characterEncoding>utf-8</characterEncoding>
|
||||
<!-- 服务器时区 -->
|
||||
<serverTimezone>UTC</serverTimezone>
|
||||
<!-- 预编译缓存 -->
|
||||
<cachePrepStmts>true</cachePrepStmts>
|
||||
<!-- 预编译缓存大小 -->
|
||||
<prepStmtCacheSize>250</prepStmtCacheSize>
|
||||
<!-- 控制长度多大的sql可以被缓存 -->
|
||||
<prepStmtCacheSqlLimit>2048</prepStmtCacheSqlLimit>
|
||||
</props>
|
||||
</poolConfig>
|
||||
|
||||
<databases>
|
||||
<db>
|
||||
<name>db1</name>
|
||||
<driverName>com.mysql.cj.jdbc.Driver</driverName>
|
||||
<jdbcUrl>jdbc:mysql://8.134.123.86:8060/wb_game</jdbcUrl>
|
||||
<userName>root</userName>
|
||||
<password>cssq@2020</password>
|
||||
</db>
|
||||
</databases>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<id>redis</id>
|
||||
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>80</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>20</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>5</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" password="cssq@2020" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" password="cssq@2020" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db5" host="127.0.0.1" password="cssq@2020" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="127.0.0.1" password="cssq@2020" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db9" host="127.0.0.1" password="cssq@2020" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" password="cssq@2020" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="127.0.0.1" password="cssq@2020" port="6379" database="11" timeout="5000"/>
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
|
||||
import com.taurus.web.JettyServer;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new JettyServer("src/main/webapp",8083,"/").start();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<filter>
|
||||
<filter-name>taurus-web</filter-name>
|
||||
<filter-class>com.taurus.web.WebFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>main</param-name>
|
||||
<param-value>com.evt.mgr.EventServer</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>taurus-web</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
</web-app>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||
|
||||
|
||||
# Regular FileAppender
|
||||
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||
log4j.appender.fileAppender.Encoding=UTF-8
|
||||
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.dailyFile.Append=true
|
||||
|
||||
# The file is rolled over very day
|
||||
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<serivce-core>
|
||||
<log4jPath>log4j.properties</log4jPath>
|
||||
|
||||
<plugin>
|
||||
<id>database</id>
|
||||
<class>com.taurus.core.plugin.database.DataBasePlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认10个 -->
|
||||
<maxPool>100</maxPool>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>5</minIdle>
|
||||
<!-- 配置获取连接等待超时的时间,单位是毫秒, 默认180000 -->
|
||||
<maxLifetime>180000</maxLifetime>
|
||||
<!--hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
Oracle - "select 1 from dual"
|
||||
DB2 - "select 1 from sysibm.sysdummy1"
|
||||
mysql - "select 1" -->
|
||||
<validationQuery>select 1</validationQuery>
|
||||
<!-- 连接超时时间,默认30000-->
|
||||
<connectionTimeout>10000</connectionTimeout>
|
||||
<!-- 待机超时时间,单位是毫秒, 默认60000 -->
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
|
||||
<!-- jdbc 属性 -->
|
||||
<props>
|
||||
<useSSL>false</useSSL>
|
||||
<useUnicode>true</useUnicode>
|
||||
<characterEncoding>utf-8</characterEncoding>
|
||||
<!-- 服务器时区 -->
|
||||
<serverTimezone>UTC</serverTimezone>
|
||||
<!-- 预编译缓存 -->
|
||||
<cachePrepStmts>true</cachePrepStmts>
|
||||
<!-- 预编译缓存大小 -->
|
||||
<prepStmtCacheSize>250</prepStmtCacheSize>
|
||||
<!-- 控制长度多大的sql可以被缓存 -->
|
||||
<prepStmtCacheSqlLimit>2048</prepStmtCacheSqlLimit>
|
||||
</props>
|
||||
</poolConfig>
|
||||
|
||||
<databases>
|
||||
<db>
|
||||
<name>db1</name>
|
||||
<driverName>com.mysql.cj.jdbc.Driver</driverName>
|
||||
<jdbcUrl>jdbc:mysql://192.168.0.11:6060/wb_game</jdbcUrl>
|
||||
<userName>proto_ff</userName>
|
||||
<password>37du_game</password>
|
||||
</db>
|
||||
</databases>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<id>redis</id>
|
||||
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>80</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>8</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>2</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" password="123456" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" password="123456" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db2" host="127.0.0.1" password="123456" port="6379" database="2" timeout="5000"/>
|
||||
<info name="group1_db5" host="127.0.0.1" password="123456" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="127.0.0.1" password="123456" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db9" host="127.0.0.1" password="123456" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" password="123456" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="127.0.0.1" password="123456" port="6379" database="11" timeout="5000"/>
|
||||
<info name="group1_db15" host="127.0.0.1" password="123456" port="6379" database="15" timeout="5000"/>
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Wed Dec 03 21:11:05 CST 2025
|
||||
version=1.0.0
|
||||
groupId=com.evt
|
||||
artifactId=event_mgr
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
com\evt\mgr\EventReceiver$GroupRunnable.class
|
||||
com\evt\mgr\GroupPublisherService.class
|
||||
com\evt\mgr\handler\HandlerGroupRound.class
|
||||
com\evt\mgr\EventReceiver.class
|
||||
com\evt\mgr\handler\HandlerPay.class
|
||||
com\evt\mgr\IHandler.class
|
||||
com\evt\mgr\handler\HandlerHpConsume.class
|
||||
com\evt\mgr\handler\HandlerLose.class
|
||||
com\evt\mgr\handler\HandlerOver.class
|
||||
com\evt\mgr\handler\HandlerGroupMemberRound.class
|
||||
com\evt\mgr\EventController.class
|
||||
com\evt\mgr\job\CleanGroupLogJob.class
|
||||
com\evt\mgr\handler\HandlerWin.class
|
||||
com\evt\mgr\EventServer.class
|
||||
com\evt\mgr\job\CleanTimeOutRoomJob.class
|
||||
com\evt\mgr\Utils.class
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\job\CleanTimeOutRoomJob.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\EventController.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\handler\HandlerWin.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\handler\HandlerOver.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\job\CleanGroupLogJob.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\IHandler.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\handler\HandlerPay.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\EventServer.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\handler\HandlerHpConsume.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\GroupPublisherService.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\handler\HandlerLose.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\handler\HandlerGroupMemberRound.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\handler\HandlerGroupRound.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\EventReceiver.java
|
||||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\main\java\com\evt\mgr\Utils.java
|
||||
|
|
@ -0,0 +1 @@
|
|||
Main.class
|
||||
|
|
@ -0,0 +1 @@
|
|||
D:\changhong111\xtserver_anchou\game_web\event_mgr\src\test\java\Main.java
|
||||
Binary file not shown.
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||
|
||||
|
||||
# Regular FileAppender
|
||||
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||
log4j.appender.fileAppender.Encoding=UTF-8
|
||||
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.dailyFile.Append=true
|
||||
|
||||
# The file is rolled over very day
|
||||
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mgr-config>
|
||||
<host>124.220.176.78:4013</host>
|
||||
<mgrId>1000</mgrId>
|
||||
<loggerDebug>true</loggerDebug>
|
||||
</mgr-config>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<serivce-core>
|
||||
<log4jPath>log4j.properties</log4jPath>
|
||||
|
||||
<plugin>
|
||||
<id>database</id>
|
||||
<class>com.taurus.core.plugin.database.DataBasePlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认10个 -->
|
||||
<maxPool>100</maxPool>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>10</minIdle>
|
||||
<!-- 配置获取连接等待超时的时间,单位是毫秒, 默认180000 -->
|
||||
<maxLifetime>180000</maxLifetime>
|
||||
<!--hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
Oracle - "select 1 from dual"
|
||||
DB2 - "select 1 from sysibm.sysdummy1"
|
||||
mysql - "select 1" -->
|
||||
<validationQuery>select 1</validationQuery>
|
||||
<!-- 连接超时时间,默认30000-->
|
||||
<connectionTimeout>10000</connectionTimeout>
|
||||
<!-- 待机超时时间,单位是毫秒, 默认60000 -->
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
|
||||
<!-- jdbc 属性 -->
|
||||
<props>
|
||||
<useSSL>false</useSSL>
|
||||
<useUnicode>true</useUnicode>
|
||||
<characterEncoding>utf-8</characterEncoding>
|
||||
<!-- 服务器时区 -->
|
||||
<serverTimezone>UTC</serverTimezone>
|
||||
<!-- 预编译缓存 -->
|
||||
<cachePrepStmts>true</cachePrepStmts>
|
||||
<!-- 预编译缓存大小 -->
|
||||
<prepStmtCacheSize>250</prepStmtCacheSize>
|
||||
<!-- 控制长度多大的sql可以被缓存 -->
|
||||
<prepStmtCacheSqlLimit>2048</prepStmtCacheSqlLimit>
|
||||
</props>
|
||||
</poolConfig>
|
||||
|
||||
<databases>
|
||||
<db>
|
||||
<name>db1</name>
|
||||
<driverName>com.mysql.cj.jdbc.Driver</driverName>
|
||||
<jdbcUrl>jdbc:mysql://192.168.0.11:6060/wb_game</jdbcUrl>
|
||||
<userName>proto_ff</userName>
|
||||
<password>37du_game</password>
|
||||
</db>
|
||||
</databases>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<id>redis</id>
|
||||
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>80</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>20</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>5</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" password="123456" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" password="123456" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db5" host="127.0.0.1" password="123456" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="127.0.0.1" password="123456" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db9" host="127.0.0.1" password="123456" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" password="123456" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="127.0.0.1" password="123456" port="6379" database="11" timeout="5000"/>
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<server>
|
||||
<!-- 计时器线程池大小-->
|
||||
<timerThreadPoolSize>1</timerThreadPoolSize>
|
||||
<!-- 协议包压缩门槛 (单位字节),当协议包大于设定的值则会进行压缩 -->
|
||||
<protocolCompression>128</protocolCompression>
|
||||
<!-- 读缓冲区类型 nio Direct Buffer 或者 Heap Buffer-->
|
||||
<readBufferType>Heap</readBufferType>
|
||||
<!-- 写入冲区类型 nio Direct Buffer 或者 Heap Buffer-->
|
||||
<writeBufferType>Heap</writeBufferType>
|
||||
<!-- 最大的数据包大小 -->
|
||||
<maxPacketSize>524288</maxPacketSize>
|
||||
<!-- 最大读取缓存大小 -->
|
||||
<maxReadBufferSize>1024</maxReadBufferSize>
|
||||
<!-- 最大写入缓存大小 -->
|
||||
<maxWriteBufferSize>32768</maxWriteBufferSize>
|
||||
<!-- 会话队列的大小-->
|
||||
<sessionPacketQueueSize>160</sessionPacketQueueSize>
|
||||
|
||||
<!-- Thread Pool Size of the 3 main stages of the Bitswarm Engine -->
|
||||
<socketAcceptorThreadPoolSize>1</socketAcceptorThreadPoolSize>
|
||||
<socketReaderThreadPoolSize>3</socketReaderThreadPoolSize>
|
||||
<socketWriterThreadPoolSize>3</socketWriterThreadPoolSize>
|
||||
|
||||
<!-- Enable disable Nagle algorithm on sockets, true == disable -->
|
||||
<tcpNoDelay>true</tcpNoDelay>
|
||||
<!-- 会话超时时间(单位秒)-->
|
||||
<sessionTimeout>15</sessionTimeout>
|
||||
|
||||
<!-- Bind socket addresses -->
|
||||
<socketAddresses>
|
||||
<socket address="0.0.0.0" port="11050" type="TCP" />
|
||||
</socketAddresses>
|
||||
|
||||
<!-- Ip addresses filter-->
|
||||
<ipFilter>
|
||||
<addressBlackList>
|
||||
<string>1.2.3.4</string>
|
||||
</addressBlackList>
|
||||
<addressWhiteList>
|
||||
<string>127.0.0.1</string>
|
||||
</addressWhiteList>
|
||||
<maxConnectionsPerAddress>10000</maxConnectionsPerAddress>
|
||||
</ipFilter>
|
||||
|
||||
<webSocket>
|
||||
<isActive>false</isActive>
|
||||
<address>0.0.0.0</address>
|
||||
<port>8080</port>
|
||||
</webSocket>
|
||||
|
||||
<!-- Main extension class -->
|
||||
<extensionConfig>
|
||||
<name>extension - group_mgr </name>
|
||||
<className>com.mgr.group.MainServer</className>
|
||||
</extensionConfig>
|
||||
|
||||
<!-- The system thread pool config -->
|
||||
<systemThreadPoolConfig>
|
||||
<name>Sys</name>
|
||||
<corePoolSize>2</corePoolSize>
|
||||
<maxPoolSize>8</maxPoolSize>
|
||||
<keepAliveTime>60000</keepAliveTime>
|
||||
<maxQueueSize>20000</maxQueueSize>
|
||||
</systemThreadPoolConfig>
|
||||
|
||||
<!-- The extension thread pool config -->
|
||||
<extensionThreadPoolConfig>
|
||||
<name>Ext</name>
|
||||
<corePoolSize>2</corePoolSize>
|
||||
<maxPoolSize>8</maxPoolSize>
|
||||
<keepAliveTime>60000</keepAliveTime>
|
||||
<maxQueueSize>20000</maxQueueSize>
|
||||
</extensionThreadPoolConfig>
|
||||
|
||||
</server>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||
|
||||
|
||||
# Regular FileAppender
|
||||
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||
log4j.appender.fileAppender.Encoding=UTF-8
|
||||
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.dailyFile.Append=true
|
||||
|
||||
# The file is rolled over very day
|
||||
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mgr-config>
|
||||
<host>124.220.176.78:4013</host>
|
||||
<mgrId>1000</mgrId>
|
||||
<loggerDebug>true</loggerDebug>
|
||||
</mgr-config>
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<serivce-core>
|
||||
<log4jPath>log4j.properties</log4jPath>
|
||||
|
||||
<plugin>
|
||||
<id>database</id>
|
||||
<class>com.taurus.core.plugin.database.DataBasePlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认10个 -->
|
||||
<maxPool>160</maxPool>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>5</minIdle>
|
||||
<!-- 配置获取连接等待超时的时间,单位是毫秒, 默认180000 -->
|
||||
<maxLifetime>180000</maxLifetime>
|
||||
<!--hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
Oracle - "select 1 from dual"
|
||||
DB2 - "select 1 from sysibm.sysdummy1"
|
||||
mysql - "select 1" -->
|
||||
<validationQuery>select 1</validationQuery>
|
||||
<!-- 连接超时时间,默认30000-->
|
||||
<connectionTimeout>10000</connectionTimeout>
|
||||
<!-- 待机超时时间,单位是毫秒, 默认60000 -->
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
|
||||
<!-- jdbc 属性 -->
|
||||
<props>
|
||||
<useSSL>false</useSSL>
|
||||
<useUnicode>true</useUnicode>
|
||||
<characterEncoding>utf-8</characterEncoding>
|
||||
<!-- 服务器时区 -->
|
||||
<serverTimezone>UTC</serverTimezone>
|
||||
<!-- 预编译缓存 -->
|
||||
<cachePrepStmts>true</cachePrepStmts>
|
||||
<!-- 预编译缓存大小 -->
|
||||
<prepStmtCacheSize>250</prepStmtCacheSize>
|
||||
<!-- 控制长度多大的sql可以被缓存 -->
|
||||
<prepStmtCacheSqlLimit>2048</prepStmtCacheSqlLimit>
|
||||
</props>
|
||||
</poolConfig>
|
||||
|
||||
<databases>
|
||||
<db>
|
||||
<name>db1</name>
|
||||
<driverName>com.mysql.cj.jdbc.Driver</driverName>
|
||||
<jdbcUrl>jdbc:mysql://192.168.0.11:6060/wb_game</jdbcUrl>
|
||||
<userName>proto_ff</userName>
|
||||
<password>37du_game</password>
|
||||
</db>
|
||||
</databases>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<id>redis</id>
|
||||
<class>com.taurus.core.plugin.redis.RedisPlugin</class>
|
||||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>160</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>16</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>10</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
<!-- 表示idle object evitor每次扫描的最多的对象数, 默认-1 -->
|
||||
<numTestsPerEvictionRun>100</numTestsPerEvictionRun>
|
||||
<!-- 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;
|
||||
这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 , 默认60000-->
|
||||
<minEvictableIdleTimeMillis>60000</minEvictableIdleTimeMillis>
|
||||
<!-- 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认30000 -->
|
||||
<timeBetweenEvictionRunsMillis>30000</timeBetweenEvictionRunsMillis>
|
||||
<!-- 在minEvictableIdleTimeMillis基础上,加入了至少minIdle个对象已经在pool里面了。
|
||||
如果为-1,evicted不会根据idle time驱逐任何对象。如果minEvictableIdleTimeMillisd大于0,
|
||||
则此项设置无意义,且只有在timeBetweenEvictionRunsMillis大于0时才有意义,默认1800000 -->
|
||||
<softMinEvictableIdleTimeMillis>1800000</softMinEvictableIdleTimeMillis>
|
||||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" password="123456" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" password="123456" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db2" host="127.0.0.1" password="123456" port="6379" database="2" timeout="5000"/>
|
||||
<info name="group1_db5" host="127.0.0.1" password="123456" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="127.0.0.1" password="123456" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db9" host="127.0.0.1" password="123456" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" password="123456" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="127.0.0.1" password="123456" port="6379" database="11" timeout="5000"/>
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<server>
|
||||
<!-- 计时器线程池大小-->
|
||||
<timerThreadPoolSize>1</timerThreadPoolSize>
|
||||
<!-- 协议包压缩门槛 (单位字节),当协议包大于设定的值则会进行压缩 -->
|
||||
<protocolCompression>128</protocolCompression>
|
||||
<!-- 读缓冲区类型 nio Direct Buffer 或者 Heap Buffer-->
|
||||
<readBufferType>Heap</readBufferType>
|
||||
<!-- 写入冲区类型 nio Direct Buffer 或者 Heap Buffer-->
|
||||
<writeBufferType>Heap</writeBufferType>
|
||||
<!-- 最大的数据包大小 -->
|
||||
<maxPacketSize>524288</maxPacketSize>
|
||||
<!-- 最大读取缓存大小 -->
|
||||
<maxReadBufferSize>1024</maxReadBufferSize>
|
||||
<!-- 最大写入缓存大小 -->
|
||||
<maxWriteBufferSize>32768</maxWriteBufferSize>
|
||||
<!-- 会话队列的大小-->
|
||||
<sessionPacketQueueSize>160</sessionPacketQueueSize>
|
||||
|
||||
<!-- Thread Pool Size of the 3 main stages of the Bitswarm Engine -->
|
||||
<socketAcceptorThreadPoolSize>1</socketAcceptorThreadPoolSize>
|
||||
<socketReaderThreadPoolSize>3</socketReaderThreadPoolSize>
|
||||
<socketWriterThreadPoolSize>20</socketWriterThreadPoolSize>
|
||||
|
||||
<!-- Enable disable Nagle algorithm on sockets, true == disable -->
|
||||
<tcpNoDelay>true</tcpNoDelay>
|
||||
<!-- 会话超时时间(单位秒)-->
|
||||
<sessionTimeout>15</sessionTimeout>
|
||||
|
||||
<!-- Bind socket addresses -->
|
||||
<socketAddresses>
|
||||
<socket address="0.0.0.0" port="11050" type="TCP" />
|
||||
</socketAddresses>
|
||||
|
||||
<!-- Ip addresses filter-->
|
||||
<ipFilter>
|
||||
<addressBlackList>
|
||||
<string>1.2.3.4</string>
|
||||
</addressBlackList>
|
||||
<addressWhiteList>
|
||||
<string>127.0.0.1</string>
|
||||
</addressWhiteList>
|
||||
<maxConnectionsPerAddress>10000</maxConnectionsPerAddress>
|
||||
</ipFilter>
|
||||
|
||||
<webSocket>
|
||||
<isActive>false</isActive>
|
||||
<address>0.0.0.0</address>
|
||||
<port>8080</port>
|
||||
</webSocket>
|
||||
|
||||
<!-- Main extension class -->
|
||||
<extensionConfig>
|
||||
<name>extension - group_mgr </name>
|
||||
<className>com.mgr.group.MainServer</className>
|
||||
</extensionConfig>
|
||||
|
||||
<!-- The system thread pool config -->
|
||||
<systemThreadPoolConfig>
|
||||
<name>Sys</name>
|
||||
<corePoolSize>4</corePoolSize>
|
||||
<maxPoolSize>16</maxPoolSize>
|
||||
<keepAliveTime>60000</keepAliveTime>
|
||||
<maxQueueSize>20000</maxQueueSize>
|
||||
</systemThreadPoolConfig>
|
||||
|
||||
<!-- The extension thread pool config -->
|
||||
<extensionThreadPoolConfig>
|
||||
<name>Ext</name>
|
||||
<corePoolSize>4</corePoolSize>
|
||||
<maxPoolSize>16</maxPoolSize>
|
||||
<keepAliveTime>60000</keepAliveTime>
|
||||
<maxQueueSize>20000</maxQueueSize>
|
||||
</extensionThreadPoolConfig>
|
||||
|
||||
</server>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
log4j.rootLogger = INFO,consoleAppender,fileAppender
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.consoleAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%t] %c{2} %3x - %m%n
|
||||
|
||||
|
||||
# Regular FileAppender
|
||||
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.fileAppender.File=${WORKDIR}/logs/web_main.log
|
||||
log4j.appender.fileAppender.layout.ConversionPattern=%d{dd MMM yyyy | HH:mm:ss,SSS} | %-5p | %t | %c{3} | %3x | %m%n
|
||||
log4j.appender.fileAppender.Encoding=UTF-8
|
||||
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
|
||||
log4j.appender.dailyFile.Append=true
|
||||
|
||||
# The file is rolled over very day
|
||||
log4j.appender.fileAppender.DatePattern ='.'yyyy-MM-dd
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mgr-config>
|
||||
<host>39.101.179.66:11050</host>
|
||||
<mgrId>1000</mgrId>
|
||||
<loggerDebug>true</loggerDebug>
|
||||
</mgr-config>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue