mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-04 00:16:39 +00:00
上传后台管理系统代码
This commit is contained in:
@ -0,0 +1,57 @@
|
||||
package com.java2nb.system.controller;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.java2nb.common.utils.R;
|
||||
import com.java2nb.system.domain.UserOnline;
|
||||
import com.java2nb.system.service.SessionService;
|
||||
|
||||
@RequestMapping("/sys/online")
|
||||
@Controller
|
||||
public class SessionController {
|
||||
@Autowired
|
||||
SessionService sessionService;
|
||||
|
||||
@GetMapping()
|
||||
public String online() {
|
||||
return "system/online/online";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/list")
|
||||
public List<UserOnline> list() {
|
||||
return sessionService.list();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/forceLogout/{sessionId}")
|
||||
public R forceLogout(@PathVariable("sessionId") String sessionId, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
sessionService.forceLogout(sessionId);
|
||||
return R.ok();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return R.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/sessionList")
|
||||
public Collection<Session> sessionList() {
|
||||
return sessionService.sessionList();
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user