1 public JsonResult AddDisk() 2 { 3 var data = 0; 4 string uid = Request.Cookies["UserID"].Value; 5 Login_Users userModel = userBll.getModel(Convert.ToInt32(uid)); 6 if (string.IsNullOrEmpty(userModel.file_url)) 7 { 8 string DirectoryName = DateTime.Now.ToString("yyyyMMddHHmmssfff"); 9 string sPath = Server.MapPath("~/Uploads/") + DirectoryName; 10 if (!Directory.Exists(sPath)) 11 { 12 Directory.CreateDirectory(sPath); 13 userModel.file_url = DirectoryName; 14 if (userBll.UpdateUserInfo(userModel) > 0) 15 { 16 data = 1; 17 } 18 else 19 { 20 data = 2; 21 } 22 } 23 } 24 else 25 { 26 data = 0;//已创建好网盘 27 } 28 return Json(data); 29 }