public ActionResult Edit() { var name = Request.Form["name"]; var id1 = Request.Form["gid"]; var id2 = Request.Form["id"]; var about = Request.Form["about"]; if (name == null || name.Length < 1 || name.Length > 50) { return(View(new DWZJson() { statusCode = (int)DWZStatusCode.ERROR, message = "长度必须大于1个字符小于50字符" })); } var gid = 0; if (!int.TryParse(id1, out gid) || gid == 0) { return(View(new DWZJson() { statusCode = (int)DWZStatusCode.ERROR, message = "公众号不存在" })); } var id = 0; if (!int.TryParse(id2, out id) || id == 0) { return(View(new DWZJson() { statusCode = (int)DWZStatusCode.ERROR, message = "漫画不存在" })); } if (about == null || about.Length > 2000) { return(View(new DWZJson() { statusCode = (int)DWZStatusCode.ERROR, message = "漫画简介必须小于2000字符" })); } var logo = ""; if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0 && new string[] { ".gif", ".jpeg", ".jpg", ".png" }.Contains(System.IO.Path.GetExtension(Request.Files[0].FileName.ToLower()))) { var key = QN.MHLogo(gid, id); var token = QN.GetUploadToken(QN.BUCKET, key); FormUploader fu = new FormUploader(); HttpResult result = fu.UploadStream(Request.Files[0].InputStream, key, token); if (result.Code == 200) { logo = key; } } Tab_MHCatalog m = new Tab_MHCatalog(); m.F_Catalog = name; m.F_GZHId = gid; m.F_Logo = logo != "" ? logo : null; m.F_Id = id; m.F_About = about; int i = _ms.UpdateMH(m); if (i == 1) { return(View(new DWZJson { statusCode = (int)DWZStatusCode.OK, message = "成功" })); } else { return(View(new DWZJson { statusCode = (int)DWZStatusCode.ERROR, message = "失败" })); } }