protected void Page_Load(object sender, EventArgs e) { if (Session["isLogin"] == null || Session["isLogin"].ToString() == "false") { Response.Redirect("login.aspx?rdUrl=newUser.aspx"); } moyu.User.Functions myFunctions = new User.Functions(); if (myFunctions.getPoint(Convert.ToInt32(Session["id"]))["hasNewPoint"].ToString() == "False") { Response.Write("<script>alert(\"你已经感谢过别人了\\n快去介绍别人来左邻为自己赚贡献吧~\\n\\nPS:贡献可是很珍贵的。\");</script>"); } }
/// <summary> /// 用户获取优惠券 /// </summary> /// <param name="uid">用户编号</param> /// <param name="cid">优惠券编号</param> /// <returns>状态码</returns> public int getCoupons(int uid, int cid) { User.Functions myFunctions = new User.Functions(); Hashtable theCoupons = new Hashtable(); Hashtable thePoint = new Hashtable(); theCoupons = couponsGet(cid); thePoint = myFunctions.getPoint(uid); int needPoint=Convert .ToInt32(theCoupons["needPoint"]); if (Convert.ToInt32(theCoupons["number"]) < 1) { return -10; } if (isHaveCoupon(uid, cid)) { return 0; //已经拥有优惠券 } if (Convert.ToDateTime(theCoupons["endTime"]) < DateTime.Now) { return -1; //已经过期 } if (Convert.ToInt32(theCoupons["pointType"]) == 1 && needPoint > Convert.ToInt32(thePoint["point"])) { return -2; //积分不足 } if (Convert.ToInt32(theCoupons["pointType"]) == 2 && needPoint > Convert.ToInt32(thePoint["contribute"])) { return -3; //贡献不足 } else { myFunctions.userPointChange(uid, (needPoint * -1), "兑换优惠券消耗积分/贡献", Convert.ToInt32(theCoupons["pointType"]) == 1?1:2); Hashtable inQuery = new Hashtable(); Random rd = new Random(); string no = rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); no += rd.Next(0, 9).ToString(); inQuery["@uid"] = uid; inQuery["@cid"] = cid; inQuery["@no"] = no; myDb.ExecNoneQuery("ecard_union_coupons_setHave", inQuery); } return 1; //成功 }
/// <summary> /// 用户文字签到 /// </summary> /// <param name="userData">用户信息</param> /// <returns>返回信息</returns> private Hashtable[] funcSigin(Hashtable userData) { moyu.User.Functions myFunctions = new User.Functions(); int uid = getWeiUserId(userData["@FromUserName"].ToString()); int siginId = myFunctions.signIn(uid); StringBuilder strBody = new StringBuilder(); Hashtable points = new Hashtable(); points = myFunctions.getPoint(uid); strBody.Append(myFunctions.isSigIn(uid) ? "签到成功," : "签到失败,"); strBody.Append("连续签到" + points["signInDays"] + "天,"); strBody.Append("积分:" + points["point"] + ","); strBody.Append("贡献:" + points["contribute"] + " 。点我去首页"); Hashtable[] rt = new Hashtable[2]; rt[0] = new Hashtable(); rt[0]["id"] = 0; rt[0]["messageType"] = 2; rt[0]["title"] = strBody; rt[0]["body"] = strBody; rt[0]["picSmall"] = getPicUrl(false); rt[0]["picBig"] = getPicUrl(true); rt[0]["url"] = "http://www.ai0932.com/mobile/index.aspx"; rt[0]["orders"] = 90; rt[1] = new Hashtable(); rt[1]["id"] = 0; rt[1]["messageType"] = 2; rt[1]["title"] = "今天心情怎么样?点这里记录每天的心情"; rt[1]["body"] = "今天心情怎么样?点这里记录每天的心情"; rt[1]["picSmall"] = getPicUrl(false); rt[1]["picBig"] = getPicUrl(true); rt[1]["url"] = "http://www.ai0932.com/mobile/addPicIntroduce.aspx?tid=" + siginId + "&pid=0"; rt[1]["orders"] = 80; return rt; }
public void getContent() { StringBuilder sb = new StringBuilder(); string userName = ""; Hashtable userPoint=new Hashtable(); moyu.User.Functions myFunction=new User.Functions(); string bodyClass = ""; moyu.Functions myOtherFunction = new Functions(); foreach (Hashtable p in posts) { userPoint=myFunction.getPoint( Convert .ToInt32(p["uid"])); if (p["tag"].ToString() == "秘密") { userName = "******"; } else { userName = (p["niceName"].ToString() == "" ? "匿名用户" : p["niceName"].ToString()); userName = "******"weixin://profile/" + p["weixinId"] + "\" class=\"" + (Convert.ToInt32(userPoint["signInDays"]) > 15 ? "red" : "") + "\">" + userName + "</a>"; } bodyClass = Convert.ToBoolean(p["isElite"]) ? "f" : "c"; bodyClass = p["tag"].ToString() == "秘密" ? "e" : bodyClass; sb.Append("<li data-id=\"" + p["id"] + "\" class=\"postItem ui-body ui-body-" + bodyClass + "\">"); sb.Append("<h2 class=\"group-post-info clear\" style=\"text-indent:0;\">"); if (Convert.ToBoolean(p["isElite"])) { sb.Append("<span class=\"left group-post-info-tag group_tag_4\">精华</span>"); } if (Convert.ToBoolean(p["isTop"])) { sb.Append("<span class=\"left group-post-info-tag group_tag_9\">置顶</span>"); } sb.Append("<span class=\"left group-post-info-tag group_tag_"+p["id"].ToString().Substring(p["id"].ToString().Length-1)+"\">" + p["tag"] + "</span>"); sb.Append("<span class=\"left group-post-info-user\">"); sb.Append(userName); sb.Append("</span><span class=\"right group-post-info-date\">"); sb.Append( myOtherFunction.kindTime(Convert.ToDateTime( p["postDate"]))); sb.Append("</span></h2>"); sb.Append(p["body"].ToString().Replace("src=\"upload/images", "src=\"http://www.ai0932.com/upload/images")); sb.Append("<div class=\"group-post-functions\">"); sb.Append("<a class=\"viewComments\" href=\"javascript:void(0)\">评论(" + p["commentsCount"] + ")</a>"); sb.Append("<a class=\"shareThisItem\" href=\"javascript:void(0)\" onclick=\"weixinShare('" + p["title"] + "','真是太有意思啦','http://www.ai0932.com/Mobile/post-show.aspx?type=g&id=" + p["id"] + "');\">分享</a>"); if (power > 0) { if (Convert.ToInt32(p["gid"]) == -10) { sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=back&tid=" + p["id"] + "\">恢复</a>"); } else { sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=del&tid=" + p["id"] + "\">删</a>"); } if (Convert.ToBoolean(p["isElite"])) { sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=delElite&tid=" + p["id"] + "\">消精</a>"); } else { sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=addElite&tid=" + p["id"] + "\">加精</a>"); } } if (power > 5) { if (Convert.ToBoolean(p["isTop"])) { sb.Append("<a class=\"goTop\" target=\"_self\" href=\"../Services/Information_group.ashx?action=delTop&tid=" + p["id"] + "\">消顶</a>"); } else { sb.Append("<a class=\"goTop\" target=\"_self\" href=\"../Services/Information_group.ashx?action=addTop&tid=" + p["id"] + "\">置顶</a>"); } } else { sb.Append("<a class=\"goTop\" target=\"_self\" href=\"#\">顶部</a>"); } sb.Append("</div>"); sb.Append("</li>"); } Response.Write(sb); }