/// <summary> /// DeletePK产品 /// </summary> private void DelPK() { int id = CRequest.GetInt("id", 0); if (Session["PK1"] != null) { Product item = Session["PK1"] as Product; if (item.id == id) { Session["PK1"] = null; } Product item2 = Session["PK2"] as Product; if (item2 != null && item2.id == id) { Session["PK2"] = null; } } else { Product item = Session["PK2"] as Product; if (item.id == id) { Session["PK2"] = null; } } Response.Write("success"); }
protected void Page_Load(object sender, EventArgs e) { string auth = CRequest.GetString("auth"); int type = CRequest.GetInt("type"); if (!IsPostBack && auth == "1") { string reurl = ""; //传递参数,获取用户信息后,可跳转到自己定义的页面,想怎么处理就怎么处理 if (Request.QueryString["reurl"] != null && Request.QueryString["reurl"] != "") { reurl = Request.QueryString["reurl"].ToString(); } else { reurl = host + "/html/custom/custom_join.html"; } //弹出授权页面(如在不弹出授权页面基础下未获得openid,则弹出授权页面,提示用户授权) if (Request.QueryString["auth"] != null && Request.QueryString["auth"] != "" && Request.QueryString["auth"] == "1") { Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + Server.UrlEncode(host + "/SSXXRedirect.aspx?type=" + type + "&reurl=" + reurl) + "&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect"); } else { //不弹出授权页面 Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + Server.UrlEncode(host + "/wechat/SSXXRedirect.aspx?type=" + type + "&reurl=" + reurl) + "&response_type=code&scope=snsapi_base&state=1#wechat_redirect"); } } }
/// <summary> /// 商圈I am a下的产品 /// </summary> private void Business() { int newsType = CRequest.GetInt("typeId", 0); StringBuilder sb = new StringBuilder(); DataSet ds = NewsService.GetList(10, "newsType = " + newsType + " and is_tj = 1 and newImg <> ''", "id"); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { sb.Append("<div class=\"liebiao\"><b class=\"liebiao_newb\"></b><strong class=\"liebiao_newst\"></strong>"); sb.Append("<a href=\"/businessDetail_" + dr["id"] + ".html\"><p class=\"tup\"><img src=\"" + dr["newImg"] + "\" alt=\"" + dr["title"] + "\" />"); sb.Append("<p class=\"neirong\"><i></i><span>"); if (dr["title"].ToString().Length > 10) { sb.Append(dr["title"].ToString().Substring(0, 10)); } else { sb.Append(dr["title"].ToString()); } sb.Append("</span></p></p></a></div>"); } } Response.Write(sb.ToString()); }
/// <summary> /// 分享更新 /// </summary> private void Share() { int id = CRequest.GetInt("id", 0); //int num = NewsService.Share(id); Response.Write("success"); }
/// <summary> /// Delete管理员 /// </summary> private void DelAdmin() { int id = CRequest.GetInt("id", 0); int num = AdminUserService.Delete(id); Response.Redirect("/admin/manager.aspx?delAdmin=" + num); }
/// <summary> /// Delete图片集图片 /// </summary> private void CheckDelImg() { int id = CRequest.GetInt("id", 0); int num = ProductImgService.DeleteById(id); Response.Write("success"); }
/// <summary> /// 修改连接信息 /// </summary> private void ModLink() { int id = CRequest.GetInt("id", 0); string name = CRequest.GetString("name"); string title = CRequest.GetString("title"); string path = CRequest.GetString("path"); int place = CRequest.GetInt("place", 0); Links item = LinksService.GetModel(id); if (item != null) { item.linkname = name; item.linktitle = title; item.linkurl = path; item.istj = place; int num = LinksService.Update(item); if (num > 0) { Response.Write("success"); } else { Response.Write("fail"); } } }
/// <summary> /// 资讯的浏览量 /// </summary> private void UpdateViews() { int typeId = CRequest.GetInt("typeId", 0); string pageName = CRequest.GetString("pageName"); string pageValue = CRequest.GetString("pageValue"); //Pv统计 #region Pv pv = new Pv(); pv.pageName = pageName; pv.pageValue = pageValue; pv.viewsCount = 1; string sUserAgent = Request.UserAgent.ToLower(); bool bIsIpad = Regex.IsMatch(sUserAgent, "ipad"); bool bIsIphoneOs = Regex.IsMatch(sUserAgent, "iphone"); bool bIsAndroid = Regex.IsMatch(sUserAgent, "android"); bool bIsWP = Regex.IsMatch(sUserAgent, "windows phone"); if (bIsAndroid || bIsIphoneOs || bIsIpad || bIsWP) { pv.viewsCount = 2; } pv.addTime = DateTime.Now; pv.ip = IpSearch.GetIp(); pv.status = 0; pv.remark = ""; pv.infoType = typeId; UserInfo user = Session["user"] as UserInfo; if (user != null) { pv.status = user.id; pv.remark = user.mobile; } PvService.Add(pv); #endregion }
/// <summary> /// 启用/停用管理员 /// </summary> private void UseAdmin() { int id = CRequest.GetInt("id", 0); int status = CRequest.GetInt("status", 0); int num = AdminUserService.UseAdmin(id, status); Response.Redirect("/admin/manager.aspx?useAdmin=" + num); }
/// <summary> /// Delete连接 /// </summary> private void DelLink() { int id = CRequest.GetInt("id", 0); int num = LinksService.Delete(id); if (num > 0) { Response.Redirect("/admin/link.aspx"); } }
/// <summary> /// Delete公告 /// </summary> private void DelGongGao() { int id = CRequest.GetInt("id", 0); int num = GongGaoInfoService.Delete(id); if (num > 0) { Response.Redirect("/admin/gonggao.aspx"); } }
/// <summary> /// Delete信息 /// </summary> private void DeleteInfo() { int id = CRequest.GetInt("id", 0); int num = NewsService.Delete(id); if (num > 0) { Response.Redirect("/admin/infoList.aspx"); //Jscript.AlertAndRedirect("Delete成功",""); } }
protected void Page_Load(object sender, EventArgs e) { int wxType = CRequest.GetInt("type"); string wxReurl = CRequest.GetString("reurl"); string wxCode = CRequest.GetString("code"); if (!Page.IsPostBack) { if (wxCode != "") { //获取全局token if (!WxLoginBLL.SaveXMLByApplactionToken()) { Log.WriterLog("获取全局token失败"); } WxAccessToken wx = WxLoginBLL.GetToken(wxCode); if (wx.openid != null) { WxUserInfo userInfo = WxLoginBLL.GetWxUserInfo(wx, wxCode); if (userInfo.openid != null) { object obj; WxUserInfoBLL uill = new WxUserInfoBLL(); uill.CheckUserInfo(userInfo); List <WxUserInfo> users = uill.QueryUserInfoByID(wx.openid); if (users != null && users.Count > 0) { string openId = CTools.SetOpenId(users[0].openid); obj = new { userid = users[0].u_id, openid = openId, token = CTools.GetMD5FromString(users[0].u_id + openId + "SSXXCJYXGS") }; Session["UserInfo"] = users[0]; Cookies.SetCookie("UserInfo", JsonHelper.ObjToJsonString <object>(obj), 90); Response.Redirect(WxConfig.WxHost); } } else { Response.Write("获取用户信息失败"); } } else { Response.Write("获取用户token失败"); } } } }
/// <summary> /// 催乳师认证 /// </summary> private void User2Credit() { int id = CRequest.GetInt("id", 0); int type = CRequest.GetInt("num", 0); int num = UserInfoService.CreditUser(id, type); if (num > 0) { Response.Write("success"); } else { Response.Write("fail"); } }
/// <summary> /// 更新资讯的浏览次数 /// </summary> private void updateViewsCount() { int id = CRequest.GetInt("id", 0); NewsService.UpdateViews(id); News item = NewsService.GetModel(id); if (item != null) { Response.Write(item.res_views); } else { Response.Write("0"); } }
/// <summary> /// 设置产品属性赞 /// </summary> private void SetGoods() { int id = CRequest.GetInt("pid", 0); int num = CRequest.GetInt("num", 0); int row = ProductGoodsService.SetGoods(num, id); if (row > 0) { int goods = ProductGoodsService.GetGoods(num, id); Response.Write(goods.ToString()); } else { Response.Write("0"); } }
/// <summary> /// 设置PK对象 /// </summary> private void AddPK() { int id = CRequest.GetInt("id", 0); if (Session["PK1"] != null && Session["PK2"] != null) { Response.Write("full"); return; } else { Product item = ProductService.GetModel(id); if (Session["PK1"] == null) { if (Session["PK2"] != null) { Product item2 = Session["PK2"] as Product; if (item.id == item2.id) { Response.Write("exists"); return; } } if (item != null) { Session["PK1"] = item; } } else { Product item2 = Session["PK1"] as Product; if (item2.id == item.id) { Response.Write("exists"); return; } if (Session["PK2"] == null) { if (item != null) { Session["PK2"] = item; } } } } Response.Write("success"); }
/// <summary> /// 回复评价信息 /// </summary> private void ReplyComment() { UserInfo user = Session["user"] as UserInfo; if (user == null) { Response.Write("login"); } else { int id = CRequest.GetInt("id", 0); string replyContent = CRequest.GetString("replyContent"); Reply item = new Reply(); item.commentId = id; Comment comItem = CommentService.GetModel(id); if (comItem.addUser == user.id) { Response.Write("self"); return; } item.replyContent = replyContent; item.status = 0; item.remark = ""; item.addTime = DateTime.Now; item.addUser = user.id; item.infoType = 0; int num = ReplyService.Add(item); StringBuilder sb = new StringBuilder(); if (num > 0) { DataSet ds = ReplyService.GetList("commentId = " + id); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { UserInfo replyUser = UserInfoService.GetModel(Convert.ToInt32(dr["addUser"])); if (replyUser != null) { sb.Append(replyUser.username + ":" + dr["replyContent"].ToString() + "<br/>"); } } } } Response.Write(sb.ToString()); } }
/// <summary> /// 发布资讯 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRelease_Click(object sender, EventArgs e) { if (Session["loginUser"] == null) { Jscript.AlertAndRedirect("请登录", "/admin/login.aspx"); return; } if (newsId != 0) { TopNews item = new TopNews(); item.newsId = newsId; item.newsType = CRequest.GetInt("newsType", 0); item.imgURL = ""; if (ViewState["newsImg1"] != null) { item.imgURL = ViewState["newsImg1"].ToString(); } else { item.imgURL = ""; } item.baseInfo = txtZhaiYao.Text.Trim(); item.orderNum = 0; item.status = 0; item.remark = txtTitle.Text.Trim(); item.addtime = DateTime.Now; item.adduser = (Session["loginUser"] as AdminUser).id; item.infoType = 0; if (item.imgURL == "" || item.baseInfo == "") { this.lblError.Text = "请填写信息内容并上传图片"; return; } if (item.baseInfo.Length > 500) { this.lblError.Text = "信息内容不能超过500字"; return; } int num = TopNewsService.Add(item); if (num > 0) { NewsService.UpdateTop(item.newsId, 1); Response.Redirect("infoList.aspx"); } else { lblError.Text = "设置置顶失败"; } } if (id != 0) { TopNews item = TopNewsService.GetModel(id); if (item != null) { item.imgURL = ""; if (ViewState["newsImg1"] != null) { item.imgURL = ViewState["newsImg1"].ToString(); } else { item.imgURL = ""; } item.remark = txtTitle.Text.Trim(); item.baseInfo = txtZhaiYao.Text.Trim(); int num = TopNewsService.Update(item); if (num > 0) { Response.Redirect("topInfoList.aspx"); } else { lblError.Text = "修改失败"; } } } }