11 changed files with 2834 additions and 12 deletions
@ -0,0 +1,214 @@ |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<title>添加--菜单管理</title> |
|||
<meta name="renderer" content="webkit" /> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> |
|||
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
|||
<meta name="apple-mobile-web-app-capable" content="yes" /> |
|||
<meta name="format-detection" content="telephone=no" /> |
|||
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" /> |
|||
<link rel="stylesheet" href="../../css/public.css" media="all" /> |
|||
<link rel="stylesheet" href="../../iconfont/iconfont.css" media="all" /> |
|||
<script type="text/javascript" src="../../js/jquery-2.1.3.min.js"></script> |
|||
<script type="text/javascript" src="../../js/jq_extend.js"></script> |
|||
<script type="text/javascript" src="../../js/fiseckey.js"></script> |
|||
</head> |
|||
<body class="childrenBody" style="height:90%"> |
|||
<form class="layui-form" style="width: 90%; margin-top:15px"> |
|||
<input id="Action" class="layui-input" type="hidden" /> |
|||
<input id="id" class="layui-input" type="hidden" /> |
|||
<input id="empId" class="layui-input " type="hidden" /> |
|||
<input id="usersUid" class="layui-input" type="hidden" /> |
|||
<input id="orgId" class="layui-input" type="hidden" /> |
|||
|
|||
<div class="layui-form-item layui-row layui-col-xs12"> |
|||
<label class="layui-form-label label-required-next"> |
|||
人员姓名: |
|||
</label> |
|||
<div class="layui-input-inline"> |
|||
<input class="layui-input" id="empName" disabled="disabled" /> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item layui-row layui-col-xs12" id="isShow" style="display: none"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label label-required-next"> |
|||
现在绑定的ukey: |
|||
</label> |
|||
<div class="layui-input-inline"> |
|||
<input class="layui-input" id="ukey" disabled="disabled" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item layui-row layui-col-xs12"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label label-required-next"> |
|||
ukey: |
|||
</label> |
|||
<div class="layui-input-inline"> |
|||
<select id="ukey_list" lay-filter="ukey_list" lay-search=""> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item layui-row layui-col-xs12"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label label-required-next"> |
|||
密码输入5次失败后 |
|||
</label> |
|||
<div class="layui-input-inline" style="width: 80px"> |
|||
<input class="layui-input" id="lockTime" type="number" placeholder="请填写" value="1" /> |
|||
</div> |
|||
<div class="layui-form-mid layui-word-aux" style="color: #fff !important">分钟以后可以再次登录</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-center"> |
|||
<a class="layui-btn layui-btn-normal addNews_btn" lay-filter="AddEdit" lay-submit=lay-submit>提交</a> |
|||
</div> |
|||
</form> |
|||
<script type="text/javascript" src="../../layui/layui.js"></script> |
|||
<link rel="stylesheet" href="../../css/bulletframe.css" media="all" /> |
|||
|
|||
<script type="text/javascript"> |
|||
layui.config({ |
|||
base: './' |
|||
}).use(['form', 'layer'], function () { |
|||
|
|||
var form = layui.form, |
|||
layer = parent.layer === undefined ? layui.layer : top.layer; |
|||
|
|||
var ukeyList = [], ukeyListStr = "", isAction = "Add"; |
|||
try { |
|||
var keytype = ""; |
|||
try { |
|||
keytype = devManage.deviceType.value; |
|||
} catch (e1) { |
|||
keytype = "F-OLD"; |
|||
} |
|||
var result = SKFKEY.SKF_EnumDev(1, keytype); |
|||
var a = result.slice(6, result.length - 2); |
|||
ukeyList = a.split("|"); |
|||
ukeyListStr = ""; |
|||
ukeyList.forEach(function (obj, index, arr) { |
|||
ukeyListStr += "<option value='" + obj + "'>" + obj + "</option>"; |
|||
}); |
|||
console.log(ukeyListStr); |
|||
$("#ukey_list").append(ukeyListStr); |
|||
form.render('select'); |
|||
} catch (e) { |
|||
console.log(e.message); |
|||
} |
|||
|
|||
$.post("../../ashx/SysUsersUkeyHandler.ashx", { |
|||
Action: "getUserUkey", |
|||
usersUid: $.getUrlVar("userUid"), |
|||
random: new Date().getTime()//随机参数 |
|||
}, function (res) { |
|||
if (res.code == '0') { |
|||
if (res.data.length > 0) { |
|||
var info = res.data[0]; |
|||
isAction = "Edit"; |
|||
$("#id").val(info.ID); |
|||
$("#ukey").val(info.UKEY); |
|||
$("#lockTime").val(info.LOCK_TIME); |
|||
$("#isShow").show(); |
|||
} |
|||
} else { |
|||
layer.msg(res.msg, { icon: 7, time: 3000 }); |
|||
} |
|||
}) |
|||
|
|||
function submitFun() { |
|||
//load提交 |
|||
var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 }); |
|||
$.post("../../ashx/SysUsersUkeyHandler.ashx", { |
|||
Action: isAction, |
|||
id: $("#id").val(), |
|||
empId: $("#empId").val(), |
|||
usersUid: $("#usersUid").val(), |
|||
empName: $("#empName").val(), |
|||
ukey: $("#ukey_list option:selected").text(), |
|||
lockTime: $("#lockTime").val(), |
|||
orgId: $("#orgId").val(), |
|||
random: new Date().getTime() //随机参数(员工表ID ","分割) |
|||
}, function (res) { |
|||
layer.close(index); |
|||
if (res.code == 1) { |
|||
top.layer.msg(res.msg, { icon: 1, time: 3000 }); |
|||
parent.location.reload(); |
|||
} else if (res.code == '-2') { |
|||
var index3 = layer.confirm(res.msg, { |
|||
btn: ['是', '否'], |
|||
icon: 3 |
|||
}, function () { |
|||
//load提交 |
|||
var index2 = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 }); |
|||
$.post("../../ashx/SysUsersUkeyHandler.ashx", { |
|||
Action: "ForceEdit", |
|||
id: res.id, |
|||
empId: $("#empId").val(), |
|||
usersUid: $("#usersUid").val(), |
|||
empName: $("#empName").val(), |
|||
ukey: $("#ukey_list option:selected").text(), |
|||
lockTime: $("#lockTime").val(), |
|||
orgId: $("#orgId").val(), |
|||
random: new Date().getTime() //随机参数(员工表ID ","分割) |
|||
}, function (res) { |
|||
layer.close(index2); |
|||
layer.close(index3); |
|||
if (res.code == 1) { |
|||
top.layer.msg(res.msg, { icon: 1, time: 3000 }); |
|||
parent.location.reload(); |
|||
} else { |
|||
layer.msg(res.msg, { icon: 7, time: 3000 }); |
|||
} |
|||
}); |
|||
}, function () { |
|||
layer.close(index3); |
|||
return false; |
|||
}); |
|||
} else { |
|||
layer.close(index); |
|||
layer.msg(res.msg, { icon: 7, time: 3000 }); |
|||
} |
|||
}); |
|||
layer.close(index); |
|||
return false; |
|||
} |
|||
|
|||
form.on("submit(AddEdit)", function (data) { |
|||
if ($("#ukey_list option:selected").text() == "") { |
|||
layer.open({ |
|||
content: 'ukey不能为空!', |
|||
icon: 7 |
|||
}) |
|||
return false; |
|||
} |
|||
if ($("#lockTime").val() == "") { |
|||
layer.open({ |
|||
content: '密码输入5次失败后,账号锁定时长不能为空!', |
|||
icon: 7 |
|||
}) |
|||
return false; |
|||
} |
|||
if ($("#ukey").val() != "") { |
|||
var index = layer.confirm('是否要替换掉原有的ukey:' + $("#ukey").val(), { |
|||
icon: 3, |
|||
btn: ['是', '否'] |
|||
}, function () { |
|||
submitFun(); |
|||
}, function () { |
|||
layer.close(index); |
|||
return false; |
|||
}); |
|||
} else { |
|||
submitFun(); |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,138 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>设备管理--科宁智慧安全社区后台管理</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<meta name="apple-mobile-web-app-status-bar-style" content="black"> |
|||
<meta name="apple-mobile-web-app-capable" content="yes"> |
|||
<meta name="format-detection" content="telephone=no"> |
|||
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" /> |
|||
<link rel="stylesheet" href="../../css/public.css" media="all" /> |
|||
<link rel="stylesheet" href="../../css/ztree/metro/ztree.css"> |
|||
<script src="../../js/jquery-2.1.3.min.js" type="text/javascript"></script> |
|||
<script src="../../js/jquery.cookie.js" type="text/javascript"></script> |
|||
</head> |
|||
<body style="border: 1px solid #0c6f89; |
|||
background: rgba(12, 70, 100, 0.8); |
|||
padding: 20px; |
|||
box-sizing: border-box; |
|||
"> |
|||
<form class="layui-form"> |
|||
<blockquote class="layui-elem-quote quoteBox" style="padding-left:0; padding-top:0;"> |
|||
<form class="layui-form"> |
|||
<div class="layui-inline"> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" class="layui-input ukey" placeholder="请输入UKey序列号" /> |
|||
</div> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" class="layui-input empName" placeholder="请输入姓名" /> |
|||
</div> |
|||
<a class="layui-btn search_btn" data-type="reload">搜索</a> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<a class="layui-btn layui-btn-danger layui-btn-normal delAll_btn">批量删除</a> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<span style="color: red">* </span><span style="color: #ccc">如需ukey绑定,请前往【人员管理】页面进行ukey绑定操作</span> |
|||
</div> |
|||
</form> |
|||
</blockquote> |
|||
<table id="uKeyList" lay-filter="uKeyList"></table> |
|||
</form> |
|||
<script type="text/javascript" src="../../layui/layui.js"></script> |
|||
<script type="text/javascript"> |
|||
layui.config({ |
|||
base: '../../js/' |
|||
}).use(['ztree', 'form', 'layer', 'table', 'laytpl'], function () { |
|||
var layer = parent.layer === undefined ? layui.layer : top.layer, |
|||
$ = layui.jquery, |
|||
table = layui.table; |
|||
|
|||
|
|||
//系统列表 |
|||
table.render({ |
|||
elem: '#uKeyList', |
|||
url: '../../ashx/SysUsersUkeyHandler.ashx', |
|||
where: { Action: 'List', random: new Date().getTime() }, |
|||
cellMinWidth: 95, |
|||
page: true, |
|||
height: "full-125", |
|||
limits: [10, 15, 20, 25], |
|||
limit: 20, |
|||
id: "uKeyListTable", |
|||
cols: [[ |
|||
{ type: "checkbox", fixed: "left", width: 50 }, |
|||
{ field: 'ORG_NAME', title: '所属单位', minWidth: 60, align: "center" }, |
|||
{ field: 'EMP_NAME', title: '人员姓名', minWidth: 60, align: "center" }, |
|||
{ field: 'UKEY', title: 'ukey', minWidth: 60, align: "center" }, |
|||
{ |
|||
field: 'LOCK_TIME', title: '登录失败锁定时长(分钟)', minWidth: 60, align: "center", templet: function (v) { |
|||
return v.LOCK_TIME + "(分钟)"; |
|||
} |
|||
} |
|||
]] |
|||
}); |
|||
|
|||
//搜索 |
|||
$(".search_btn").on("click", function () { |
|||
table.reload("uKeyListTable", { |
|||
page: { |
|||
curr: 1 //重新从第 1 页开始 |
|||
}, |
|||
where: { |
|||
Action: 'List', |
|||
ukey: $(".ukey").val(), //搜索的ukey序列号 |
|||
empName: $(".empName").val(), //搜索的ukey序列号 |
|||
random: new Date().getTime() //随机参数 |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
//批量删除 |
|||
$(".delAll_btn").click(function () { |
|||
var checkStatus = table.checkStatus('uKeyListTable'), |
|||
data = checkStatus.data, |
|||
UKeyList = []; |
|||
if (data.length > 0) { |
|||
for (var i in data) { |
|||
UKeyList.push(data[i].ID); |
|||
} |
|||
layer.confirm('确定删除选中的ukey绑定记录?', { icon: 3, title: '提示信息' }, function (index) { |
|||
//提交信息 |
|||
$.post("../../ashx/SysUsersUkeyHandler.ashx", { |
|||
Action: "Del", |
|||
UIDList: UKeyList.join(","), |
|||
random: new Date().getTime() //随机参数 |
|||
}, function (res) { |
|||
if (res.code == 1) { |
|||
top.layer.msg(res.msg, { icon: 1, time: 3000 }); |
|||
table.reload("uKeyListTable", { |
|||
page: { |
|||
curr: 1 //重新从第 1 页开始 |
|||
}, |
|||
where: { |
|||
Action: 'List', |
|||
ukey: $(".ukey").val(), //搜索的ukey序列号 |
|||
empName: $(".empName").val(), //搜索的ukey序列号 |
|||
random: new Date().getTime() //随机参数 |
|||
} |
|||
}); |
|||
} else { |
|||
top.layer.msg(res.msg, { icon: 7, time: 3000 }); |
|||
} |
|||
}); |
|||
}); |
|||
} else { |
|||
layer.msg("请选择需要删除的ukey绑定记录", { icon: 7, time: 3000 }); |
|||
} |
|||
}) |
|||
}) |
|||
</script> |
|||
<link rel="stylesheet" href="../../css/right-list.css" media="all" /> |
|||
<link rel="stylesheet" href="../../css/bulletframebg.css" media="all" /> |
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1 @@ |
|||
<%@ WebHandler Language="C#" CodeBehind="SysUsersUkeyHandler.ashx.cs" Class="FangYar.WebUI.ashx.SysUsersUkeyHandler" %> |
@ -0,0 +1,356 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
using System.Data; |
|||
|
|||
namespace FangYar.WebUI.ashx |
|||
{ |
|||
/// <summary>
|
|||
/// SysUsersRulesHandler 的摘要说明
|
|||
/// </summary>
|
|||
public class SysUsersUkeyHandler : IHttpHandler |
|||
{ |
|||
private FangYar.BLL.TBL.SysUSerRulesBLL bll = new BLL.TBL.SysUSerRulesBLL(); |
|||
public void ProcessRequest(HttpContext context) |
|||
{ |
|||
|
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "用户Ukey绑定操作请求", ""); |
|||
|
|||
context.Response.ContentType = "text/json"; |
|||
string action = context.Request.Params["Action"]; |
|||
string returnstr = ""; |
|||
switch (action) |
|||
{ |
|||
case "List": |
|||
returnstr = GetModelList(context); |
|||
break; |
|||
case "Add": |
|||
returnstr = AddModel(context); |
|||
break; |
|||
case "Edit": |
|||
returnstr = EditModel(context); |
|||
break; |
|||
case "ForceEdit": |
|||
returnstr = ForceEditModel(context); |
|||
break; |
|||
case "Del": |
|||
returnstr = DelModel(context); |
|||
break; |
|||
case "getUserUkey": |
|||
returnstr = getUserUkey(context); |
|||
break; |
|||
} |
|||
context.Response.Write(returnstr); |
|||
|
|||
} |
|||
//查询
|
|||
private string GetModelList(HttpContext context) |
|||
{ |
|||
string returnstr = ""; |
|||
try |
|||
{ |
|||
string ukey = context.Request.Params["ukey"]; |
|||
string empName = context.Request.Params["empName"]; |
|||
string limit = context.Request.Params["limit"]; |
|||
string page = context.Request.Params["page"]; |
|||
int pageIndex = 1; |
|||
int pageSize = 10; |
|||
if (!string.IsNullOrEmpty(limit)) { pageIndex = int.Parse(page); } |
|||
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } |
|||
string where = null; |
|||
if (!string.IsNullOrEmpty(ukey)) |
|||
{ |
|||
where = "u.ukey like '%" + ukey + "%'"; |
|||
} |
|||
if (!string.IsNullOrEmpty(empName)) |
|||
{ |
|||
if (where != null) |
|||
{ |
|||
where += " and "; |
|||
} |
|||
where += "u.emp_name like '%" + empName + "%' "; |
|||
} |
|||
returnstr = "{\"code\":0,\"data\":"; |
|||
|
|||
int startnum = (pageIndex - 1) * pageSize; |
|||
string sql = "select u.*,(select org_name from fire_org o where o.org_id = u.org_id) as org_name from tbl_sys_emp_ukey u "; |
|||
if (where != null && where != "") |
|||
{ |
|||
sql += " where " + where; |
|||
} |
|||
sql += " order by u.updatetime desc"; |
|||
startnum = startnum < 0 ? 0 : startnum; |
|||
sql += " limit " + startnum + ", " + pageSize; |
|||
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql); |
|||
if (dt.Rows.Count > 0) |
|||
{ |
|||
returnstr += FangYar.Common.JsonHelper.ToJson(dt); |
|||
} |
|||
else |
|||
{ |
|||
returnstr += "[]"; |
|||
} |
|||
returnstr += "}"; |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}"; |
|||
} |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用户ukey操作请求", "查询"); |
|||
return returnstr; |
|||
|
|||
} |
|||
// 添加
|
|||
private string AddModel(HttpContext context) |
|||
{ |
|||
string returnstr = ""; |
|||
int code = -1; |
|||
string msg = ""; |
|||
try |
|||
{ |
|||
string id = Guid.NewGuid().ToString("N"); |
|||
string empId = context.Request.Params["empId"]; |
|||
string usersUid = context.Request.Params["usersUid"]; |
|||
string empName = context.Request.Params["empName"]; |
|||
string ukey = context.Request.Params["ukey"]; |
|||
string lockTime = context.Request.Params["lockTime"]; |
|||
string orgId = context.Request.Params["orgId"]; |
|||
|
|||
if (string.IsNullOrEmpty(usersUid)) |
|||
{ |
|||
return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}"; |
|||
} |
|||
if (string.IsNullOrEmpty(empId)) |
|||
{ |
|||
return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}"; |
|||
} |
|||
|
|||
string isOnlyUkeySql = "select id,emp_name from tbl_sys_emp_ukey where ukey = '" + ukey + "'"; |
|||
DataTable isOnlyUkeyDt = FangYar.Common.MySqlHelper.QueryTable(isOnlyUkeySql); |
|||
if (isOnlyUkeyDt != null && isOnlyUkeyDt.Rows.Count > 0) |
|||
{ |
|||
string emp_name = isOnlyUkeyDt.Rows[0]["emp_name"].ToString(); |
|||
if (!string.IsNullOrEmpty(emp_name)) |
|||
{ |
|||
string editId = isOnlyUkeyDt.Rows[0]["id"].ToString(); |
|||
return "{\"code\":-2,\"id\":\""+ editId + "\",\"msg\":\"当前ukey:" + ukey + ",已经绑定给了【" + emp_name + "】,是否替换\"}"; |
|||
} |
|||
} |
|||
|
|||
string sql = "insert into tbl_sys_emp_ukey(id,emp_id,users_uid,emp_name,ukey,lock_time,org_id) values ('" + id + "','" + empId + "','" + usersUid + "','" + empName + "','" + ukey + "','" + lockTime + "','" + orgId + "')"; |
|||
if (FangYar.Common.MySqlHelper.Execute(sql) > 0) |
|||
{ |
|||
msg = "添加成功!"; |
|||
code = 1; |
|||
} |
|||
else |
|||
{ |
|||
msg = "添加失败!"; |
|||
} |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
msg = "添加失败!"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "添加异常:" + e); |
|||
} |
|||
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "用户ukey操作请求", "添加"); |
|||
return returnstr; |
|||
|
|||
} |
|||
//修改
|
|||
private string EditModel(HttpContext context) |
|||
{ |
|||
string returnstr = ""; |
|||
int code = -1; |
|||
string msg = ""; |
|||
try |
|||
{ |
|||
string id = context.Request.Params["id"]; |
|||
string empId = context.Request.Params["empId"]; |
|||
string usersUid = context.Request.Params["usersUid"]; |
|||
string empName = context.Request.Params["empName"]; |
|||
string ukey = context.Request.Params["ukey"]; |
|||
string lockTime = context.Request.Params["lockTime"]; |
|||
string orgId = context.Request.Params["orgId"]; |
|||
|
|||
if (string.IsNullOrEmpty(usersUid)) |
|||
{ |
|||
return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}"; |
|||
} |
|||
if (string.IsNullOrEmpty(empId)) |
|||
{ |
|||
return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}"; |
|||
} |
|||
|
|||
string isOnlyUkeySql = "select id,emp_name from tbl_sys_emp_ukey where ukey = '" + ukey + "'"; |
|||
DataTable isOnlyUkeyDt = FangYar.Common.MySqlHelper.QueryTable(isOnlyUkeySql); |
|||
if (isOnlyUkeyDt != null && isOnlyUkeyDt.Rows.Count > 0) |
|||
{ |
|||
string emp_name = isOnlyUkeyDt.Rows[0]["emp_name"].ToString(); |
|||
if (!string.IsNullOrEmpty(emp_name)) |
|||
{ |
|||
string editId = isOnlyUkeyDt.Rows[0]["id"].ToString(); |
|||
return "{\"code\":-2,\"id\":\"" + editId + "\",\"msg\":\"当前ukey:" + ukey + ",已经绑定给了【"+ emp_name + "】,是否替换\"}"; |
|||
} |
|||
} |
|||
|
|||
string sql = "update tbl_sys_emp_ukey set emp_id = '" + empId+ "',users_uid = '" + usersUid + "',emp_name = '" + empName + "',ukey = '" + ukey + "',lock_time = '" + lockTime + "',org_id = '" + orgId + "' where id = '" + id + "'"; |
|||
if (FangYar.Common.MySqlHelper.Execute(sql) > 0) |
|||
{ |
|||
msg = "修改成功!"; |
|||
code = 1; |
|||
} |
|||
else |
|||
{ |
|||
msg = "修改失败!"; |
|||
} |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
msg = "修改失败!"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "修改异常:" + e); |
|||
} |
|||
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用户ukey操作请求", "修改"); |
|||
return returnstr; |
|||
} |
|||
//强制修改
|
|||
private string ForceEditModel(HttpContext context) |
|||
{ |
|||
string returnstr = ""; |
|||
int code = -1; |
|||
string msg = ""; |
|||
try |
|||
{ |
|||
string id = context.Request.Params["id"]; |
|||
string empId = context.Request.Params["empId"]; |
|||
string usersUid = context.Request.Params["usersUid"]; |
|||
string empName = context.Request.Params["empName"]; |
|||
string ukey = context.Request.Params["ukey"]; |
|||
string lockTime = context.Request.Params["lockTime"]; |
|||
string orgId = context.Request.Params["orgId"]; |
|||
|
|||
if (string.IsNullOrEmpty(usersUid)) |
|||
{ |
|||
return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}"; |
|||
} |
|||
if (string.IsNullOrEmpty(empId)) |
|||
{ |
|||
return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}"; |
|||
} |
|||
|
|||
string sql = "update tbl_sys_emp_ukey set emp_id = '" + empId + "',users_uid = '" + usersUid + "',emp_name = '" + empName + "',ukey = '" + ukey + "',lock_time = '" + lockTime + "',org_id = '" + orgId + "' where id = '" + id + "'"; |
|||
if (FangYar.Common.MySqlHelper.Execute(sql) > 0) |
|||
{ |
|||
msg = "修改成功!"; |
|||
code = 1; |
|||
} |
|||
else |
|||
{ |
|||
msg = "修改失败!"; |
|||
} |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
msg = "修改失败!"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "修改异常:" + e); |
|||
} |
|||
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用户ukey操作请求", "修改"); |
|||
return returnstr; |
|||
} |
|||
|
|||
//删除
|
|||
private string DelModel(HttpContext context) |
|||
{ |
|||
string returnstr = ""; |
|||
int code = -1; |
|||
string msg = ""; |
|||
try |
|||
{ |
|||
string UIDList = context.Request.Params["UIDList"]; |
|||
UIDList = UIDList.Replace(",", "','"); |
|||
|
|||
string sql = "delete from tbl_sys_emp_ukey where ID in('" + UIDList + "')"; |
|||
try |
|||
{ |
|||
if (FangYar.Common.MySqlHelper.ExecuteSql(sql) > 0) |
|||
{ |
|||
msg = "删除成功!"; |
|||
code = 1; |
|||
} |
|||
else |
|||
{ |
|||
msg = "删除失败!"; |
|||
} |
|||
} |
|||
catch |
|||
{ |
|||
msg = "删除失败!"; |
|||
} |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
msg = "删除失败!"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "删除异常:" + e); |
|||
} |
|||
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "用户ukey操作请求", "删除"); |
|||
return returnstr; |
|||
} |
|||
//获取用户ukey(根据用户登录账号)
|
|||
private string getUserUkey(HttpContext context) |
|||
{ |
|||
|
|||
string usersUid = context.Request.Params["usersUid"]; |
|||
|
|||
string returnstr = ""; |
|||
try |
|||
{ |
|||
returnstr = "{\"code\":0,\"data\":"; |
|||
|
|||
string sql = @"SELECT * FROM tbl_sys_emp_ukey WHERE users_uid = '" + usersUid + @"'"; |
|||
|
|||
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql); |
|||
if (dt.Rows.Count > 0) |
|||
{ |
|||
returnstr += FangYar.Common.JsonHelper.ToJson(dt); |
|||
} |
|||
else |
|||
{ |
|||
returnstr += "[]"; |
|||
} |
|||
returnstr += "}"; |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
returnstr = "{\"code\":-1,\"msg\":\"操作失败!\",\"data\":[]}"; |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "获取当前用户ukey异常:" + e); |
|||
} |
|||
// 记录操作日志
|
|||
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用户ukey操作请求", "获取当前用户ukey"); |
|||
return returnstr; |
|||
|
|||
} |
|||
public bool IsReusable |
|||
{ |
|||
get |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
} |
After Width: | Height: | Size: 1.5 KiB |
File diff suppressed because it is too large
Loading…
Reference in new issue