protected void btnEditBanner_Click(object sender, System.EventArgs e) { TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id); tplCfgById.IsDisable = false; tplCfgById.ImageUrl = this.fmSrc.Value; tplCfgById.ShortDesc = this.txtBannerDesc.Text; tplCfgById.LocationType = (EcShop.Entities.VShop.LocationType)System.Enum.Parse(typeof(EcShop.Entities.VShop.LocationType), this.ddlType.SelectedValue); tplCfgById.Url = this.locationUrl.Value; tplCfgById.Client = 2; if (VShopHelper.UpdateTplCfg(tplCfgById)) { this.CloseWindow(); return; } this.ShowMsg("修改失败!", false); }
protected void lkbDelectSelect_Click(object sender, System.EventArgs e) { string text = ""; if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"])) { text = base.Request["CheckBoxGroup"]; } if (text.Length <= 0) { this.ShowMsg("请先选择要删除的分销商排名", false); return; } VShopHelper.DeleteCustomDistributorStatistic(text); this.ShowMsg("删除成功", true); this.BindData(); }
protected void btnSaveTemplatesList_Click(object sender, EventArgs e) { List <MessageTemplate> templates = new List <MessageTemplate>(); for (int i = 0; i < this.rptAliFuWuMessageTemplateList.Items.Count; i++) { MessageTemplate item = new MessageTemplate { MessageType = ((HiddenField)this.rptAliFuWuMessageTemplateList.Items[i].FindControl("hdfMessageType")).Value, SendWeixin = true, WeixinTemplateId = ((TextBox)this.rptAliFuWuMessageTemplateList.Items[i].FindControl("txtTemplateId")).Text.Trim() }; templates.Add(item); } VShopHelper.UpdateAliFuWuSettings(templates); this.ShowMsg("保存设置成功", true); }
private DataGridViewModel <Dictionary <string, object> > GetDataList(HttpContext context) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); ProductQuery productQuery = new ProductQuery(); int num = 1; int num2 = 10; num = context.Request["page"].ToInt(0); if (num < 1) { num = 1; } num2 = context.Request["rows"].ToInt(0); if (num2 < 1) { num2 = 10; } productQuery.PageSize = num2; productQuery.PageIndex = num; productQuery.SortOrder = SortAction.Desc; productQuery.SortBy = "t.DisplaySequence"; productQuery.StoreId = 0; productQuery.IsFilterStoreProducts = true; productQuery.SupplierId = 0; DbQueryResult homeProducts = VShopHelper.GetHomeProducts(productQuery); dataGridViewModel.rows = DataHelper.DataTableToDictionary(homeProducts.Data); dataGridViewModel.total = homeProducts.TotalRecords; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { ProductInfo productInfo = row.ToObject <ProductInfo>(); if (productInfo.ProductName.Length >= 26) { row.Add("SubProductName", productInfo.ProductName.Substring(0, 26) + "..."); } else { row.Add("SubProductName", productInfo.ProductName); } if (string.IsNullOrEmpty(productInfo.ThumbnailUrl40)) { row["ThumbnailUrl40"] = base.CurrentSiteSetting.DefaultProductThumbnail1; } } return(dataGridViewModel); }
protected void Page_Load(object sender, System.EventArgs e) { base.Response.Write("success"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); AlarmNotify alarmNotify = new NotifyClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey).GetAlarmNotify(base.Request.InputStream); if (alarmNotify != null) { AlarmInfo info = new AlarmInfo { AlarmContent = alarmNotify.AlarmContent, AppId = alarmNotify.AppId, Description = alarmNotify.Description }; VShopHelper.SaveAlarm(info); } }
protected void ddlType_SelectedIndexChanged(object sender, System.EventArgs e) { BindType type = (BindType)System.Convert.ToInt32(this.ddlType.SelectedValue); BindType bindType = type; switch (bindType) { case BindType.Key: case BindType.Topic: this.liUrl.Visible = false; this.liValue.Visible = true; break; default: if (bindType != BindType.Url) { this.liUrl.Visible = false; this.liValue.Visible = false; } else { this.liUrl.Visible = true; this.liValue.Visible = false; } break; } switch (type) { case BindType.Key: this.ddlValue.DataSource = from a in ReplyHelper.GetAllReply() where !string.IsNullOrWhiteSpace(a.Keys) select a; this.ddlValue.DataTextField = "Keys"; this.ddlValue.DataValueField = "Id"; this.ddlValue.DataBind(); break; case BindType.Topic: this.ddlValue.DataSource = VShopHelper.Gettopics(); this.ddlValue.DataTextField = "Title"; this.ddlValue.DataValueField = "TopicId"; this.ddlValue.DataBind(); break; } }
private DataGridViewModel <Dictionary <string, object> > GetDataList(FightGroupActivitiyQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { PageModel <FightGroupActivitiyModel> fightGroupActivities = VShopHelper.GetFightGroupActivities(query); dataGridViewModel.rows = new List <Dictionary <string, object> >(); dataGridViewModel.total = fightGroupActivities.Total; foreach (FightGroupActivitiyModel model in fightGroupActivities.Models) { Dictionary <string, object> item = model.ToDictionary(); dataGridViewModel.rows.Add(item); } } return(dataGridViewModel); }
protected void Page_Load(object sender, System.EventArgs e) { this.btnAddMenu.Click += new System.EventHandler(this.btnAddMenu_Click); if (!this.Page.IsPostBack) { this.liValue.Visible = false; this.liUrl.Visible = false; if (base.GetUrlIntParam("pid") == 0) { this.liParent.Visible = false; } else { this.lblParent.Text = VShopHelper.GetMenu(base.GetUrlIntParam("pid")).Name; } } }
private void FightGroupActivities() { int num = this.context.Request["PageIndex"].ToInt(0); int num2 = this.context.Request["PageSize"].ToInt(0); FightGroupActivityQuery fightGroupActivityQuery = new FightGroupActivityQuery(); fightGroupActivityQuery.PageIndex = ((num == 0) ? 1 : num); fightGroupActivityQuery.PageSize = ((num2 == 0) ? 3 : num2); fightGroupActivityQuery.SortBy = "DisplaySequence DESC,FightGroupActivityId"; fightGroupActivityQuery.SortOrder = SortAction.Asc; fightGroupActivityQuery.IsCount = true; PageModel <FightGroupActivitiyModel> fightGroupActivitieLists = VShopHelper.GetFightGroupActivitieLists(fightGroupActivityQuery); List <FightGroupActivitiyModel> dtResult = fightGroupActivitieLists.Models.ToList(); string s = this.BuildFightGroupActivities(dtResult); this.context.Response.Write(s); }
private void BankPaySave_Click(object sender, EventArgs e) { int id = Globals.ToNum(this.HiddenSid.Value); int userId = Globals.ToNum(this.hduserid.Value); string remark = "转账流水号:" + this.bankPayNum.Text; decimal num3 = decimal.Parse(this.hdreferralblance.Value); int num4 = Globals.ToNum("0" + this.hdredpackrecordnum.Value); if (VShopHelper.UpdateBalanceDrawRequest(id, remark)) { decimal referralRequestBalance = num3; if (num4 > 0) { int redPackTotalAmount = DistributorsBrower.GetRedPackTotalAmount(id, 0); referralRequestBalance -= decimal.Parse(redPackTotalAmount.ToString()) / 100M; } if (VShopHelper.UpdateBalanceDistributors(userId, referralRequestBalance)) { if (referralRequestBalance > 0M) { BalanceDrawRequestInfo balanceDrawRequestById = DistributorsBrower.GetBalanceDrawRequestById(id.ToString()); if (balanceDrawRequestById != null) { try { Messenger.SendWeiXinMsg_DrawCashRelease(balanceDrawRequestById); } catch { } } } this.ShowMsg("结算成功", true); this.BindData(); } else { this.ShowMsg("结算失败", false); } } else { this.ShowMsg("结算失败", false); } }
private void btnAddMenu_Click(object sender, EventArgs e) { int urlIntParam = base.GetUrlIntParam("MenuId"); MenuInfo menu = VShopHelper.GetMenu(urlIntParam); menu.Name = this.txtMenuName.Text; menu.Client = ClientType.AliOH; menu.Type = "link"; if (menu.ParentMenuId == 0) { menu.Type = "link"; } else if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || this.ddlType.SelectedValue == "0") { this.ShowMsg("二级菜单必须绑定一个对象", false); return; } menu.Bind = Convert.ToInt32(this.ddlType.SelectedValue); switch (menu.BindType) { case BindType.Url: menu.Content = this.txtUrl.Text.Trim(); break; case BindType.Key: menu.ReplyId = Convert.ToInt32(this.ddlValue.SelectedValue); break; case BindType.Topic: menu.Content = this.ddlValue.SelectedValue; break; default: menu.Content = ""; break; } if (VShopHelper.UpdateMenu(menu)) { base.Response.Redirect("ManageMenu.aspx"); } else { this.ShowMsg("添加失败", false); } }
public void AddMenus(HttpContext context) { context.Response.ContentType = "application/json"; string s = "{\"status\":\"1\"}"; MenuInfo menu = new MenuInfo { Content = context.Request["Content"].Trim(), Name = context.Request["Name"].Trim(), Type = context.Request["Type"], Bind = 8 }; if (menu.Content.EndsWith("/getstorecard/")) { menu.Bind = 9; menu.Type = "click"; } if (context.Request["ParentMenuId"] != null) { menu.ParentMenuId = (context.Request["ParentMenuId"] == "") ? 0 : int.Parse(context.Request["ParentMenuId"]); } else { menu.ParentMenuId = 0; } if (VShopHelper.CanAddMenu(menu.ParentMenuId)) { if (VShopHelper.SaveMenu(menu)) { if (menu.ParentMenuId > 0) { MenuInfo info2 = VShopHelper.GetMenu(menu.ParentMenuId); info2.Bind = 0; info2.Content = ""; VShopHelper.UpdateMenu(info2); } s = "{\"status\":\"0\"}"; } } else { s = "{\"status\":\"2\"}"; } context.Response.Write(s); }
/// <summary> /// 获取轮播图 /// </summary> /// <param name="context"></param> public void GetBanner(System.Web.HttpContext context) { StringBuilder stringBuilder = new StringBuilder(); context.Response.ContentType = "application/json"; int supplierId; if (int.TryParse(context.Request["supplierId"], out supplierId)) { IList <BannerInfo> info = VShopHelper.GetAllBanners(ClientType.PC, supplierId); if (info == null) { stringBuilder.Append("{"); stringBuilder.Append("\"Success\":0"); stringBuilder.Append("}"); this.message = stringBuilder.ToString(); return; } else { stringBuilder.Append("{"); stringBuilder.Append("\"Success\":1"); stringBuilder.Append(","); stringBuilder.Append("\"Banners\":"); string strBanners = Newtonsoft.Json.JsonConvert.SerializeObject(info); stringBuilder.Append(strBanners); stringBuilder.Append("}"); this.message = stringBuilder.ToString(); return; } } else { stringBuilder.Append("{"); stringBuilder.Append("\"Success\":0"); stringBuilder.Append("}"); this.message = stringBuilder.ToString(); return; } }
protected void btnPicDelete_Click(object sender, System.EventArgs e) { TopicInfo topicInfo = VShopHelper.Gettopic(this.topicId); try { ResourcesHelper.DeleteImage(topicInfo.IconUrl); } catch { } topicInfo.IconUrl = (this.imgPic.ImageUrl = null); if (VShopHelper.Updatetopic(topicInfo)) { this.btnPicDelete.Visible = !string.IsNullOrEmpty(this.imgPic.ImageUrl); this.imgPic.Visible = !string.IsNullOrEmpty(this.imgPic.ImageUrl); } }
protected void btnEditBanner_Click(object sender, EventArgs e) { TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id); tplCfgById.IsDisable = false; tplCfgById.ImageUrl = this.fmSrc.Value; tplCfgById.ShortDesc = this.txtNavigateDesc.Text; tplCfgById.LocationType = (LocationType)Enum.Parse(typeof(LocationType), this.ddlType.SelectedValue); tplCfgById.Url = this.locationUrl.Value; if (VShopHelper.UpdateTplCfg(tplCfgById)) { this.CloseWindow(); } else { this.ShowMsg("修改失败!", false); } }
protected void BindMaterial() { WhoKnowMeQuery page = new WhoKnowMeQuery { PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, SortBy = "StartDate", SortOrder = SortAction.Desc }; DbQueryResult WKMList = VShopHelper.GetWKMList(page); //如果当前人已经设置了答案,并且活动id重复,则不允许重复答题, 直接刷新页面跳到type2 this.rpWhoKnowMe.DataSource = WKMList.Data; this.rpWhoKnowMe.DataBind(); this.pager.TotalRecords = WKMList.TotalRecords; }
private void CancelHomePage(HttpContext context) { int num = context.Request["topicId"].ToInt(0); if (num <= 0) { throw new HidistroAshxException("错误的参数"); } if (VShopHelper.CancelHomePage(num)) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); masterSettings.HomePageTopicId = 0; SettingsManager.Save(masterSettings); base.ReturnSuccessResult(context, "取消成功", 0, true); return; } throw new HidistroAshxException("取消失败"); }
protected void Lksave_Click(object sender, EventArgs e) { foreach (RepeaterItem item in this.rpTopic.Items) { int result = 0; TextBox box = (TextBox)item.FindControl("txtSequence"); if (int.TryParse(box.Text.Trim(), out result)) { Label label = (Label)item.FindControl("Lbtopicid"); int topicId = Convert.ToInt32(label.Text); if (VShopHelper.Gettopic(topicId).DisplaySequence != result) { VShopHelper.SwapTopicSequence(topicId, result); } } } this.BindTopicList(); }
private void BindProduct() { FightGroupActivityInfo fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId); this.productId = ((this.productId == 0) ? fightGroupActivitieInfo.ProductId : this.productId); this.rptProductSkus.DataSource = VShopHelper.GetFightGroupSkus(this.fightGroupActivityId, this.productId); this.rptProductSkus.DataBind(); IList <int> list = null; Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >); ProductInfo productDetails = ProductHelper.GetProductDetails(this.productId, out dictionary, out list); if (productDetails != null) { this.ltProductName.Text = productDetails.ProductName; this.ltStock.Text = productDetails.Stock.ToString(); this.lblPrice.Text = productDetails.MinSalePrice.F2ToString("f2"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest Request = context.Request; string userid = Request.Form["userid"]; int status = int.Parse(Request.Form["status"]); if (string.IsNullOrEmpty(userid)) { context.Response.Write("error"); return; } VShopHelper.SetDistributorStatus(int.Parse(userid), status); context.Response.Write("success"); }
private void Bind() { DistributorsInfo userIdDistributors = VShopHelper.GetUserIdDistributors(int.Parse(this.Page.Request.QueryString["UserId"])); if (userIdDistributors != null) { this.txtStoreName.Text = userIdDistributors.StoreName; this.txtStoreDescription.Text = userIdDistributors.StoreDescription; this.DrStatus.SelectedValue = userIdDistributors.ReferralStatus.ToString(); this.DrAgentGrade.DataBind(); int grade = DistributorsBrower.GetDistributorInfo(int.Parse(this.Page.Request.QueryString["UserId"])).AgentGradeId; DrAgentGrade.SelectedIndex = grade - 1; } else { this.ShowMsg("店铺不存在!", false); } }
protected void btnAddBanner_Click(object sender, System.EventArgs e) { if (this.id == 0) { TplCfgInfo tplCfgInfo = new BannerInfo(); tplCfgInfo.IsDisable = false; tplCfgInfo.ImageUrl = this.fmSrc.Value; tplCfgInfo.ShortDesc = this.txtBannerDesc.Text; tplCfgInfo.Client = (int)ClientType.PC; tplCfgInfo.LocationType = (LocationType)System.Enum.Parse(typeof(LocationType), this.ddlType.SelectedValue); tplCfgInfo.Url = this.locationUrl.Value; tplCfgInfo.SupplierId = supplierId; if (string.IsNullOrWhiteSpace(tplCfgInfo.ImageUrl)) { this.ShowMsg("请上传图片!", false); return; } if (VShopHelper.SaveTplCfg(tplCfgInfo)) { this.CloseWindow(); return; } this.ShowMsg("添加错误!", false); } else { TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id); tplCfgById.IsDisable = false; tplCfgById.ImageUrl = this.fmSrc.Value; tplCfgById.ShortDesc = this.txtBannerDesc.Text; tplCfgById.Client = 3; tplCfgById.LocationType = (LocationType)System.Enum.Parse(typeof(LocationType), this.ddlType.SelectedValue); tplCfgById.Url = this.locationUrl.Value; tplCfgById.SupplierId = HiContext.Current.User.UserId; if (VShopHelper.UpdateTplCfg(tplCfgById)) { this.CloseWindow(); return; } this.ShowMsg("修改失败!", false); } }
private ListResult <IconListItem> GetIcon(int siteId) { ListResult <IconListItem> data = null; if (base.IsUseCache) { data = MemoryCacher.GetValue("SITE-ICON") as ListResult <IconListItem>; if (data != null) { return(data); } } IList <IconInfo> list = VShopHelper.GetAllIcon(ClientType.App); List <IconListItem> items = new List <IconListItem>(); if (list != null) { IconListItem item = null; foreach (var current in list) { item = new IconListItem(); item.Title = current.ShortDesc; item.ImageUrl = Util.AppendImageHost(current.ImageUrl); item.DisplaySequence = current.DisplaySequence; items.Add(item); } } data = new ListResult <IconListItem>(); data.TotalNumOfRecords = items.Count;; data.Results = items; if (base.IsUseCache) { MemoryCacher.Add("SITE-ICON", data, DateTimeOffset.UtcNow.AddMinutes(SITE_CACHE_KEEP_TIME)); } return(data); }
protected void Page_Load(object sender, System.EventArgs e) { base.Response.Write("success"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); FeedBackNotify feedBackNotify = new NotifyClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey).GetFeedBackNotify(base.Request.InputStream); if (feedBackNotify != null) { string msgType = feedBackNotify.MsgType; if (msgType != null) { if (!(msgType == "request")) { if (msgType == "confirm") { feedBackNotify.MsgType = "已完成"; } } else { feedBackNotify.MsgType = "未处理"; } } if (VShopHelper.GetFeedBack(feedBackNotify.FeedBackId) != null) { VShopHelper.UpdateFeedBackMsgType(feedBackNotify.FeedBackId, feedBackNotify.MsgType); } else { FeedBackInfo info = new FeedBackInfo { AppId = feedBackNotify.AppId, ExtInfo = feedBackNotify.ExtInfo, FeedBackId = feedBackNotify.FeedBackId, MsgType = feedBackNotify.MsgType, OpenId = feedBackNotify.OpenId, Reason = feedBackNotify.Reason, Solution = feedBackNotify.Solution, TransId = feedBackNotify.TransId }; VShopHelper.SaveFeedBack(info); } } }
public void GetTopMenus(HttpContext context) { context.Response.ContentType = "application/json"; string s = "{"; IList <MenuInfo> topMenus = VShopHelper.GetTopMenus(); if (topMenus.Count <= 0) { s = s + "\"status\":\"-1\""; } else { object obj2 = s; s = string.Concat(new object[] { obj2, "\"status\":\"0\",\"shopmenustyle\":\"0\",\"enableshopmenu\":\"", true, "\",\"data\":[" }); foreach (MenuInfo info in topMenus) { IList <MenuInfo> menusByParentId = VShopHelper.GetMenusByParentId(info.MenuId); object obj3 = s; s = string.Concat(new object[] { obj3, "{\"menuid\": \"", info.MenuId, "\"," }); s = s + "\"childdata\":["; if (menusByParentId.Count > 0) { foreach (MenuInfo info2 in menusByParentId) { object obj4 = s; s = string.Concat(new object[] { obj4, "{\"menuid\": \"", info2.MenuId, "\"," }); object obj5 = s; s = string.Concat(new object[] { obj5, "\"parentmenuid\": \"", info2.ParentMenuId, "\"," }); s = s + "\"type\": \"" + info2.Type + "\","; s = s + "\"name\": \"" + Globals.String2Json(info2.Name) + "\","; s = s + "\"content\": \"" + Globals.String2Json(info2.Content) + "\"},"; } s = s.Substring(0, s.Length - 1); } s = s + "],"; s = s + "\"type\": \"" + info.Type + "\","; s = s + "\"name\": \"" + Globals.String2Json(info.Name) + "\","; s = s + "\"shopmenupic\": \"\","; s = s + "\"content\": \"" + Globals.String2Json(info.Content) + "\"},"; } s = s.Substring(0, s.Length - 1) + "]" + "}"; context.Response.Write(s); } }
public string SetDistributors(string ids, int rid) { ids = ids.TrimEnd(new char[] { ',' }); if (string.IsNullOrEmpty(ids)) { return("请先选择要修改分销商的用户!"); } if (VShopHelper.IsExistUsers(ids) > 0) { return("选中会员中有分销商,分销商上下级调整请到栏目“分销->分销商列表”中设置!"); } int num = MemberHelper.SetRegions(ids, rid); if (num > 0) { return(string.Format("success", num)); } return("设置失败"); }
public void delmenu(HttpContext context) { context.Response.ContentType = "application/json"; string s = "{\"status\":\"1\"}"; int result = 0; if (!int.TryParse(context.Request["MenuId"], out result)) { s = "{\"status\":\"1\"}"; } else { if (VShopHelper.DeleteMenu(result)) { s = "{\"status\":\"0\"}"; } context.Response.Write(s); } }
private ListResult <BannerListItem> GetCurrentRegisterBanner(int siteId) { ListResult <BannerListItem> data = null; if (base.IsUseCache) { data = MemoryCacher.GetValue("SITE-REGISTERBANNER") as ListResult <BannerListItem>; if (data != null) { return(data); } } IList <BannerInfo> allBanners = VShopHelper.GetAllBanners(ClientType.App); BannerInfo registerBanner = allBanners.Where(m => m.LocationType == LocationType.Register).FirstOrDefault(); List <BannerListItem> items = new List <BannerListItem>(); if (registerBanner != null) { BannerListItem item = new BannerListItem(); item.Id = registerBanner.BannerId; item.Title = registerBanner.ShortDesc; item.ImageUrl = Util.AppendImageHost(registerBanner.ImageUrl); item.BannerType = (int)registerBanner.LocationType; item.Values = registerBanner.Url; item.DisplaySequence = registerBanner.DisplaySequence; items.Add(item); } data = new ListResult <BannerListItem>(); data.TotalNumOfRecords = items.Count; data.Results = items; if (base.IsUseCache) { MemoryCacher.Add("SITE-REGISTERBANNER", data, DateTimeOffset.UtcNow.AddMinutes(SITE_CACHE_KEEP_TIME)); } return(data); }
private void BtnSave_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <MenuInfo> initMenus = VShopHelper.GetInitMenus(); Hishop.Weixin.MP.Domain.Menu.Menu menu = new Hishop.Weixin.MP.Domain.Menu.Menu(); foreach (MenuInfo current in initMenus) { if (current.Chilren == null || current.Chilren.Count == 0) { menu.menu.button.Add(this.BuildMenu(current)); } else { SubMenu subMenu = new SubMenu { name = current.Name }; foreach (MenuInfo current2 in current.Chilren) { subMenu.sub_button.Add(this.BuildMenu(current2)); } menu.menu.button.Add(subMenu); } } string json = JsonConvert.SerializeObject(menu.menu); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret)) { base.Response.Write("<script>alert('您的服务号配置存在问题,请您先检查配置!');location.href='wxconfig.aspx'</script>"); return; } string text = TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret); text = JsonConvert.DeserializeObject <Token>(text).access_token; string text2 = MenuApi.CreateMenus(text, json); if (text2.Contains("\"ok\"")) { this.ShowMsg("自定义菜单已同步到微信,24小时内生效!", true); return; } this.ShowMsg("操作失败!服务号配置信息错误或没有微信自定义菜单权限", false); }
public IHttpActionResult GetRegisterBanner(int siteId, string accessToken, int channel, int platform, string ver) { // 保存访问信息 base.SaveVisitInfo(siteId, "", channel, platform, ver); // 验证令牌 string appId = ""; int accessTookenCode = VerifyAccessToken(accessToken, out appId); if (accessTookenCode > 0) { return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Site.AppBanner")); } ListResult <BannerListItem> data = null; IList <BannerInfo> allBanners = VShopHelper.GetAllBanners(ClientType.App); BannerInfo registerBanner = allBanners.Where(m => m.LocationType == LocationType.Register).FirstOrDefault(); List <BannerListItem> items = new List <BannerListItem>(); if (registerBanner != null) { BannerListItem item = new BannerListItem(); item.Id = registerBanner.BannerId; item.Title = registerBanner.ShortDesc; item.ImageUrl = Util.AppendImageHost(registerBanner.ImageUrl); item.BannerType = (int)registerBanner.LocationType; item.Values = registerBanner.Url; item.DisplaySequence = registerBanner.DisplaySequence; items.Add(item); } data = new ListResult <BannerListItem>(); data.TotalNumOfRecords = items.Count; data.Results = items; return(base.JsonActionResult(new StandardResult <ListResult <BannerListItem> >() { code = 0, msg = "", data = data })); }