Esempio n. 1
0
        public string Post_API()
        {
            //Pid贴子ID
            int        rid = DataConvert.CLng(RequestEx["id"]);
            string     action = Request.Form["action"];
            string     value = Request.Form["value"];
            string     msg = ""; int pid = 0;
            string     result = "1" + ":" + Mid;
            M_UserInfo user   = buser.GetLogin();

            pid = DataConvert.CLng(Regex.Split(value, ":::")[0]);
            switch (action)
            {
            case "DeleteMsg":    //删除
                result = barBll.UpdateStatus(barBll.SelReturnModel(pid).CateID, pid.ToString(), (int)ZLEnum.ConStatus.Recycle) ? M_APIResult.Success.ToString() : M_APIResult.Failed.ToString();
                break;

            case "AddReply":    //回复
                msg = Regex.Split(value, ":::")[1];
                barBll.Insert(FillMsg("", msg, pid, rid));
                break;

            case "AddReply2":    //回复用户,需要切换为Json
                msg = Regex.Split(value, ":::")[1];
                barBll.Insert(FillMsg("", msg, pid, rid));
                break;

            case "AddColl":
                result = barBll.LikeTie(pid, user.UserID, 1, "ColledIDS") ? "1" : "0";
                break;

            case "ReColl":
                result = barBll.LikeTie(pid, user.UserID, 2, "ColledIDS") ? "1" : "0";
                break;

            case "AddLike":
                result = likeBll.AddLike(user.UserID, pid, "bar") ? "1" : "0";    // barBll.LikeTie(pid, user.UserID, 1) ? "1" : "0";
                break;

            case "ReLike":
                result = likeBll.DelLike(user.UserID, pid, "bar") ? "1" : "0";    // barBll.LikeTie(pid, user.UserID, 2) ? "1" : "0";
                break;

            case "AddMedal":    //添加勋章
                result = medalBll.AddMedal_U(pid, user.UserID).ToString();
                break;

            case "GetMedalNum":    //得到用户勋章数量
                result = medalBll.SelByUid(pid).Rows.Count.ToString();
                break;

            case "GetUserMedal":    //获取用户的勋章
                result = JsonConvert.SerializeObject(medalBll.SelByUid(pid));
                break;
            }
            return(result);
        }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (function.isAjax())
        {
            string     action = Request.Form["action"];
            string     value = Request.Form["value"];
            string     msg = ""; int pid = 0, id = 0;
            string     result = "1" + ":" + Pid;
            M_UserInfo user   = buser.GetLogin();
            switch (action)
            {
            case "DeleteMsg":    //删除
                id     = Convert.ToInt32(value);
                result = barBll.UpdateStatus(barBll.SelReturnModel(id).CateID, id.ToString(), (int)ZLEnum.ConStatus.Recycle) ? "ok" :"failed";
                break;

            case "AddReply":    //回复
                pid = Convert.ToInt32(value.Split(':')[0]);
                msg = value.Split(':')[1];
                barBll.Insert(FillMsg(msg, pid, Pid));
                break;

            case "AddReply2":    //回复用户,需要切换为Json
                pid = Convert.ToInt32(value.Split('$')[0]);
                msg = value.Split('$')[1];
                barBll.Insert(FillMsg(msg, pid, Pid));
                break;

            case "AddColl":
                if (user != null && user.UserID > 0)
                {
                    result = barBll.LikeTie(DataConvert.CLng(value), user.UserID, 1)?"1":"0";
                }
                else
                {
                    result = "-1";
                }
                break;

            case "ReColl":
                if (user != null && user.UserID > 0)
                {
                    result = barBll.LikeTie(DataConvert.CLng(value), user.UserID, 2) ? "1" : "0";
                }
                break;
            }
            Response.Write(result); Response.Flush(); Response.End();
        }
        HideTlp = "你当前没有登录,请<a href='/User/Login.aspx?returnUrl=/" + CreateUrl(2, Pid) + "'>登录</a>后查看该贴";
        if (!IsPostBack)
        {
            MyBind();
        }
    }
Esempio n. 3
0
        public string BarAJAX()
        {
            string     action = Request.Form["action"];
            string     value  = Request.Form["value"];
            int        pid    = 0;
            string     result = "";
            M_UserInfo user   = buser.GetLogin();

            pid = (-Convert.ToInt32(Regex.Split(value, ":::")[0]));
            switch (action)
            {
            case "DeleteMsg":    //删除
                result = barBll.UpdateStatus(barBll.SelReturnModel(pid).CateID, pid.ToString(), (int)ZLEnum.ConStatus.Recycle) ? M_APIResult.Success.ToString() : M_APIResult.Failed.ToString();
                break;

            //case "AddReply"://回复
            //    //pid = Convert.ToInt32(Regex.Split(value, ":::")[0]);
            //    rid = (-Convert.ToInt32(Regex.Split(value, ":::")[1]));
            //    msg = Regex.Split(value, ":::")[2];
            //    barBll.Insert(FillBarMsg(msg, pid, rid));
            //    break;
            //case "AddReply2"://回复用户,需要切换为Json
            //    //pid = Convert.ToInt32(Regex.Split(value, ":::")[0]);
            //    rid = (-Convert.ToInt32(Regex.Split(value, ":::")[1]));
            //    msg = Regex.Split(value, ":::")[2];
            //    barBll.Insert(FillBarMsg(msg, pid, rid));
            //    break;
            case "AddColl":
                result = barBll.LikeTie(pid, user.UserID, 1, "ColledIDS") ? "1" : "0";
                break;

            case "ReColl":
                result = barBll.LikeTie(pid, user.UserID, 2, "ColledIDS") ? "1" : "0";
                break;

            case "AddLike":
                result = likeBll.AddLike(user.UserID, pid, "bar") ? M_APIResult.Success.ToString() : M_APIResult.Failed.ToString();    // barBll.LikeTie(pid, user.UserID, 1) ? "1" : "0";
                break;

            case "ReLike":
                result = likeBll.DelLike(user.UserID, pid, "bar") ? M_APIResult.Success.ToString() : M_APIResult.Failed.ToString();;     // barBll.LikeTie(pid, user.UserID, 2) ? "1" : "0";
                break;
            }
            return(result);
        }