批量重置密码

 前端
    $("#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);
    }
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值