public JsonResult AddUserPoint(int id = 0, int points = 0, int taskType = 0, string pointDesc = "") { if (taskType > 0)//关联任务的 { UserTaskLogBll userTaskBll = new UserTaskLogBll(); int point = userTaskBll.UserTaskLogAdd(id, taskType, pointDesc); if (point > 0) { return(Json(new { code = 1, msg = "操作成功增加" + point + "分" })); } else { return(Json(new { code = -100, msg = "未知错误" })); } } else { if (points == 0) { return(Json(new { code = -1, msg = "改动积分不能为0" })); } if (string.IsNullOrEmpty(pointDesc)) { return(Json(new { code = -1, msg = "请添加积分备注" })); } int row = user.AddUserPoint(id, points, pointDesc); if (row > 0) { return(Json(new { code = 1, msg = "操作成功" })); } return(Json(new { code = -100, msg = "未知错误" })); } }