public ActionResult ResetMobile() { int id = DoRequest.GetFormInt("userid"); string newmobile = DoRequest.GetFormString("newmobile"); int returnValue = -1; var res = ModifyUserMoblie.Do(id, newmobile); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { DoCache cache = new DoCache(); cache.RemoveCacheStartsWith("user"); return(Json(new { error = false, mobile = newmobile, message = "操作成功!" })); } if (returnValue == 135251) { return(Json(new { error = true, message = "该手机号,已经使用,请更换手机号!" })); } return(Json(new { error = true, message = "操作失败!" })); }
public ActionResult PostInsuranceTypeData() { int id = DoRequest.GetFormInt("id"); int insurancetype = DoRequest.GetFormInt("insurancetype"); string usertype = DoRequest.GetFormString("usertype"); #region Checking if (usertype.Length < 1) { return(Json(new { error = true, message = "【名称】用户类别不能为空" })); } #endregion int returnValue = -1; var res = OpInsuranceTypeInfo.Do(id, insurancetype, usertype); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult ResetUserState() { string idString = DoRequest.GetFormString("visitid").Trim(); int status = DoRequest.GetFormInt("status"); if (string.IsNullOrEmpty(idString)) { return(Json(new { error = true, message = "没有选择任何项" })); } int returnValue = -1; var res = ModifyUserState.Do(idString, status); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { DoCache cache = new DoCache(); cache.RemoveCacheStartsWith("user"); return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult PostInsuranceData() { int insurance_id = DoRequest.GetFormInt("insurance_id"); string insurance_name = DoRequest.GetFormString("insurance_name").Trim(); int paytype = DoRequest.GetFormInt("paytype"); #region Checking if (insurance_name.Length < 1) { return(Json(new { error = true, message = "【名称】商保不能为空" })); } if (paytype == 0) { return(Json(new { error = true, message = "请选择【支付方式】" })); } #endregion int returnValue = -1; var res = OpInsuranceInfo.Do(insurance_id, insurance_name, paytype); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult CheckYzm() { string code = DoRequest.GetFormString("code"); string msg = "系统错误"; bool error = true; if (string.IsNullOrEmpty(code)) { return(Json(new { error = error, message = "验证码不能为空" })); } int returnVal = -1; CheckCodeInfo info = new CheckCodeInfo(); var res = CheckManagerVerifyCode.Do(code); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnVal = Utils.StrToInt(res.Header.Result.Code, -1); msg = res.Header.Result.Msg; info = res.Body; } string url = _config.UrlManager + "/Home/index"; if (returnVal == 0) { Cookies.SaveLoginInfo(info.mobile_no, info.last_login_ip, info.last_login_time); } return(Json(new { error = returnVal == 0 ? false : true, message = msg, url = url })); }
public ActionResult SetLocalAddress() { string val = DoRequest.GetFormString("address").Trim(); Cookies.SetLocalAddress(val); return(Json(new { error = false, message = "操作成功!" })); }
public ActionResult PostCoupon() { int userid = DoRequest.GetFormInt("userid"); string name = DoRequest.GetFormString("couponname"); string price = DoRequest.GetFormString("couponvalue"); int couponnum = DoRequest.GetFormInt("couponnum"); if (string.IsNullOrEmpty(name)) { return(Json(new { error = true, message = "请输入优惠券名称!" })); } if (price.Equals("-1")) { return(Json(new { error = true, message = "请选择赠送优惠券的面值!" })); } if (couponnum <= 0) { return(Json(new { error = true, message = "请输入优惠券数量!" })); } int returnValue = -1; var res = GiveUserCoupon.Do(userid, name, price, couponnum); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败!" })); }
public ActionResult PostRole() { int id = DoRequest.GetFormInt("roleid"); string name = DoRequest.GetFormString("rolename").Trim(); string desc = DoRequest.GetFormString("roledesc").Trim(); int type = DoRequest.GetFormInt("roletype", 2); RoleInfo role = new RoleInfo(); role.role_id = id; role.role_name = name; role.role_desc = desc; role.role_type = type; var returnValue = -1; var res = OpRole.Do(role); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { DoCache cache = new DoCache(); cache.RemoveCacheStartsWith("user"); return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult QuerySql() { UserResBody currResBody = new UserResBody(); foreach (UserResBody item in base._userResBody) { if (item.res_path.Equals("0,1,108,238,239,")) { currResBody = item; break; } } HasPermission(currResBody.res_id); ViewData["currResBody"] = currResBody;//当前菜单 string position = ""; ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position); ViewData["position"] = position;//页面位置 string q = DoRequest.GetFormString("q", false); string state = DoRequest.GetFormString("database"); List <string> colname = new List <string>(); DataTable infoList = new DataTable(); if (!q.Equals("") && q != null) { var resp = QueryDataBySql.Do(state, q); infoList = resp; if (infoList == null) { infoList = new DataTable(); } for (int i = 0; i < infoList.Columns.Count; i++) { colname.Add(infoList.Columns[i].ColumnName); } } ViewData["colname"] = colname; Session["colname"] = colname; ViewData["infoList"] = infoList;//数据列表 Session["infoList"] = infoList; ViewData["sql"] = q; ViewData["type"] = state; System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder();//拼接当前页面URL currPageUrl.Append("/home/querysql"); return(View()); }
public ActionResult PostHomeType() { int posId = DoRequest.GetFormInt("posid"); CategSetInfo categ = new CategSetInfo(); var rescateg = GetHomeTypeById.Do(posId); if (rescateg != null && rescateg.Body != null) { categ = rescateg.Body; } if (categ == null) { categ.home_pt_id = 0; } else { categ.home_pt_id = posId; } categ.parent_id = DoRequest.GetFormInt("pid"); categ.type_name = DoRequest.GetFormString("name"); categ.type_url = DoRequest.GetFormString("url"); categ.sort_no = DoRequest.GetFormInt("sort"); categ.is_black = DoRequest.GetFormInt("Isb") > 0 ? 1 : 0; categ.is_color = DoRequest.GetFormInt("Iscolor") > 0 ? 1 : 0; categ.is_newline = DoRequest.GetFormInt("IsBr") > 0 ? 1 : 0; categ.pos_type = DoRequest.GetFormInt("position1"); if (categ.type_name.Length <= 0) { return(Json(new { error = true, message = "菜单名称不能为空" })); } if (categ.type_url.Length <= 0) { return(Json(new { error = true, message = "URL不能为空" })); } if (HasChinese(categ.type_url)) { return(Json(new { error = true, message = "URL不能含中文!" })); } int rVal = -1; var res = OpHomeType.Do(categ); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { rVal = Utils.StrToInt(res.Header.Result.Code, -1); } if (rVal == 0) { return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult PostRecommendPage() { int posId = DoRequest.GetFormInt("posid2"); int flag = DoRequest.GetFormInt("flag", 0); int plat = DoRequest.GetFormInt("plat", 0); if (plat == 4) { plat = 6; } string posName = DoRequest.GetFormString("name"); if (posName.Length < 1) { return(Json(new { error = true, message = "页面名称不能为空" })); } if (posName.Length > 50) { return(Json(new { error = true, message = "页面名称不能超过50个字符" })); } RecommendPositionInfo pos = new RecommendPositionInfo(); var resrep = GetRecommendPositionInfo.Do(posId); if (resrep != null && resrep.Body != null) { pos = resrep.Body; } pos.rp_name = posName; if (flag == 0 && pos.rp_id > 0) { return(Json(new { error = true, message = "该位置ID已存在!" })); } if (pos.rp_id < 1) { pos.rp_id = posId; pos.rp_code = Guid.NewGuid().ToString().ToLower(); pos.use_plat = plat; } pos.op_flag = flag; int rVal = -1; var res = OpTopRecommendPosition.Do(pos); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { rVal = Utils.StrToInt(res.Header.Result.Code, -1); } if (rVal == 0) { return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult PostUserRole() { string roleids = DoRequest.GetFormString("roleids"); int userid = DoRequest.GetFormInt("userid"); List <UserRoleList> oldlist = new List <UserRoleList>(); var reslist = GetUserRole.Do(userid); if (reslist != null && reslist.Body != null && reslist.Body.user_role_list != null) { oldlist = reslist.Body.user_role_list; } string[] newidss = roleids.Split(','); List <int> newids = new List <int>(); foreach (string em in newidss) { newids.Add(Utils.StrToInt(em, 0)); } string delids = ""; int _count = 0; foreach (UserRoleList em in oldlist) { if (!newids.Contains(em.role_id)) { if (_count == 0) { delids = em.role_id.ToString(); } else { delids = delids + "," + em.role_id.ToString(); } } } if (delids.Equals("")) { delids = "0"; } int returnValue = -1; var res = OpUserRole.Do(userid, roleids, delids); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败!" })); }
public ActionResult PostShopData() { int shopid = DoRequest.GetFormInt("shopid"); ShopInfo shop = GetShopDetail.Do(shopid).Body; shop.shop_name = DoRequest.GetFormString("shopName"); shop.company_name = DoRequest.GetFormString("Company"); shop.shop_key = DoRequest.GetFormString("keyword"); shop.shop_pswd = DoRequest.GetFormString("psword"); int province = DoRequest.GetFormInt("province"); int city = DoRequest.GetFormInt("city"); shop.area_id = province; shop.shop_addr = GetArea.Do(province).Body.area_list[0].area_name; string cityName = GetArea.Do(city).Body.area_list[0].area_name; if (!cityName.StartsWith("市辖") && !cityName.StartsWith("直辖")) { shop.shop_addr += cityName; } shop.link_way = DoRequest.GetFormString("linkway"); shop.shop_remark = DoRequest.GetFormString("remarks"); #region Checking if (shop.shop_name.Length < 1) { return(Json(new { error = true, message = "[名称] 不能为空" })); } if (shop.shop_name.Length > 50) { return(Json(new { error = true, message = "[名称] 不能大于50个字符" })); } if (shop.company_name.Length < 0 && shop.company_name.Length > 100) { return(Json(new { error = true, message = "[公司] 不能为空或大于100个字符" })); } if (shop.area_id < 0) { return(Json(new { error = true, message = "[发货地址] 不能为空" })); } #endregion int returnValue = -1; returnValue = int.Parse(OpShopInfo.Do(shop).Header.Result.Code); if (returnValue == 0) { return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult PostCategData() { int parentId = DoRequest.GetFormInt("parentId"); int itemId = DoRequest.GetFormInt("itemId"); string name = DoRequest.GetFormString("name").Trim(); int sort = DoRequest.GetFormInt("sort", 0); #region Checking if (name.Length < 1) { return(Json(new { error = true, message = "【名称】不能为空" })); } if (name.Length > 50) { return(Json(new { error = true, message = "【名称】不能多于50个字符" })); } #endregion List <ArticleTypeInfo> tList = new List <ArticleTypeInfo>(); var resart = GetArticleType.Do(0, 2, -1); if (resart != null && resart.Body != null && resart.Body.article_type_list != null) { tList = resart.Body.article_type_list; } ArticleTypeInfo tInfo = tList.Find(delegate(ArticleTypeInfo em) { return(em.article_type_id == itemId); }); if (tInfo == null) { tInfo = new ArticleTypeInfo(); } tInfo.article_type_id = itemId; tInfo.parent_id = parentId; tInfo.article_type_name = name; tInfo.sort_no = sort; int returnValue = -1; var res = OpArticleType.Do(tInfo); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult GetProductInfoByProductNumber() { string productNumber = DoRequest.GetFormString("productNumber"); ProductInfoByCode product = new ProductInfoByCode(); var res = GetProductInfoByCode.Do(productNumber); if (res == null || res.Body == null || res.Body.product_id < 1) { return(Json(new { error = true, message = "未找到商品!" }, JsonRequestBehavior.AllowGet)); } else { product = res.Body; } return(Json(new { error = false, message = "成功!", product }, JsonRequestBehavior.AllowGet)); }
[ValidateInput(false)]//允许html public ActionResult ResetItemSortNo() { string returnUrl = DoRequest.GetFormString("returnurl").Trim(); string xmlString = DoRequest.GetFormString("xml", false).Replace("<", "<").Replace(">", ">"); try { XmlDataDocument xmlDoc = new XmlDataDocument(); xmlDoc.LoadXml(xmlString); List <ModifyRecommendList> items = new List <ModifyRecommendList>(); XmlNodeList nodes = xmlDoc.SelectNodes("items/item"); if (nodes != null) { #region 新增分类 foreach (XmlNode item in nodes) { ModifyRecommendList iem = new ModifyRecommendList(); iem.ri_id = Utils.StrToInt(item.Attributes["ItemID"].Value).ToString(); iem.sort_no = (Utils.IsNumber(item.Attributes["SortNo"].Value) ? (int.Parse(item.Attributes["SortNo"].Value)) : 1000).ToString(); items.Add(iem); } #endregion } int returnValue = -1; var res = ModifyRecommendItemSortNo.Do(items); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "保存成功 ^_^" })); } } catch (Exception) { return(Json(new { error = true, message = "Xml解析失败..." })); } return(Json(new { error = true, message = "保存失败" })); }
public ActionResult UpdateIntelgral() { int id = DoRequest.GetFormInt("userid"); int intelval = DoRequest.GetFormInt("intelval"); string reason = DoRequest.GetFormString("reason"); int returnValue = -1; var res = ModifyUserIntelgral.Do(id, intelval, reason); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败!" })); }
public ActionResult GetImageList() { int pagesize = DoRequest.GetFormInt("size", 15); int pageindex = DoRequest.GetFormInt("page", 1); //string code = DoRequest.GetFormString("path"); DateTime startDate = DoRequest.GetFormDate("sDate", DateTime.Now.AddYears(-100)); DateTime endDate = DoRequest.GetFormDate("eDate", DateTime.Now); string query = DoRequest.GetFormString("query"); int dataCount = 0; int pageCount = 0; List <PicFile> list = new List <PicFile>(); var res = GetSysPicFile.Do(pagesize, pageindex, 3, startDate, endDate, query, ref dataCount, ref pageCount); if (res != null && res.Body != null && res.Body.pic_file_list != null) { list = res.Body.pic_file_list; } UpLoadFile upload = new UpLoadFile(false); return(Json(new { error = false, total = dataCount, size = pagesize, pages = pageCount, page = pageindex, root = base._config.UrlImages, data = list }, JsonRequestBehavior.AllowGet)); }
public ActionResult RemoveItems() { string idString = DoRequest.GetFormString("visitid").Trim(); if (string.IsNullOrEmpty(idString)) { return(Json(new { error = true, message = "没有选择任何项" })); } int returnValue = -1; var res = DeleteRecommendItem.Do(idString); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult ResetFileStatus() { string idString = DoRequest.GetFormString("visitid").Trim(); int visible = DoRequest.GetFormInt("visible"); if (string.IsNullOrEmpty(idString)) { return(Json(new { error = true, message = "没有选择任何项" })); } int returnValue = -1; var res = ModifySysFileState.Do(idString, visible); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult PostShopData() { int shopid = DoRequest.GetFormInt("shopid"); ShopInfo shop = GetShopDetail.Do(shopid).Body; if (shop == null) { shop = new ShopInfo(); shop.shop_id = 0; } shop.shop_name = DoRequest.GetFormString("shopName"); shop.company_name = DoRequest.GetFormString("Company"); shop.shop_key = DoRequest.GetFormString("skeyword"); string pswd = DoRequest.GetFormString("spsword"); if ((pswd.Equals("") || pswd == null) && shop.shop_id == 0) { return(Json(new { error = true, message = "[密码] 不能为空" })); } if (!pswd.Equals("") && pswd != null) { shop.shop_pswd = AES.Decode2(pswd, "5f9bf958d112f8668ac53389df8bceba"); } int province = DoRequest.GetFormInt("province"); int city = DoRequest.GetFormInt("city"); shop.area_id = province; shop.shop_addr = GetArea.Do(province).Body.area_list[0].area_name; string cityName = GetArea.Do(city).Body.area_list[0].area_name; if (!cityName.StartsWith("市辖") && !cityName.StartsWith("直辖")) { shop.shop_addr += cityName; } shop.link_way = DoRequest.GetFormString("linkway"); shop.support_express = DoRequest.GetFormString("supportexpress"); shop.delivery_intro = DoRequest.GetFormString("deliveryintro"); shop.service_intro = DoRequest.GetFormString("serviceintro", false); string sdate = DoRequest.GetFormString("sdate").Trim(); int shours = DoRequest.GetFormInt("shours"); int sminutes = DoRequest.GetFormInt("sminutes"); DateTime startDate = Utils.IsDateString(sdate) ? DateTime.Parse(sdate + " " + shours + ":" + sminutes + ":00") : DateTime.Now; string edate = DoRequest.GetFormString("edate").Trim(); int ehours = DoRequest.GetFormInt("ehours"); int eminutes = DoRequest.GetFormInt("eminutes"); DateTime endDate = Utils.IsDateString(edate) ? DateTime.Parse(edate + " " + ehours + ":" + eminutes + ":59") : DateTime.Now.AddDays(7); shop.notice_btime = startDate.ToString("yyyy-MM-dd HH:mm:ss"); shop.notice_etime = endDate.ToString("yyyy-MM-dd HH:mm:ss"); shop.shop_notice = DoRequest.GetFormString("shopnotice", false); shop.shop_remark = DoRequest.GetFormString("remarks"); shop.shop_type = DoRequest.GetFormInt("shoptype"); #region Checking if (shop.shop_name.Length < 1) { return(Json(new { error = true, message = "[店铺名称] 不能为空" })); } if (shop.shop_name.Length > 50) { return(Json(new { error = true, message = "[店铺名称] 不能大于50个字符" })); } if (shop.company_name.Length < 0 && shop.company_name.Length > 100) { return(Json(new { error = true, message = "[公司名称] 不能为空或大于100个字符" })); } if (shop.shop_key.Length < 1) { return(Json(new { error = true, message = "[账号] 不能为空" })); } if (shop.shop_pswd.Length < 1) { return(Json(new { error = true, message = "[密码] 不能为空" })); } if (shop.area_id < 0) { return(Json(new { error = true, message = "[发货地址] 不能为空" })); } if (shop.shop_addr.Length < 1) { return(Json(new { error = true, message = "[联系方式] 不能为空" })); } if (shop.support_express.Length < 1) { return(Json(new { error = true, message = "[快递公司] 不能为空" })); } #endregion int returnValue = -1; var res = OpShopInfo.Do(shop); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { DoCache cache = new DoCache(); cache.RemoveCache("shoplist"); return(Json(new { error = false, message = "操作成功" })); } return(Json(new { error = true, message = "操作失败" })); }
public ActionResult UploadImage() { //Response.Charset = "utf-8"; //Response.ContentType = "text/javascript"; int typeId = DoRequest.GetFormInt("code"); //图片分类编码 string allow = DoRequest.GetFormString("allow").ToLower().Trim(); //允许上传哪些后缀的图片,多个后缀使用逗号隔开,缺省为允许jpg/jpeg/gif/png/bmp //测试log //Logger.Log(DoRequest.GetFormString("name").ToLower().Trim()); List <string> allowList = new List <string>(); string[] arr = allow.Split(','); string _fullpath = ""; foreach (string s in arr) { if (string.IsNullOrEmpty(s)) { continue; } string val = s.Trim(); if (val.StartsWith(".")) { val = val.Substring(1); } allowList.Add(val); } if (!UpLoadFile.IsPostFile()) { return(this.formatJson(Json(new { error = true, message = "请选择上传的文件" }))); } var returnValue = -1; Robots robots = null; HttpFileCollection postfiles = System.Web.HttpContext.Current.Request.Files; if (postfiles[0] != null && postfiles[0].FileName != null && postfiles[0].FileName != "") { HttpPostedFile file = postfiles[0]; try { string ext = file.FileName.ToLower().Substring(file.FileName.LastIndexOf('.') + 1).ToLower(); if (ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "bmp" || ext == "png") { } else { return(this.formatJson(Json(new { error = true, message = "不允许上传此类型文件" }))); } } catch (Exception e) { Logger.Error(e.ToString()); } NameValueCollection myCol = new NameValueCollection(); robots = new Robots(); //测试log //Logger.Log("进入上传"); string s = robots.HttpUploadFile(config.UrlImagesUpload, file, myCol, "file"); //测试log // Logger.Log("上传完毕"); if (robots.IsError) { return(this.formatJson(Json(new { error = true, message = robots.ErrorMsg }))); } string uploadSaveMapPath = JsonHelper.JsonToObject <Response <ResponseFile> >(s).Body.fileNameList[0].fileKey; uploadSaveMapPath = uploadSaveMapPath.Replace("jianbao/website/", ""); string savepath = uploadSaveMapPath; string fullpathXX = JsonHelper.JsonToObject <Response <ResponseFile> >(s).Body.fileNameList[0].fileUrl; _fullpath = fullpathXX; #region 存储到数据表 SysFilesInfo picfile = new SysFilesInfo(); picfile.sp_type_id = typeId;//未分类 picfile.file_name = postfiles[0].FileName; picfile.save_name = uploadSaveMapPath.Substring(uploadSaveMapPath.LastIndexOf("/") + 1); if (uploadSaveMapPath.StartsWith("/")) { picfile.save_path = uploadSaveMapPath.Substring(1); } else { picfile.save_path = uploadSaveMapPath; } picfile.user_agent = DoRequest.UserAgent; picfile.client_ip = DoRequest.ClientIP; //测试log //Logger.Log("写入数据库"); var res = AddSysPicFile.Do(picfile); //测试log //Logger.Log("写完数据库"); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } #endregion } if (returnValue == 0) { return(this.formatJson(Json(new { error = false, message = "上传成功!", path = _fullpath }))); } return(this.formatJson(Json(new { error = true, message = "上传失败..." }))); }
public ActionResult PostPosition() { int ptype = DoRequest.GetFormInt("ptype", 7); string parent = DoRequest.GetFormString("parent"); string xmlString = DoRequest.GetFormString("xml", false).Replace("<", "<").Replace(">", ">"); try { XmlDataDocument xmlDoc = new XmlDataDocument(); xmlDoc.LoadXml(xmlString); List <RecommendPositionInfo> posList = new List <RecommendPositionInfo>(); List <string> codeList = new List <string>();//id codeList.Add(parent); XmlNodeList nodes = xmlDoc.SelectNodes("items/item"); //XmlNodeList nodes = xmlDoc.SelectNodes("items/item[@Type='create']"); if (nodes != null) { #region 新增分类 foreach (XmlNode item in nodes) { RecommendPositionInfo pos = new RecommendPositionInfo(); string itemType = item.Attributes["Type"].Value.Trim(); string parentValue = item.Attributes["ParentID"].Value.Trim(); string posValue = item.Attributes["Code"].Value.Trim(); int posId = Utils.StrToInt(item.Attributes["PosID"].Value.Trim()); string sortValue = item.Attributes["SortNo"].Value.Trim(); int useplat = Utils.StrToInt(item.Attributes["UsePlat"].Value.Trim(), 7); if (useplat == 4) { useplat = 6; } string flag = item.Attributes["Flag"].Value.Trim(); //if (string.IsNullOrEmpty(parentValue)) //{ // sortValue = "100" + sortValue; //} if (flag.Equals("true")) { pos.op_flag = 0; } else { pos.op_flag = 1; } string nameValue = item.SelectSingleNode("name").InnerText.Trim(); if (string.IsNullOrEmpty(nameValue)) { return(Json(new { error = true, message = "请填写分类名称,或将未填写分类名的行删除..." })); } if (nameValue.Length > 100) { return(Json(new { error = true, message = "分类名不能大于100个字符..." })); } pos.rp_id = posId; pos.rp_name = nameValue; //分类名 pos.parent_rp_code = parentValue; //父类编码 pos.rp_code = posValue; //Utils.IsGuid(classValue) ? classValue : Guid.NewGuid().ToString().ToLower();//分类编码 pos.sort_no = Utils.IsNumber(sortValue) ? int.Parse(sortValue) : 10000; //排序 pos.use_plat = useplat; posList.Add(pos); codeList.Add(pos.rp_code); } #endregion } #region 除分类 List <ShortRecommendPosition> dbList = new List <ShortRecommendPosition>(); var ressrel = GetRecommendPositionByCode.Do(parent, ptype);//非顶级分类 if (ressrel != null && ressrel.Body != null && ressrel.Body.recommend_list != null) { dbList = ressrel.Body.recommend_list; } //StringBuilder sb = new StringBuilder(); //int _deleteCount = 0; System.Text.StringBuilder deletePathList = new System.Text.StringBuilder(); foreach (ShortRecommendPosition item in dbList) { if (!codeList.Contains(item.rp_code.ToLower().Trim())) { deletePathList.Append(item.rp_code.Trim() + ","); } List <ShortRecommendPosition> dbList2 = new List <ShortRecommendPosition>(); var ressrel2 = GetRecommendPositionByCode.Do(item.rp_code, ptype);//非顶级分类 if (ressrel2 != null && ressrel2.Body != null && ressrel2.Body.recommend_list != null) { dbList2 = ressrel2.Body.recommend_list; } foreach (ShortRecommendPosition em in dbList2) { if (!codeList.Contains(em.rp_code.ToLower().Trim())) { deletePathList.Append(em.rp_code.Trim() + ","); } } } #endregion int returnVal = -1; var res = OpRecommendPosition.Do(posList, deletePathList.ToString()); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnVal = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnVal == 6) { return(Json(new { error = true, message = "该位置ID已存在" })); } if (returnVal == 0) { return(Json(new { error = false, message = "保存成功 ^_^" })); } } catch (Exception) { return(Json(new { error = true, message = "Xml解析失败..." })); } return(Json(new { error = true, message = "保存失败" })); }
public ActionResult PostArticleData() { int id = DoRequest.GetFormInt("id"); int classId = DoRequest.GetFormInt("ClassID"); ArticleInfo article = new ArticleInfo(); var resarticle = GetArticleInfo.Do(id, "curr"); if (resarticle != null && resarticle.Body != null) { article = resarticle.Body; } List <ArticleTypeInfo> categs = new List <ArticleTypeInfo>();;//分类信息 var restype = GetArticleType.Do(0, 2, -1); if (restype != null && restype.Body != null && restype.Body.article_type_list != null) { categs = restype.Body.article_type_list; } ArticleTypeInfo categ = categs.Find(delegate(ArticleTypeInfo em) { return(em.article_type_id == classId); }); if (categ == null) { categ = new ArticleTypeInfo(); } if (categ.article_type_id < 1) { return(Json(new { error = true, input = "message", message = "请选择分类" })); } #region 获取参数 article.article_type_id = categ.article_type_id; article.title_color = DoRequest.GetFormString("titlecolor"); article.is_top = DoRequest.GetFormInt("istop") > 0 ? 1 : 0; article.article_title = DoRequest.GetFormString("title").Trim(); article.click_count = DoRequest.GetFormInt("clickcount"); article.key_word = DoRequest.GetFormString("keyword").Trim(); article.article_source = DoRequest.GetFormString("source").Trim(); article.author_name = DoRequest.GetFormString("author").Trim(); article.title_img = DoRequest.GetFormString("titleimg"); article.article_content = DoRequest.GetFormString("content", false).Trim(); #endregion #region Checking if (article.article_type_id < 1) { return(Json(new { error = true, input = "message", message = "请选择分类" })); } if (article.article_title.Length < 1) { return(Json(new { error = true, input = "message", message = "请填写标题" })); } if (article.article_title.Length > 200) { return(Json(new { error = true, input = "message", message = "标题不能大于200个字符" })); } if (article.click_count < 0) { return(Json(new { error = true, input = "message", message = "点击数不能小于0!" })); } #endregion int returnValue = -1; var res = OpArticle.Do(article); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } #region 判断是否操作成功 string msgText = ""; switch (returnValue) { case 0: msgText = "操作成功 ^_^"; break; case -1: default: msgText = "操作失败"; break; } #endregion return(Json(new { error = returnValue == 0 ? false : true, message = msgText })); }
public ActionResult PostItems() { int posId = DoRequest.GetFormInt("posID"); int listId = DoRequest.GetFormInt("ListID"); int ristyle = DoRequest.GetFormInt("stype"); string rivalue = DoRequest.GetFormString("proid"); string gtype = DoRequest.GetFormString("gtype"); string protype = DoRequest.GetFormString("protype"); string subject = DoRequest.GetFormString("subject"); string brand = DoRequest.GetFormString("brand"); string url = DoRequest.GetFormString("url").Trim(); string iconname = DoRequest.GetFormString("iconname"); string sdate = DoRequest.GetFormString("sdate").Trim(); int shours = DoRequest.GetFormInt("shours"); int sminutes = DoRequest.GetFormInt("sminutes"); DateTime startDate = Utils.IsDateString(sdate) ? DateTime.Parse(sdate + " " + shours + ":" + sminutes + ":00") : DateTime.Now; string edate = DoRequest.GetFormString("edate").Trim(); int ehours = DoRequest.GetFormInt("ehours"); int eminutes = DoRequest.GetFormInt("eminutes"); DateTime endDate = Utils.IsDateString(edate) ? DateTime.Parse(edate + " " + ehours + ":" + eminutes + ":59") : DateTime.Now.AddDays(7); string image = DoRequest.GetFormString("image"); string summary = DoRequest.GetFormString("summary"); int plat = DoRequest.GetFormInt("useplat"); if (plat == 4) { plat = 6; } string imgsrc = ""; if (ristyle == 1) { ProductInfo product = new ProductInfo(); var respro = GetProductInfo.Do(Utils.StrToInt(rivalue, 0)); if (respro != null && respro.Body != null) { product = respro.Body; } imgsrc = product.img_src; if (product.product_id < 1) { return(Json(new { error = true, message = "商品不存在" })); } } if ((ristyle == 4 || ristyle == 5) && HasChinese(rivalue)) { return(Json(new { error = true, message = "URL不能含中文!" })); } if (HasChinese(url)) { return(Json(new { error = true, message = "URL不能含中文!" })); } if (ristyle == 2) { rivalue = protype; if (rivalue.Equals("") || rivalue == null) { return(Json(new { error = true, message = "请选择分类!" })); } } List <RecommendListInfo> items = new List <RecommendListInfo>(); var resrel = GetRecommendItemByRpId.Do(posId); if (resrel != null && resrel.Body != null && resrel.Body.item_list != null) { items = resrel.Body.item_list; } List <int> liids = new List <int>(); foreach (RecommendListInfo em in items) { liids.Add(em.ri_id); } RecommendListInfo listInfo = items.Find(delegate(RecommendListInfo em) { return(em.ri_id == listId); }); if (listInfo == null) { listInfo = new RecommendListInfo(); } RecommendListInfo listInfo2 = items.Find(delegate(RecommendListInfo em) { return(em.ri_value.Equals(rivalue)); }); if (listInfo2 == null) { listInfo2 = new RecommendListInfo(); } if (!liids.Contains(listId) && rivalue.Equals(listInfo2.ri_value) && (listInfo.ri_id > 0) && ((startDate >= DateTime.Parse(listInfo.start_time) && startDate <= DateTime.Parse(listInfo.end_time)) || (endDate >= DateTime.Parse(listInfo.start_time) && endDate <= DateTime.Parse(listInfo.end_time)) || (startDate <= DateTime.Parse(listInfo.start_time) && endDate >= DateTime.Parse(listInfo.end_time)))) { return(Json(new { error = true, message = "该推荐项在同期同位置已被推荐" })); } #region Checking if (subject.Length <= 0) { return(Json(new { error = true, message = "推荐标题不能为空" })); } if (image.Length > 300) { return(Json(new { error = true, message = "图标地址不能超过300个字符" })); } if (summary.Length > 600) { return(Json(new { error = true, message = "简介不能超过600个字符" })); } #endregion listInfo.ri_id = listId; listInfo.rp_id = posId; listInfo.ri_type = ristyle; if (ristyle == 5 && plat < 4) { listInfo.ri_value = gtype; listInfo.page_src = rivalue; } else { listInfo.ri_value = rivalue; listInfo.page_src = url; } if (ristyle == 1) { listInfo.product_id = Utils.StrToInt(rivalue, 0); } else { listInfo.product_id = 0; } listInfo.ri_subject = subject; listInfo.product_brand = brand; listInfo.ri_summary = summary; listInfo.start_time = startDate.ToString("yyyy-MM-dd HH:mm:ss"); listInfo.end_time = endDate.ToString("yyyy-MM-dd HH:mm:ss"); if (plat < 0 || plat > 7) { return(Json(new { error = true, message = "显示平台选择不规范" })); } listInfo.use_plat = plat; if (!string.IsNullOrEmpty(image)) { listInfo.img_src = image; } else { listInfo.img_src = imgsrc; } if (listInfo.product_brand == null) { listInfo.product_brand = ""; } listInfo.icon_name = iconname; int returnValue = -1; var res = OpRecommendItems.Do(listInfo); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } #region 判断是否操作成功 string msgText = ""; switch (returnValue) { case 0: msgText = "操作成功 ^_^"; break; case -1: msgText = "操作失败"; break; default: msgText = "操作失败"; break; } #endregion return(Json(new { error = returnValue == 0 ? false : true, message = msgText })); }
public ActionResult PostHelpData() { int id = DoRequest.GetFormInt("id"); int classId = DoRequest.GetFormInt("ClassID"); HelpInfo help = new HelpInfo(); var resarticle = GetHelpInfo.Do(classId); if (resarticle != null && resarticle.Body != null) { help = resarticle.Body; } List <HelpTypeInfo> categs = new List <HelpTypeInfo>();;//分类信息 var restype = GetHelpType.Do(0, 2, -1); if (restype != null && restype.Body != null && restype.Body.help_type_list != null) { categs = restype.Body.help_type_list; } HelpTypeInfo categ = categs.Find(delegate(HelpTypeInfo em) { return(em.help_type_id == classId); }); if (categ.help_type_id < 1) { return(Json(new { error = true, input = "message", message = "请选择分类" })); } #region 获取参数 help.help_title = DoRequest.GetFormString("title").Trim(); help.click_count = DoRequest.GetFormInt("clickcount"); help.help_summary = DoRequest.GetFormString("summary").Trim(); help.help_content = DoRequest.GetFormString("content", false).Trim(); help.key_word = DoRequest.GetFormString("keyword").Trim(); help.author_name = DoRequest.GetFormString("author").Trim(); #endregion help.help_type_id = categ.help_type_id; #region Checking if (help.help_type_id < 1) { return(Json(new { error = true, input = "message", message = "请选择分类" })); } if (help.help_title.Length < 1) { return(Json(new { error = true, input = "message", message = "请填写标题" })); } if (help.help_title.Length > 200) { return(Json(new { error = true, input = "message", message = "标题不能大于200个字符" })); } if (help.click_count < 0) { return(Json(new { error = true, input = "message", message = "点击数不能小于0!" })); } if (help.help_summary.Length > 1000) { return(Json(new { error = true, input = "message", message = "摘要1000个字符" })); } #endregion int returnValue = -1; var res = OpHelp.Do(help); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } #region 判断是否操作成功 string msgText = ""; switch (returnValue) { case 0: msgText = "操作成功"; break; case -1: default: msgText = "操作失败"; break; } #endregion return(Json(new { error = returnValue == 0 ? false : true, message = msgText })); }
public ActionResult PostPolymericList() { string subject = DoRequest.GetFormString("subject").Trim(); string excelPath = DoRequest.GetFormString("excel").Trim(); string sdate = DoRequest.GetFormString("sdate").Trim(); int shours = DoRequest.GetFormInt("shours"); int sminutes = DoRequest.GetFormInt("sminutes"); DateTime startDate = Utils.IsDateString(sdate) ? DateTime.Parse(sdate + " " + shours + ":" + sminutes + ":00") : DateTime.Now; string edate = DoRequest.GetFormString("edate").Trim(); int ehours = DoRequest.GetFormInt("ehours"); int eminutes = DoRequest.GetFormInt("eminutes"); DateTime endDate = Utils.IsDateString(edate) ? DateTime.Parse(edate + " " + ehours + ":" + eminutes + ":59") : DateTime.Now.AddDays(7); string summary = DoRequest.GetFormString("summary").Trim(); if (subject.Length < 1) { return(Json(new { error = true, message = "请填写主题..." })); } if (subject.Length > 50) { return(Json(new { error = true, message = "主题不能超过50个字符..." })); } if (summary.Length > 500) { return(Json(new { error = true, message = "摘要不能超过500个字符..." })); } Robots _rbt = new Robots(); System.Text.StringBuilder url = new System.Text.StringBuilder(); url.Append(base._config.UrlHome + "Tools/ImportFromExcel?"); url.Append(Cookies.CreateVerifyString()); System.Text.StringBuilder postData = new System.Text.StringBuilder(); postData.Append("subject=" + DoRequest.UrlEncode(AES.Encode(subject))); postData.Append("&excel=" + DoRequest.UrlEncode(AES.Encode(excelPath))); postData.Append("&sdate=" + startDate.ToString("yyyy-MM-dd HH:mm:ss")); postData.Append("&edate=" + endDate.ToString("yyyy-MM-dd HH:mm:ss")); postData.Append("&summary=" + DoRequest.UrlEncode(AES.Encode(summary))); string html = _rbt.Post(url.ToString(), postData.ToString(), "utf-8"); if (_rbt.IsError) { return(Json(new { error = true, message = _rbt.ErrorMsg })); } if (string.IsNullOrEmpty(html)) { return(Json(new { error = true, message = "远程页面无响应..." })); } ParseJson pJson = new ParseJson(); SortedDictionary <string, string> list = pJson.Parse(html); bool isError = false; if (pJson.GetJsonValue(list, "error") == "true") { isError = true; } return(Json(new { error = isError, message = pJson.GetJsonValue(list, "message") })); }
public ActionResult PostAccessData() { int parentId = DoRequest.GetFormInt("parentId"); int nodeId = DoRequest.GetFormInt("nodeId"); string name = DoRequest.GetFormString("name").Trim(); int sort = DoRequest.GetFormInt("sort"); string desc = DoRequest.GetFormString("desc"); #region 验证 if (string.IsNullOrEmpty(name)) { return(Json(new { error = true, message = "名称不能为空" })); } #endregion List <AccessInfo> accesslist = new List <AccessInfo>(); var reslist = QueryAccessList.Do(); if (reslist != null && reslist.Body != null && reslist.Body.access_list != null) { accesslist = reslist.Body.access_list; } AccessInfo pNode = accesslist.FindLast(delegate(AccessInfo item) { return(item.access_id == parentId); }); AccessInfo cNode = accesslist.FindLast(delegate(AccessInfo item) { return(item.access_id == nodeId); }); if (pNode == null) { pNode = new AccessInfo(); } if (cNode == null) { cNode = new AccessInfo(); } #region 初始化参数 if (pNode.access_id == 0 && cNode.access_id == 0) { cNode.parent_id = 0; } else { cNode.parent_id = pNode.access_id; } cNode.access_name = name; cNode.sort_no = sort; cNode.access_desc = desc; #endregion int returnValue = -1; bool isAdd = false; if (cNode.access_id == 0) { //新增 cNode.access_id = 0; isAdd = true; var resResp = OpAccess.Do(cNode); if (resResp != null && resResp.Header != null && resResp.Header.Result != null && resResp.Header.Result.Code != null) { returnValue = Utils.StrToInt(resResp.Header.Result.Code, -1); } } else { //更新 var resResp = OpAccess.Do(cNode); if (resResp != null && resResp.Header != null && resResp.Header.Result != null && resResp.Header.Result.Code != null) { returnValue = Utils.StrToInt(resResp.Header.Result.Code, -1); } } bool isError = true; string message = "操作失败"; if (returnValue == 0) { isError = false; message = "操作成功"; } return(Json(new { error = isError, message = message, isadd = isAdd })); }
public ActionResult PostRoleAccessData() { string xmlString = DoRequest.GetFormString("xml", false); xmlString = HttpUtility.UrlDecode(xmlString); int roleid = DoRequest.GetFormInt("id"); string ids = ""; int _count = 0; List <int> idsi = new List <int>(); try { XmlDataDocument xmlDoc = new XmlDataDocument(); xmlDoc.LoadXml(xmlString); XmlNodeList nodes = xmlDoc.SelectNodes("items/item"); if (nodes != null) { foreach (XmlNode item in nodes) { int access = Utils.StrToInt(item.Attributes["accessid"].Value.Trim(), 0); int issel = Utils.StrToInt(item.Attributes["isselect"].Value.Trim(), 0); if (issel == 1) { if (_count == 0) { ids = access.ToString(); } else { ids = ids + "," + access.ToString(); } _count++; idsi.Add(access); } } } } catch (Exception) { return(Json(new { error = true, input = "message", message = "Xml解析失败..." })); } _count = 0; string delids = ""; List <RoleAccessInfo> oldlist = new List <RoleAccessInfo>(); var resrole = QueryRoleAccess.Do(roleid); if (resrole != null && resrole.Body != null && resrole.Body.access_list != null) { oldlist = resrole.Body.access_list; } foreach (RoleAccessInfo item in oldlist) { if (!idsi.Contains(item.access_id)) { if (_count == 0) { delids = item.access_id.ToString(); } else { delids = delids + "," + item.access_id.ToString(); } _count++; } } if (delids.Equals("")) { delids = "0"; } var returnValue = -1; var res = AddRoleAccess.Do(roleid, ids, delids); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败!" })); }
public ActionResult PostSysFileCategData() { string parentCode = DoRequest.GetFormString("parentCode"); string code = DoRequest.GetFormString("code"); int typeId = DoRequest.GetFormInt("typeId"); string name = DoRequest.GetFormString("name").Trim(); int sort = DoRequest.GetFormInt("sort"); int issys = DoRequest.GetFormInt("isSys"); #region 验证 if (string.IsNullOrEmpty(name)) { return(Json(new { error = true, message = "名称不能为空" })); } if (string.IsNullOrEmpty(code)) { return(Json(new { error = true, message = "编码不能为空" })); } if (Utils.IsLong(code)) { return(Json(new { error = true, message = "编码不能是纯数字" })); } if (!Utils.IsMatch(code, @"^[0-9a-zA-Z\-]{1,100}$")) { return(Json(new { error = true, message = "编码只能是数字、字母或中划线(-)" })); } #endregion List <PicTypeList> sysFClassList = new List <PicTypeList>(); var restype = GetSysFileType.Do(-1); if (restype != null && restype.Body != null && restype.Body.type_list != null) { sysFClassList = restype.Body.type_list; } PicTypeList pNode = sysFClassList.FindLast(delegate(PicTypeList item) { return(item.type_code.Equals(parentCode)); }); PicTypeList cNode = sysFClassList.FindLast(delegate(PicTypeList item) { return(item.sp_type_id == typeId); }); if (pNode == null) { pNode = new PicTypeList(); } if (cNode == null) { cNode = new PicTypeList(); } #region 初始化参数 cNode.parent_code = pNode.type_code; cNode.type_code = code; cNode.sp_type_name = name; cNode.sort_no = sort; cNode.is_sys = issys; #endregion int returnValue = -1; if (cNode.sp_type_id < 1) { //新增 cNode.sp_type_state = 0; } var res = OpSysFileType.Do(cNode); if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null) { returnValue = Utils.StrToInt(res.Header.Result.Code, -1); } if (returnValue == 0) { return(Json(new { error = false, message = "操作成功!" })); } return(Json(new { error = true, message = "操作失败!" })); }