示例#1
0
 private void getMore()
 {
     string tag;
     Hashtable[] posts;
     int last = Convert.ToInt32(theContext.Request.Form["last"]);
     switch (theContext.Request.Form["type"].ToString())
     {
         case "tag":
             tag = HttpUtility.UrlDecode(theContext.Request.Params["tag"].ToString());
             posts = myGroup.postGetByTat(tag, last, 15);
             break;
         case "group":
             tag = theContext.Request.Params["tag"];
             posts = myGroup.topicGet(Convert.ToInt32(tag), last, 15);
             break;
         case "user":
             tag = theContext.Session["niceName"].ToString() + "发表的内容";
             posts = myGroup.postGetByUser(Convert.ToInt32(theContext.Session["id"]), last, 15);
             break;
         case "atMe":
             tag = "@" + theContext.Session["niceName"].ToString();
             posts = myGroup.postGetByMessage(Convert.ToInt32(theContext.Session["id"]), last, 15);
             break;
         case "elite":
             tag = "精华帖子";
             posts = myGroup.postGetByElite(last, 15);
             break;
         default:
             posts=null;
             break;
     }
     StringBuilder sb = new StringBuilder();
     string userName = "";
     Hashtable userPoint = new Hashtable();
     moyu.User.Functions myFunction = new moyu.User.Functions();
     string bodyClass = "";
     int power = Convert.ToInt32(theContext.Session["power"]);
     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>");
     }
     theContext.Response.Write(sb);
 }
示例#2
0
 private void delElite()
 {
     int tid = Convert.ToInt32(theContext.Request.Params["tid"]);
     Hashtable thePost = new Hashtable();
     thePost = myGroup.topicGetById(tid);
     if (Convert.ToBoolean(thePost["isElite"]) && Convert.ToInt32(theContext.Session["power"]) > 0)
     {
         myGroup.topicSetElite(tid, false);
         moyu.User.Functions myFunction = new moyu.User.Functions();
         string comment = "该帖已被管理取消精华,您扣除了一个贡献";
         myFunction.userPointChange(Convert.ToInt32(thePost["uid"]), -1, "帖子取消精华扣除贡献", 2);
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), Convert.ToInt32(thePost["uid"]), comment, -2, tid);//通知被删帖人
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), Convert.ToInt32(theContext.Session["id"]), comment, -2, tid);//通知操作管理
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), 1, comment, -2, tid);//通知大管理
         myGroup.commentNew(Convert.ToInt32(theContext.Session["id"]), tid, comment);
     }
     theContext.Response.Redirect("~/Mobile/robot-group-kewWordsShow.aspx?type=group&tag=-1");
 }
示例#3
0
 private void delTop()
 {
     int tid = Convert.ToInt32(theContext.Request.Params["tid"]);
     Hashtable thePost = new Hashtable();
     thePost = myGroup.topicGetById(tid);
     if (Convert.ToBoolean(thePost["isTop"]) == true && Convert.ToInt32(theContext.Session["power"]) > 5)
     {
         myGroup.topicSetTop(tid, false);
         moyu.User.Functions myFunction = new moyu.User.Functions();
         string comment = "该帖已被管理取消置顶";
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), Convert.ToInt32(thePost["uid"]), comment, -2, tid);//通知被置顶人
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), Convert.ToInt32(theContext.Session["id"]), comment, -2, tid);//通知操作管理
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), 1, comment, -2, tid);//通知大管理
         myGroup.commentNew(Convert.ToInt32(theContext.Session["id"]), tid, comment);
     }
     theContext.Response.Redirect("~/Mobile/robot-group-kewWordsShow.aspx?type=group&tag=-1");
 }
示例#4
0
 private void del()
 {
     int tid = Convert .ToInt32(theContext.Request.Params["tid"]);
     Hashtable thePost = new Hashtable();
     thePost = myGroup.topicGetById(tid);
     if (Convert.ToInt32(thePost["gid"]) == -1 && Convert.ToInt32(theContext.Session["power"]) > 0)
     {
         string comment="您发表的帖子由于违反了贴吧发帖规范而被删除,为了给大家一个良好的社区环境,要自觉遵守贴吧发帖规范哦~如有疑问,请在本贴回复我。";
         moyu.User.Functions myFunction = new moyu.User.Functions();
         myFunction.userPointChange(Convert.ToInt32(thePost["uid"]), -2, "删帖回收积分", 3);
         myFunction.sendMessage(Convert .ToInt32(theContext.Session["id"]), Convert .ToInt32(thePost["uid"]), comment, -2, tid);//通知被删帖人
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), Convert.ToInt32(theContext.Session["id"]), comment, -2, tid);//通知操作管理
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), 1, comment, -2, tid);//通知大管理
         myGroup.commentNew(Convert.ToInt32(theContext.Session["id"]), tid,comment );
         myGroup.updatePost(tid, thePost["body"].ToString(), thePost["title"].ToString(), thePost["tag"].ToString(), -10);
     }
     theContext.Response.Redirect("~/Mobile/robot-group-kewWordsShow.aspx?type=group&tag=-1");
 }
示例#5
0
 private void commentNew()
 {
     int uid =theContext.Session["id"]!=null? Convert.ToInt32(theContext.Session["id"]):0;
     int tid = Convert.ToInt32(theContext.Request.Form["tid"]);
     string comment = theContext.Request.Form["comment"];
     Hashtable thePost = new Hashtable();
     moyu.User.Functions myFunction = new moyu.User.Functions();
     thePost = myGroup.topicGetById(tid);
     int atUid = Convert.ToInt32(theContext.Request.Form["atUid"]);
     if (Convert.ToInt32(thePost["uid"]) != atUid && atUid != 0)
     {
         myFunction.sendMessage(uid, atUid, comment, -2, tid);
     }
     if (Convert.ToInt32(thePost["uid"]) != 0 && uid != Convert.ToInt32(thePost["uid"]))
     {
         myFunction.sendMessage(uid, Convert.ToInt32(thePost["uid"]), comment, -2, tid);
     }
     myGroup.commentNew(uid, tid, comment);
     if (Convert.ToInt32(thePost["gid"]) == -1 && uid!=0)
     {
         myFunction.givePostPoint(uid, "回复积分", 1);
     }
     if ( Convert.ToInt32( thePost["gid"]) == -1 && theContext.Cache["mobilePostHome"] != null)
     {
         theContext.Cache.Remove("mobilePostHome");
     }
 }
示例#6
0
 private void back()
 {
     int tid = Convert.ToInt32(theContext.Request.Params["tid"]);
     Hashtable thePost = new Hashtable();
     thePost = myGroup.topicGetById(tid);
     if (Convert.ToInt32(thePost["gid"]) == -10 && Convert.ToInt32(theContext.Session["power"]) > 0)
     {
         string comment = "您的帖子已于"+DateTime.Now.ToString()+"恢复。";
         moyu.User.Functions myFunction = new moyu.User.Functions();
         myFunction.userPointChange(Convert.ToInt32(thePost["uid"]), 2, "删帖恢复积分", 3);
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), Convert.ToInt32(thePost["uid"]), comment, -2, tid);//通知被删帖人
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), Convert.ToInt32(theContext.Session["id"]), comment, -2, tid);//通知操作管理
         myFunction.sendMessage(Convert.ToInt32(theContext.Session["id"]), 1, comment, -2, tid);//通知大管理
         myGroup.commentNew(Convert.ToInt32(theContext.Session["id"]), tid, comment);
         myGroup.updatePost(tid, thePost["body"].ToString(), thePost["title"].ToString(), thePost["tag"].ToString(), -1);
     }
     theContext.Response.Redirect("~/Mobile/robot-group-kewWordsShow.aspx?type=group&tag=-1");
 }
示例#7
0
 private void addPicPostIntroduce()
 {
     int tid = Convert.ToInt32(theContext.Request.Form["tid"]);
     int pid = Convert.ToInt32(theContext.Request.Form["pid"]);
     Hashtable thePost = myGroup.topicGetById(tid);
     string introduce = theContext.Request.Form["introduce"];
     if (Convert.ToInt32(thePost["uid"]) == Convert.ToInt32(theContext.Session["id"]))
     {
         string body = "";
         if (pid == 0)
         {
             body = "<span style=\"color:#F78000;font-weight:bold;\">" + DateTime.Now.ToShortDateString() + "</span>:<br/>" + introduce ;
             if (Convert.ToInt32(thePost["gid"]) == -2)
             {
                 moyu.User.Functions myFunctions = new moyu.User.Functions();
                 myFunctions.givePostPoint(Convert.ToInt32(thePost["uid"]), "签到心情奖励积分", 2);
             }
         }
         else
         {
             body = thePost["body"].ToString() + "<p>" + introduce + "</p>";
         }
         myGroup.updatePost(tid,body, thePost["title"].ToString(), thePost["tag"].ToString(),-1);
     }
     theContext.Response.Redirect("~/Mobile/robot-group-kewWordsShow.aspx?type=group&tag=-1");
 }
示例#8
0
文件: User.ashx.cs 项目: inlost/moyo
 private void changeName()
 {
     string newName = theContext.Request.Form["newName"].ToString().Trim();
     int rst = 0;//服务器内部错误
     if (newName.Length > 1)
     {
         if (myUser.isNameUsed(newName))
         {
             rst = -1;//用户名已经使用
         }
         else
         {
             int uid=Convert.ToInt32(theContext.Session["id"]);
             moyu.User.Functions myUserFun = new moyu.User.Functions();
             if (myUserFun.changeUserName(uid, newName))
             {
                 myUserFun.userPointChange(uid, -36, "修改用户名消耗积分", 36);
                 rst = 1;//修改成功
                 theContext.Session["niceName"] = newName;
             }
         }
     }
     else
     {
         rst = -2;//用户名长度不合法
     }
     theContext.Response.Write(rst);
 }