Skip to content

Commit 6903773

Browse files
Merge pull request #7 from Talexs/develop
Develop
2 parents 539815b + 6f4404a commit 6903773

94 files changed

Lines changed: 2602 additions & 1242 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

mvnw

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<dependency>
108108
<groupId>mysql</groupId>
109109
<artifactId>mysql-connector-java</artifactId>
110-
<version>8.0.28</version>
110+
<version>8.0.29</version>
111111
<scope>runtime</scope>
112112
</dependency>
113113
<dependency>
@@ -184,7 +184,7 @@
184184
<dependency>
185185
<groupId>cn.hutool</groupId>
186186
<artifactId>hutool-all</artifactId>
187-
<version>5.8.0</version>
187+
<version>5.8.1</version>
188188
</dependency>
189189
<!-- <dependency>-->
190190
<!-- <groupId>org.springframework.boot</groupId>-->

src/main/java/com/talexframe/frame/config/RedisConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class RedisConfig {
1818
//
1919
// redisTemplate.setConnectionFactory(connectionFactory);
2020
//
21-
// Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
21+
// Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.app);
2222
//
2323
// ObjectMapper objectMapper = new ObjectMapper();
2424
// objectMapper.setVisibility(PropertyAccessor.ALL, com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY);

src/main/java/com/talexframe/frame/core/function/command/CommandManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.talexframe.frame.core.function.command;
22

33
import cn.hutool.core.util.StrUtil;
4-
import com.talexframe.frame.core.pojo.annotations.TalexCommand;
4+
import com.talexframe.frame.core.pojo.annotations.TCmd;
55
import com.talexframe.frame.core.pojo.wrapper.WrappedSender;
66
import com.talexframe.frame.core.talex.TFrame;
77
import lombok.Getter;
@@ -99,7 +99,7 @@ private void processCmdClass(ISender sender, BaseCommand cmd, String wholeCmd, S
9999

100100
for ( Method method : cmd.getClass().getMethods() ) {
101101

102-
TalexCommand tc = method.getAnnotation(TalexCommand.class);
102+
TCmd tc = method.getAnnotation(TCmd.class);
103103

104104
if ( tc == null ) {
105105
continue;

src/main/java/com/talexframe/frame/core/function/command/frame/InfoCmd.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import cn.hutool.system.*;
44
import com.talexframe.frame.core.function.command.BaseCommand;
5-
import com.talexframe.frame.core.pojo.annotations.TalexCommand;
5+
import com.talexframe.frame.core.pojo.annotations.TCmd;
66
import com.talexframe.frame.core.pojo.wrapper.WrappedSender;
77
import com.talexframe.frame.core.talex.TFrame;
88

@@ -19,7 +19,7 @@ public InfoCmd() {
1919
super(TFrame.tframe.getFrameSender(), "info", new String[] { "information", "i" }, "信息命令");
2020
}
2121

22-
@TalexCommand
22+
@TCmd
2323
public void onDefault(WrappedSender sender) {
2424

2525
sender.sendMessage(DIVIDER);
@@ -31,7 +31,7 @@ public void onDefault(WrappedSender sender) {
3131

3232
}
3333

34-
@TalexCommand( "details" )
34+
@TCmd( "details" )
3535
public void onDetails(WrappedSender sender) {
3636

3737
sender.sendMessage( DIVIDER );
@@ -72,7 +72,7 @@ public void onDetails(WrappedSender sender) {
7272

7373
}
7474

75-
@TalexCommand( "platform" )
75+
@TCmd( "platform" )
7676
public void onPlatform(WrappedSender sender) {
7777

7878
sender.sendMessage( DIVIDER );
@@ -96,8 +96,8 @@ public void onPlatform(WrappedSender sender) {
9696
sender.sendMessage(" --> version: " + runtimeInfo.getVersion());
9797
sender.sendMessage(" --> home: " + runtimeInfo.getHomeDir());
9898
sender.sendMessage(" --> endorsed-dirs: " + runtimeInfo.getEndorsedDirs());
99-
sender.sendMessage(" --> class-path: " + runtimeInfo.getClassPath());
100-
sender.sendMessage(" --> class-version: " + runtimeInfo.getClassVersion());
99+
sender.sendMessage(" --> app-path: " + runtimeInfo.getClassPath());
100+
sender.sendMessage(" --> app-version: " + runtimeInfo.getClassVersion());
101101
sender.sendMessage(" --> library-path: " + runtimeInfo.getLibraryPath());
102102
sender.sendMessage(" --> protocol-packages: " + runtimeInfo.getProtocolPackages());
103103

@@ -115,7 +115,7 @@ public void onPlatform(WrappedSender sender) {
115115

116116
}
117117

118-
@TalexCommand( "version" )
118+
@TCmd( "version" )
119119
public void onVersion(WrappedSender sender) {
120120

121121
sender.sendMessage( DIVIDER );

src/main/java/com/talexframe/frame/core/function/command/frame/PluginCmd.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import com.talexframe.frame.core.function.command.ISender;
55
import com.talexframe.frame.core.modules.plugins.core.PluginInfo;
66
import com.talexframe.frame.core.modules.plugins.core.WebPlugin;
7-
import com.talexframe.frame.core.pojo.annotations.TalexCommand;
7+
import com.talexframe.frame.core.pojo.annotations.TCmd;
88
import com.talexframe.frame.core.pojo.mapper.frame.FrameSender;
99
import com.talexframe.frame.core.pojo.wrapper.WrappedSender;
1010
import com.talexframe.frame.core.talex.TFrame;
@@ -22,7 +22,7 @@ public PluginCmd() {
2222
super(TFrame.tframe.getFrameSender(), "plugin", new String[] { "plugins", "plugman" }, "插件命令");
2323
}
2424

25-
@TalexCommand
25+
@TCmd
2626
public void onDefault(WrappedSender sender) {
2727

2828
sender.sendMessage(DIVIDER);
@@ -35,7 +35,7 @@ public void onDefault(WrappedSender sender) {
3535

3636
}
3737

38-
@TalexCommand( "list" )
38+
@TCmd( "list" )
3939
public void onListPlugin(WrappedSender sender) {
4040

4141
sender.sendMessage("%divider%");
@@ -58,14 +58,14 @@ public void onListPlugin(WrappedSender sender) {
5858

5959
}
6060

61-
@TalexCommand( "load" )
61+
@TCmd( "load" )
6262
public void onLoadPlugin(ISender sender, String loadPlugin) {
6363

6464
tframe.getPluginManager().loadPlugin(loadPlugin);
6565

6666
}
6767

68-
@TalexCommand( "unload" )
68+
@TCmd( "unload" )
6969
public void onUnloadPlugin(ISender sender, String loadPlugin) {
7070

7171
sender.sendMessage("[插件] 正在卸载插件 " + loadPlugin);
@@ -88,7 +88,7 @@ public void onUnloadPlugin(ISender sender, String loadPlugin) {
8888

8989
}
9090

91-
@TalexCommand( "reload" )
91+
@TCmd( "reload" )
9292
public void onReloadPlugin(ISender sender, String loadPlugin) {
9393

9494
sender.sendMessage("[插件] 正在重载插件 " + loadPlugin);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.talexframe.frame.core.function.command.frame;
2+
3+
import com.talexframe.frame.core.function.command.BaseCommand;
4+
import com.talexframe.frame.core.function.command.ISender;
5+
import com.talexframe.frame.core.talex.TFrame;
6+
import com.talexframe.launcher.Launcher;
7+
8+
/**
9+
* 帮助命令 <br /> {@link com.talexframe.frame.function.command.frame Package }
10+
*
11+
* @author TalexDreamSoul
12+
* @date 2022/1/20 11:40 <br /> Project: TalexFrame <br />
13+
*/
14+
public class RestartCmd extends BaseCommand {
15+
16+
public RestartCmd() {
17+
18+
super(TFrame.tframe.getFrameSender(), "restart", new String[] {}, "重启系统");
19+
}
20+
21+
@Override
22+
public boolean executeCommand(ISender sender, String wholeCommand, String matchedLabel, String[] args) {
23+
24+
Launcher.restart = true;
25+
26+
tframe.shutdown();
27+
28+
return false;
29+
30+
}
31+
32+
}

src/main/java/com/talexframe/frame/core/function/listener/FrameMajorListener.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.talexframe.frame.core.function.listener;
22

3+
import cn.hutool.core.thread.ThreadUtil;
34
import com.talexframe.frame.TalexFrameApplication;
45
import com.talexframe.frame.core.modules.event.events.frame.*;
56
import com.talexframe.frame.core.pojo.enums.FrameStatus;
67
import com.talexframe.frame.core.talex.TFrame;
8+
import com.talexframe.launcher.Launcher;
79
import lombok.SneakyThrows;
810
import lombok.extern.slf4j.Slf4j;
911
import org.springframework.boot.context.event.ApplicationPreparedEvent;
@@ -95,6 +97,22 @@ public void onStopped(ContextClosedEvent event) {
9597

9698
scanner.close();
9799

100+
} else if( Launcher.restart ) {
101+
102+
ThreadUtil.execAsync(() -> {
103+
104+
log.info("[框架] 将在 3 秒后重启...");
105+
106+
try {
107+
Thread.sleep(3000);
108+
} catch ( InterruptedException e ) {
109+
throw new RuntimeException(e);
110+
}
111+
112+
TalexFrameApplication.start(Launcher.g_args);
113+
114+
});
115+
98116
}
99117

100118
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.talexframe.frame.core.function.listener;
2+
3+
import cn.dev33.satoken.listener.SaTokenListener;
4+
import cn.dev33.satoken.stp.SaLoginModel;
5+
import com.talexframe.frame.core.modules.event.events.satoken.*;
6+
import com.talexframe.frame.core.talex.TFrame;
7+
import org.springframework.stereotype.Component;
8+
9+
/**
10+
* {@link com.talexframe.frame.core.function.listener Package }
11+
*
12+
* @author TalexDreamSoul 22/06/05 下午 11:52 Project: TalexFrame
13+
*/
14+
@Component
15+
public class FrameSaTokenListener implements SaTokenListener {
16+
17+
@Override
18+
public void doLogin(String loginType, Object loginId, String tokenValue, SaLoginModel loginModel) {
19+
20+
TFrame.tframe.callEvent(new SaPostLoginEvent(loginType, loginId, tokenValue, loginModel));
21+
22+
}
23+
24+
/** 每次注销时触发 */
25+
@Override
26+
public void doLogout(String loginType, Object loginId, String tokenValue) {
27+
28+
TFrame.tframe.callEvent(new SaPostLogoutEvent(loginType, loginId, tokenValue));
29+
30+
}
31+
32+
/** 每次被踢下线时触发 */
33+
@Override
34+
public void doKickout(String loginType, Object loginId, String tokenValue) {
35+
36+
TFrame.tframe.callEvent(new SaPostLogoutEvent(loginType, loginId, tokenValue));
37+
38+
}
39+
40+
/** 每次被顶下线时触发 */
41+
@Override
42+
public void doReplaced(String loginType, Object loginId, String tokenValue) {
43+
44+
TFrame.tframe.callEvent(new SaPostLogoutEvent(loginType, loginId, tokenValue));
45+
46+
}
47+
48+
/** 每次被封禁时触发 */
49+
@Override
50+
public void doDisable(String loginType, Object loginId, long disableTime) {
51+
52+
TFrame.tframe.callEvent(new SaUserDisabledEvent(loginType, loginId, disableTime));
53+
54+
}
55+
56+
/** 每次被解封时触发 */
57+
@Override
58+
public void doUntieDisable(String loginType, Object loginId) {
59+
60+
TFrame.tframe.callEvent(new SaUserEnabledEvent(loginType, loginId));
61+
62+
}
63+
64+
/** 每次创建Session时触发 */
65+
@Override
66+
public void doCreateSession(String id) {
67+
68+
TFrame.tframe.callEvent(new SaSessionCreateEvent(id));
69+
70+
}
71+
72+
/** 每次注销Session时触发 */
73+
@Override
74+
public void doLogoutSession(String id) {
75+
76+
TFrame.tframe.callEvent(new SaSessionLogoutEvent(id));
77+
78+
}
79+
80+
}

src/main/java/com/talexframe/frame/core/function/listener/FrameSelfListener.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.talexframe.frame.core.function.listener;
22

33
import com.talexframe.frame.core.modules.event.FrameListener;
4-
import com.talexframe.frame.core.modules.event.TalexSubscribe;
5-
import com.talexframe.frame.core.modules.event.events.dao.DAOProcessorConnectedEvent;
4+
import com.talexframe.frame.core.modules.event.THandler;
65
import com.talexframe.frame.core.modules.event.events.dao.DAOProcessorPreShutdownEvent;
7-
import com.talexframe.frame.core.modules.repository.TRepoPlus;
86
import com.talexframe.frame.core.modules.repository.TRepo;
7+
import com.talexframe.frame.core.modules.repository.TRepoPlus;
98
import com.talexframe.frame.core.pojo.dao.factory.mysql.Mysql;
109
import com.talexframe.frame.core.talex.TFrame;
1110

@@ -25,22 +24,22 @@ public FrameSelfListener() {
2524

2625
}
2726

28-
@TalexSubscribe
29-
public void onMysqlConnected(DAOProcessorConnectedEvent<Mysql> event) {
30-
31-
for ( TRepo repository : tframe.getRepoManager().getRepositories().values() ) {
32-
33-
if ( repository instanceof TRepoPlus ) {
34-
35-
( (TRepoPlus<?>) repository ).onInstall();
36-
37-
}
38-
39-
}
40-
41-
}
42-
43-
@TalexSubscribe
27+
// @THandler
28+
// public void onMysqlConnected(DAOProcessorConnectedEvent<Mysql> event) {
29+
//
30+
// for ( TRepo repository : tframe.getRepoManager().getRepositories().values() ) {
31+
//
32+
// if ( repository instanceof TRepoPlus ) {
33+
//
34+
// ( (TRepoPlus<?>) repository ).onInstall();
35+
//
36+
// }
37+
//
38+
// }
39+
//
40+
// }
41+
42+
@THandler
4443
public void onMysqlPreShutdown(DAOProcessorPreShutdownEvent<Mysql> event) {
4544

4645
for ( TRepo repository : tframe.getRepoManager().getRepositories().values() ) {

0 commit comments

Comments
 (0)