前端
$("#resetPwd").click(function () {
var selRows = $("#dataGrid").datagrid("getSelections");
var userId = new Array();
for (var i = 0; i < selRows.length; i++) {
userId.push(selRows[i].userId);
}
var password = $("#pwd").val();
if (password == null || password == "") {
ma.alert("系统消息", "密码不能为空!!", "error");
return;
}
$.messager.progress({ title: '提示', msg: '系统正在处理……' });
$.post("/CustomerManager/resetPwd", {
userId: JSON.stringify(userId),
password: password
}, function (data) {
$.messager.progress('close');
if (data.resCode == 0) {
ma.alert('温馨提示', '重置密码成功', 'info');
$('#cxx_resetPwd').dialog('close');
}
else {
ma.alert('温馨提示', data.resMsg, 'error');
}
}, "json")
})
后台
[Menu(text = "重置密码")]
public JsonResult resetPwd()
{
string userId = getPara("userId");
string password = getPara("password") == null || getPara("password") == "" ? "123456" : getPara("password");
//string brandId = getPara("brandId");
JavaScriptSerializer jss = new JavaScriptSerializer();
List<int> userIdList = jss.Deserialize<List<int>>(userId);
//List<int> brandIdList = jss.Deserialize<List<int>>(brandId);
for (int i = 0; i < userIdList.Count; i++)
{
//Hashtable param = new Hashtable();
//param.Add("brandId", brandIdList[i]);
//param.Add("userId", userIdList[i]);
//param.Add("password", password);
// PublicResult model = APIHelper.safesetPassword(param);
PublicResult model = APIHelper.UpdateUserName(int.Parse(userIdList[i].ToString()), "", password);
retJson.resMsg = model.msg;
retJson.resCode = model.ret;
retJson.model = model.data;
//如果接口发生错误,则不继续进行修改
if (model.ret != 0) break;
}
return Json(retJson, "text/html", JsonRequestBehavior.AllowGet);
}
批量重置密码
最新推荐文章于 2022-12-04 11:34:25 发布