public ActionResult SiteCMSBlockEdit() { string b_name = Request["b_name"] ?? string.Empty; string b_path = Request["b_path"] ?? string.Empty; string p_gid = Request["p_gid"] ?? string.Empty; string b_gid = Request["b_gid"] ?? string.Empty; string b_img_size = Request["b_img_size"] ?? string.Empty; int siteName = Request["siteName"].ToInt32(0); Site_CMSBlock info = null; if (string.IsNullOrEmpty(b_gid)) { info = new Site_CMSBlock(); //新增 info.b_gid = Entity.GenerateGUID(); info.b_createTime = DateTime.Now; info.b_createUser = SiteHelp.CurrentUserName; info.b_p_gid = p_gid; } else { info = SiteServiceClass.Site_CMSBlock_SelectByb_gid(b_gid); } info.b_name = b_name; info.b_path = b_path; info.b_img_size = b_img_size; if (string.IsNullOrEmpty(b_gid)) { int result = SiteServiceClass.Site_CMSBlock_Insert(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "新增成功" } })); } else { return(Json(new { success = false, errors = new { text = "新增失败" } })); } } else { int result = SiteServiceClass.Site_CMSBlock_UpdateByb_gid(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "修改成功" } })); } else { return(Json(new { success = false, errors = new { text = "修改失败" } })); } } }
public ActionResult SiteCMSBlockEditView() { string p_gid = Request["p_gid"] ?? string.Empty; string b_gid = Request["b_gid"] ?? string.Empty; int siteName = Request["siteName"].ToInt32(0); Site_CMSBlock info = null; if (string.IsNullOrEmpty(b_gid)) { info = new Site_CMSBlock(); } else { info = SiteServiceClass.Site_CMSBlock_SelectByb_gid(b_gid); } ViewData["window"] = Request["window"] ?? string.Empty; ViewData["info"] = info; ViewBag.siteName = siteName; ViewBag.p_gid = p_gid; return(View()); }
public ActionResult SiteContentRecommendEdit() { //内容ID string c_id = Request["c_id"] ?? string.Empty; //推荐区块ID string b_gid = Request["b_gid"] ?? string.Empty; //区块页面ID string p_gid = Request["p_gid"] ?? string.Empty; VideoInfo fInfo = null; Site_CMSItem item = null; int existCount = 0; int successCount = 0; int failCount = 0; int result = 0; Site_CMSBlock b_info = SiteServiceClass.Site_CMSBlock_SelectByb_gid(b_gid); string[] c_idArr = c_id.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < c_idArr.Length; i++) { fInfo = VideoServiceClass.VideoInfo_SelectById(c_idArr[i].ToInt32()); item = SiteServiceClass.Site_CMSItem_SelectByc_gidAndb_gid(c_idArr[i], b_gid); if (item != null) { existCount++; continue; } item = new Site_CMSItem(); item.i_b_gid = b_gid; item.i_intro = fInfo.v_intro;// item.i_createTime = DateTime.Now; item.i_createUser = SiteHelp.CurrentUserName; item.i_c_gid = fInfo.Id.ToString();//唯一Id item.i_c_type = fInfo.v_c_id.ToString();//分类ID item.i_gid = Guid.NewGuid().ToString().Substring(0, 8); item.i_p_gid = p_gid; item.i_status = (int)SiteEnum.SiteItemStatus.待审核; item.i_subTitle = fInfo.v_timeLength;//时长 item.i_title = fInfo.v_titile; item.i_c_img_src = string.Empty; //图片需要根据该区块设置的图片尺寸,缩放该图片,使用原图来进行缩放 if (!string.IsNullOrEmpty(b_info.b_img_size.Trim())) { if (!string.IsNullOrEmpty(fInfo.v_coverImgSrc)) { string sourceSrc = fInfo.v_coverImgSrc; string error; byte[] imgData = SiteUntility.GetRemoteImage(sourceSrc, out error); if (imgData != null) { List<string> srcResult = UploadServiceClass.UploadImg( imgData, SiteEnum.SiteUploadConfigName.baseUpload.ToString(), new List<string>() { b_info.b_img_size }, ".jpg", "s", SiteEnum.SiteService.VideoUploadService ); item.i_c_img_src = srcResult[1]; } } } result = SiteServiceClass.Site_CMSItem_Insert(item); if (result > 0) { successCount++; } else { failCount++; } } if (c_idArr.Length == 1) { return Json(new { success = true, errors = new { text = "推荐成功" } }); } else { return Json(new { success = true, errors = new { text = string.Format("推荐成功{0}条,失败{1}条,重复{2}条", successCount, failCount, existCount) } }); } }