在线用户强退方法合并

dep_wangsr
RuoYi 5 years ago committed by Limy
parent 5ad3292260
commit a9f04c57e9

@ -1,7 +1,6 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -9,12 +8,12 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OnlineStatus;
import com.ruoyi.framework.shiro.session.OnlineSession;
@ -57,21 +56,13 @@ public class SysUserOnlineController extends BaseController
return getDataTable(list);
}
/**
* 1 forceLogout
* 2 batchForceLogout forceLogout OR
* 3@RequestParam("ids[]") ==> @RequestParam("ids")
* 4
* @param ids
* @return
*/
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@PostMapping("/batchForceLogout")
@ResponseBody
public AjaxResult batchForceLogout(@RequestParam("ids") String[] ids)
public AjaxResult batchForceLogout(String ids)
{
for (String sessionId : ids)
for (String sessionId : Convert.toStrArray(ids))
{
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
if (online == null)

@ -114,9 +114,7 @@
title: '操作',
align: 'center',
formatter: function(value, row, index) {
// 传值改成 array 类型
var ids = [row.sessionId]
var msg = '<a class="btn btn-danger btn-xs ' + forceFlag + '" href="javascript:void(0)" onclick="forceLogout(\'' + ids + '\')"><i class="fa fa-sign-out"></i>强退</a> ';
var msg = '<a class="btn btn-danger btn-xs ' + forceFlag + '" href="javascript:void(0)" onclick="forceLogout(\'' + row.sessionId + '\')"><i class="fa fa-sign-out"></i>强退</a> ';
return msg;
}
}]
@ -125,7 +123,6 @@
});
// 单条强退
// 将该请求并到 batchForceLogout 中
function forceLogout(sessionId) {
$.modal.confirm("确定要强制选中用户下线吗?", function() {
var data = { "ids": sessionId };
@ -142,7 +139,7 @@
}
$.modal.confirm("确认要强退选中的" + rows.length + "条数据吗?", function() {
var url = prefix + "/batchForceLogout";
var data = { "ids": rows };
var data = { "ids": rows.join() };
$.operate.post(url, data);
});
}

Loading…
Cancel
Save