Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userModel = DataLoadTool.GetCurrUserModel();
            juBll     = new BLLJIMP.BLLJuActivity();
            //获取活动ID
            int jid = Convert.ToInt32(Request["jid"], 16);//由16进制转换

            pubjid          = Request["jid"];
            juActivityModel = juBll.GetJuActivity(jid);

            //判断权限
            if (this.userModel.UserType != 1)
            {
                if (juActivityModel.UserID != this.userModel.UserID)
                {
                    Response.Write("<script>alert('无权访问该贺卡!');</script>");
                    Response.End();
                    return;
                }
            }

            try
            {
                //获取活动报名数据
                signUpDataList = this.juBll.QueryJuActivitySignUpData(jid);
            }
            catch { }

            if (signUpDataList == null)
            {
                signUpDataList = new List <BLLJIMP.Model.ActivityDataInfo>();
            }
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            string         jid    = context.Request["jid"];
            string         isHide = context.Request["is_hide"];
            JuActivityInfo model  = bllJuActivity.GetJuActivity(int.Parse(jid), true, bllJuActivity.WebsiteOwner);

            if (model == null)
            {
                apiResp.msg  = "不存在";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                bllJuActivity.ContextResponse(context, apiResp);
                return;
            }
            if (model.UserID != bllJuActivity.GetCurrUserID())
            {
                apiResp.msg  = "没有权限";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.NoPms;
                bllJuActivity.ContextResponse(context, apiResp);
                return;
            }
            model.IsHide = int.Parse(isHide);

            if (bllJuActivity.Update(model))
            {
                apiResp.msg    = "操作完成";
                apiResp.status = true;
            }
            else
            {
                apiResp.msg  = "操作出错";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            bllJuActivity.ContextResponse(context, apiResp);
        }
Exemple #3
0
        public void ProcessRequest(HttpContext context)
        {
            string jid         = context.Request["jid"];
            string acticleName = context.Request["title"];
            string content     = context.Request["content"],
                   summary     = context.Request["summary"];
            string cateId      = context.Request["cateId"];
            string k3          = context.Request["k3"];
            string thumbnails  = context.Request["thumbnails"];

            JuActivityInfo model = bllJuActivity.GetJuActivity(int.Parse(jid), true, bllJuActivity.WebsiteOwner);

            if (model == null)
            {
                apiResp.msg  = "不存在";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                bllJuActivity.ContextResponse(context, apiResp);
                return;
            }
            if (model.UserID != bllJuActivity.GetCurrUserID())
            {
                apiResp.msg  = "没有权限";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.NoPms;
                bllJuActivity.ContextResponse(context, apiResp);
                return;
            }

            if (string.IsNullOrWhiteSpace(summary))
            {
                summary = MySpider.MyRegex.RemoveHTMLTags(content);
                if (summary.Length > 200)
                {
                    summary = summary.Substring(0, 200) + "...";
                }
            }
            model.ActivityName        = acticleName;
            model.Summary             = summary;
            model.ActivityDescription = content;
            model.CategoryId          = cateId;
            model.K3             = k3;
            model.ThumbnailsPath = thumbnails;

            if (bllJuActivity.Update(model))
            {
                apiResp.status = true;
                apiResp.msg    = "操作完成";
            }
            else
            {
                apiResp.msg  = "操作出错";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            bllJuActivity.ContextResponse(context, apiResp);
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string activityId = context.Request["activity_id"];
            string fieldIndex = context.Request["field_index"];

            if (string.IsNullOrEmpty(activityId))
            {
                resp.errmsg  = "activity_id 为必填,请检查";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(fieldIndex))
            {
                resp.errmsg  = "field_index 为必填,请检查";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            JuActivityInfo juActivity = bllJuActivity.GetJuActivity(int.Parse(activityId), false);

            if (juActivity == null)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = "没有找到该活动";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            ActivityFieldMappingInfo fieldMap = bll.Get <ActivityFieldMappingInfo>(string.Format(" ActivityID={0} AND ExFieldIndex={1}", juActivity.SignUpActivityID, fieldIndex));

            if (fieldMap == null)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = "没有找到该条记录";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (bll.Delete(new ActivityFieldMappingInfo(), string.Format(" ActivityID={0} AND ExFieldIndex={1}", juActivity.SignUpActivityID, fieldIndex)) > 0)
            {
                resp.isSuccess = true;
                resp.errmsg    = "ok";
            }
            else
            {
                resp.errmsg  = "删除出错";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IsLogin = bll.IsLogin;
            if (bll.IsLogin)
            {
                CurrentUserInfo = bll.GetCurrentUserInfo();
            }
            PeopleCount = bll.GetCount <WXMallOrderInfo>(string.Format("WebsiteOwner='qianwei' And OrderUserID='system' And PaymentStatus=1"));
            TotalAmount = bll.GetList <WXMallOrderInfo>(string.Format("WebsiteOwner='qianwei' And OrderUserID='system' And PaymentStatus=1")).Sum(p => p.TotalAmount);

            ArticleModel = bllArticle.GetJuActivity(274374);
            if (ArticleModel == null)
            {
                ArticleModel = new JuActivityInfo();
            }
        }
Exemple #6
0
        public void ProcessRequest(HttpContext context)
        {
            string activityId   = context.Request["activity_id"];
            string activityUids = context.Request["activity_uids"];

            if (string.IsNullOrEmpty(activityId))
            {
                resp.errmsg  = "activity_id 为必填项,请检查";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(activityUids))
            {
                resp.errmsg  = "activityUid 为必填项,请检查";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            JuActivityInfo juActivity = bllJuActivity.GetJuActivity(int.Parse(activityId), false);

            if (juActivity == null)
            {
                resp.errmsg  = "没有找到该条活动";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (bllActivity.Delete(new ActivityDataInfo(), string.Format(" WebsiteOwner='{0}' AND isDelete=0 AND ActivityID='{1}' AND UID in ({2})", bllJuActivity.WebsiteOwner, juActivity.SignUpActivityID, activityUids)) == activityUids.Split(',').Length)
            {
                bllJuActivity.UpSignUpTotalCount(juActivity.JuActivityID);//更新 报名人数
                resp.isSuccess = true;
                resp.errmsg    = "ok";
            }
            else
            {
                resp.errmsg  = "删除报名数据出错";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                model = bll.GetJuActivity(int.Parse(Request["id"]));
                model.PV++;
                bll.Update(model);
                txtPraiseNum.Text = model.UpCount.ToString();
                try
                {
                    BLLJIMP.Model.ForwardingRecord frecord = bll.Get <BLLJIMP.Model.ForwardingRecord>(string.Format(" FUserID='{0}' AND RUserID='{1}' AND websiteOwner='{2}' AND TypeName = '文章赞'", bll.GetCurrentUserInfo().UserID, int.Parse(Request["id"]), bll.WebsiteOwner));
                    if (frecord != null)
                    {
                        zan = true;
                    }

                    #region 加投票功能
                    if (model.ActivityDescription.Contains("$TOUPIAO@"))
                    {
                        int    start  = model.ActivityDescription.IndexOf("$TOUPIAO@");
                        int    end    = model.ActivityDescription.LastIndexOf("TOUPIAO$");
                        int    length = end - start - 1;
                        string Voteid = model.ActivityDescription.Substring(model.ActivityDescription.IndexOf("$TOUPIAO@") + 1, length).Replace("TOUPIAO@", null);
                        string str    = "$TOUPIAO@" + Voteid + "TOUPIAO$";
                        model.ActivityDescription = model.ActivityDescription.Replace(str, bll.GetTheVoteInfo(Voteid));
                    }
                    #endregion
                }
                catch (Exception)
                {
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemple #8
0
        public void ProcessRequest(HttpContext context)
        {
            int    rows         = Convert.ToInt32(context.Request["rows"]);
            int    page         = Convert.ToInt32(context.Request["page"]);
            string relation_id  = context.Request["relation_id"];
            string score_type   = context.Request["score_type"];
            string score_events = context.Request["score_events"];
            string allScore     = context.Request["all_score"];
            string sum_score    = context.Request["sum_score"];
            string month_score  = context.Request["month_score"];
            string websiteOwner = bll.WebsiteOwner;
            //if (string.IsNullOrWhiteSpace(score_type)) score_type = "Reward";  --注释掉这行是因为   需要查询全部淘股币明细 且 没有影响查询赠送列表
            double sumScore      = 0;
            string search_userid = "";

            if (!string.IsNullOrEmpty(allScore))
            {
                search_userid = bll.GetCurrUserID();
            }

            if (!string.IsNullOrWhiteSpace(relation_id))
            {
                BLLJIMP.Model.JuActivityInfo activity = bllActivity.GetJuActivity(Convert.ToInt32(relation_id), false, bllActivity.WebsiteOwner);
                if (activity != null)
                {
                    sumScore = activity.RewardTotal;
                }
            }
            else if (sum_score == "1")
            {
                sumScore = bll.GetSumScore(bll.WebsiteOwner, score_type, relation_id, search_userid, scoreEvents: score_events);
            }

            List <UserScoreDetailsInfo> list = bll.GetScoreList(rows, page, bll.WebsiteOwner, score_type, relation_id, search_userid, scoreEvents: score_events);
            int total = bll.GetScoreRowCount(bll.WebsiteOwner, score_type, relation_id, search_userid, scoreEvents: score_events);

            List <UserInfo> users = new List <UserInfo>();

            if (list.Count > 0)
            {
                string userIds = ZentCloud.Common.MyStringHelper.ListToStr(list.Select(p => p.UserID).ToList(), "'", ",");
                users = bll.GetColMultListByKey <UserInfo>(rows, 1, "UserID", userIds, "AutoID,UserID,TrueName,WXNickname", websiteOwner: websiteOwner);
            }
            Dictionary <string, double> months = new Dictionary <string, double>();
            List <dynamic> rList = new List <dynamic>();

            foreach (UserScoreDetailsInfo item in list)
            {
                UserInfo nu         = users.FirstOrDefault(p => p.UserID == item.UserID);
                double   monthScore = 0;
                if (month_score == "1")
                {
                    string month = item.AddTime.ToString("yyyy-MM");
                    if (months.ContainsKey(month))
                    {
                        monthScore = months[month];
                    }
                    else
                    {
                        monthScore = bll.GetSumScore(bll.WebsiteOwner, score_type, relation_id, search_userid, scoreEvents: score_events, month: month);
                        months.Add(month, monthScore);
                    }
                }
                rList.Add(new{
                    id           = item.AutoID,
                    uid          = nu == null?"": nu.AutoID.ToString(),
                    nickname     = bllUser.GetUserDispalyName(nu),
                    score        = Math.Round(item.Score, 2),
                    totalscore   = Math.Round(item.TotalScore, 2),
                    addnote      = item.AddNote,
                    time         = item.AddTime,
                    time_str     = item.AddTime.ToString("yyyy/MM/dd HH:mm:ss"),
                    score_event  = item.ScoreEvent,
                    event_score  = Math.Round(item.EventScore, 2),
                    deduct_score = Math.Round(item.DeductScore, 2),
                    month_score  = Math.Round(monthScore, 2)
                });
            }
            apiResp.status = true;
            apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            apiResp.msg    = "查询列表完成";
            apiResp.result = new
            {
                total = total,
                list  = rList,
                sum   = Math.Round(sumScore, 2)
            };
            bll.ContextResponse(context, apiResp);
        }
Exemple #9
0
        public void ProcessRequest(HttpContext context)
        {
            string id    = context.Request["id"];
            double score = Convert.ToDouble(context.Request["score"]);

            if (!string.IsNullOrWhiteSpace(context.Request["score_name"]))
            {
                scoreName = context.Request["score_name"];
            }
            if (!string.IsNullOrWhiteSpace(context.Request["action_name"]))
            {
                actionName = context.Request["action_name"];
            }



            int score1 = 0;

            if (!int.TryParse(score.ToString(), out score1))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = scoreName + "只能输入正整数";
                bll.ContextResponse(context, apiResp);
                return;
            }

            #region  能小于等于0
            if (score <= 0)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = actionName + scoreName + "不能小于等于0";
                bll.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            double min = Convert.ToDouble(context.Request["min"]);
            #region 最小值限制
            if (score < min)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = actionName + scoreName + "不能少于" + min;
                bll.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            int idInt = Convert.ToInt32(id);

            if (CurrentUserInfo.TotalScore < score)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "账号" + scoreName + "不足";
                bll.ContextResponse(context, apiResp);
                return;
            }
            BLLJIMP.Model.JuActivityInfo activity = bllActivity.GetJuActivity(idInt, false, bllActivity.WebsiteOwner);
            if (activity == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                apiResp.msg  = "文章未找到";
                bll.ContextResponse(context, apiResp);
                return;
            }
            if (CurrentUserInfo.UserID == activity.UserID)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "禁止" + actionName + "自己";
                bll.ContextResponse(context, apiResp);
                return;
            }
            BLLJIMP.Model.UserInfo author = bllUser.GetUserInfo(activity.UserID, bllUser.WebsiteOwner);

            string msg    = "";
            bool   result = bll.RewardJuActivity(CurrentUserInfo, author, activity, score, bll.WebsiteOwner, out msg, scoreName, actionName);

            apiResp.status = result;
            apiResp.code   = result ? (int)BLLJIMP.Enums.APIErrCode.IsSuccess :(int)BLLJIMP.Enums.APIErrCode.OperateFail;
            apiResp.msg    = msg;
            bll.ContextResponse(context, apiResp);
        }
Exemple #10
0
        public void ProcessRequest(HttpContext context)
        {
            string articleId      = context.Request["activity_id"];
            string content        = context.Request["content"];
            var    replyId        = Convert.ToInt32(context.Request["reply_id"]);//评论了文章里的哪个评论
            int    isHideUserName = Convert.ToInt32(context.Request["is_hide_user_name"]);

            resp.isSuccess = false;
            if (string.IsNullOrWhiteSpace(articleId) || string.IsNullOrWhiteSpace(content))
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                resp.errmsg  = "activity_id、content 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (bllJuActivity.GetCount <JuActivityInfo>(string.Format(" WebsiteOwner='{0}' AND  JuActivityID = {1} ", bllJuActivity.WebsiteOwner, articleId)) == 0)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = "不存在活动";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            //敏感词检查
            string errmsg = "";

            if (!bllFilterWord.CheckFilterWord(content, this.bllJuActivity.WebsiteOwner, out errmsg, "0"))
            {
                resp.errmsg  = errmsg;
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            //添加评论
            int            reviewId = 0;
            JuActivityInfo article  = bllJuActivity.GetJuActivity(int.Parse(articleId), true);

            BLLJIMP.Enums.ReviewTypeKey reviewType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment;
            if (article.ArticleType == "Question")
            {
                reviewType = BLLJIMP.Enums.ReviewTypeKey.Answer;
            }
            if (article.ArticleType == "Appointment")
            {
                reviewType = BLLJIMP.Enums.ReviewTypeKey.AppointmentComment;
            }
            var addResult = bllReview.AddReview(reviewType, articleId, replyId, this.CurrentUserInfo.UserID, "评论", content, this.bllJuActivity.WebsiteOwner, out reviewId, isHideUserName);

            if (addResult)
            {
                if (reviewType == BLLJIMP.Enums.ReviewTypeKey.Answer)
                {
                    bllUser.AddUserScoreDetail(this.CurrentUserInfo.UserID, EnumStringHelper.ToString(ScoreDefineType.AnswerQuestions), this.bllJuActivity.WebsiteOwner, null, null);
                }
                resp.isSuccess   = true;
                resp.returnValue = reviewId.ToString();

                if (article.ArticleType == "Question")
                {
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.QuestionIsAnswered, this.CurrentUserInfo, article, article.UserID, content);
                    List <UserInfo> users = bllUser.GetRelationUserList(BLLJIMP.Enums.CommRelationType.JuActivityFollow, articleId);
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.FollowQuestionIsAnswered, this.CurrentUserInfo, article, users, content);
                }
            }
            else
            {
                resp.errcode   = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                resp.isSuccess = false;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Exemple #11
0
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex  = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1;
            int pageSize   = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10;
            var articleId  = context.Request["article_id"];
            var userAutoId = context.Request["user_autoid"];
            var reviewType = context.Request["review_type"];
            var totalCount = 0;

            BLLJIMP.Enums.ReviewTypeKey nType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment;
            if (string.IsNullOrWhiteSpace(reviewType) && !string.IsNullOrWhiteSpace(articleId))
            {
                int            artId    = Convert.ToInt32(articleId);
                JuActivityInfo juArtcle = bllJuActivity.GetJuActivity(artId);
                if (juArtcle.ArticleType.ToLower() == "question")
                {
                    nType = BLLJIMP.Enums.ReviewTypeKey.Answer;
                }
                if (juArtcle.ArticleType.ToLower() == "appointment")
                {
                    nType = BLLJIMP.Enums.ReviewTypeKey.AppointmentComment;
                }
            }
            else
            {
                Enum.TryParse(reviewType, out nType);
            }

            string UserId = "";

            if (!string.IsNullOrWhiteSpace(userAutoId))
            {
                UserInfo user = bllUser.GetUserInfoByAutoID(int.Parse(userAutoId));
                if (user != null)
                {
                    UserId = user.UserID;
                }
                else
                {
                    UserId = "-1";
                }
            }

            var sourceData = this.bllReview.GetReviewList(nType, out totalCount, pageIndex, pageSize, articleId, this.bllJuActivity.WebsiteOwner, this.CurrentUserInfo == null ? "" : this.CurrentUserInfo.UserID, "", UserId);

            List <dynamic> returnList = new List <dynamic>();

            resp.isSuccess = true;

            foreach (var item in sourceData)
            {
                int actId = 0;
                int.TryParse(item.Expand1, out actId);
                JuActivityInfo actInfo = bllJuActivity.GetJuActivity(actId);
                returnList.Add(new
                {
                    id                = item.ReviewMainId,
                    content           = item.ReviewContent,
                    create_time       = bllUser.GetTimeStamp(item.InsertDate),
                    reply_count       = item.ReplyCount,  //回复数
                    praise_count      = item.PraiseCount, //点赞数
                    pv                = item.Pv,          //浏览数
                    curruser_ispraise = item.CurrUserIsPraise,
                    article_id        = actInfo != null ? actInfo.JuActivityID : 0,
                    article_name      = actInfo != null ? actInfo.ActivityName : "",
                    pub_user          = new
                    {
                        id        = item.PubUser == null ? 0 : item.PubUser.AutoID,
                        user_id   = item.PubUser == null ? "" : item.PubUser.UserID,
                        user_name = item.PubUser == null ? "" : bllUser.GetUserDispalyName(item.PubUser),
                        avatar    = item.PubUser == null ? "" : bllUser.GetUserDispalyAvatar(item.PubUser),
                        istutor   = item.PubUser == null ? false : bllUser.IsTutor(item.PubUser)
                    },
                    replay_touser = new
                    {
                        id        = item.ReplayToUser == null ? 0 : item.ReplayToUser.AutoID,
                        user_id   = item.ReplayToUser == null ? "" : item.ReplayToUser.UserID,
                        user_name = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyName(item.ReplayToUser),
                        avatar    = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyAvatar(item.ReplayToUser),
                        istutor   = item.ReplayToUser == null ? false : bllUser.IsTutor(item.ReplayToUser)
                    }
                });
            }
            resp.returnObj = new
            {
                totalcount = totalCount,
                list       = returnList
            };
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Exemple #12
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string activityId = context.Request["activity_id"];
                int    pageIndex  = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1;
                int    pageSize   = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10;
                string keyWord    = context.Request["keyword"];
                if (string.IsNullOrEmpty(activityId))
                {
                    resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                    resp.errmsg  = "activity_id 为必填项,请检查";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                JuActivityInfo juActivity = bllJuActivity.GetJuActivity(int.Parse(activityId), false);
                if (juActivity == null)
                {
                    resp.errmsg  = "不存在该条活动";
                    resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }

                System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(string.Format(" WebSiteOwner='{0}' AND isDelete=0 AND ActivityID='{1}' ", bllActivity.WebsiteOwner, juActivity.SignUpActivityID));

                if (!string.IsNullOrEmpty(keyWord))
                {
                    sbWhere.AppendFormat(" AND Name like '%{0}%' ", keyWord);
                }

                int totalCount = bllActivity.GetCount <ActivityDataInfo>(sbWhere.ToString());

                var dataList = bllActivity.GetLit <ActivityDataInfo>(pageSize, pageIndex, sbWhere.ToString());

                List <ActivityFieldMappingInfo> fieldMapList = bllActivity.GetActivityFieldMappingList(juActivity.SignUpActivityID);

                resp.isSuccess = true;

                List <dynamic> list      = new List <dynamic>();
                List <dynamic> maplist   = new List <dynamic>();
                var            fieldlist = bllActivity.GetActivityFieldMappingList(juActivity.SignUpActivityID);
                foreach (var item in fieldlist)
                {
                    maplist.Add(new
                    {
                        key   = item.MappingName,
                        value = item.FieldName
                    });
                }

                for (int i = 0; i < dataList.Count; i++)
                {
                    list.Add(new
                    {
                        name        = dataList[i].Name,
                        phone       = dataList[i].Phone,
                        insert_time = bllActivity.GetTimeStamp(dataList[i].InsertDate),
                        k1          = dataList[i].K1,
                        k2          = dataList[i].K2,
                        k3          = dataList[i].K3,
                        k4          = dataList[i].K4,
                        k5          = dataList[i].K5,
                        k6          = dataList[i].K6,
                        k7          = dataList[i].K7,
                        k8          = dataList[i].K8,
                        k9          = dataList[i].K9,
                        k10         = dataList[i].K10,

                        k11 = dataList[i].K11,
                        k12 = dataList[i].K12,
                        k13 = dataList[i].K13,
                        k14 = dataList[i].K14,
                        k15 = dataList[i].K15,
                        k16 = dataList[i].K16,
                        k17 = dataList[i].K17,
                        k18 = dataList[i].K18,
                        k19 = dataList[i].K19,
                        k20 = dataList[i].K20,

                        k21 = dataList[i].K21,
                        k22 = dataList[i].K22,
                        k23 = dataList[i].K23,
                        k24 = dataList[i].K24,
                        k25 = dataList[i].K25,
                        k26 = dataList[i].K26,
                        k27 = dataList[i].K27,
                        k28 = dataList[i].K28,
                        k29 = dataList[i].K29,
                        k30 = dataList[i].K30,

                        k31 = dataList[i].K31,
                        k32 = dataList[i].K32,
                        k33 = dataList[i].K33,
                        k34 = dataList[i].K34,
                        k35 = dataList[i].K35,
                        k36 = dataList[i].K36,
                        k37 = dataList[i].K37,
                        k38 = dataList[i].K38,
                        k39 = dataList[i].K39,
                        k40 = dataList[i].K40,

                        k41 = dataList[i].K41,
                        k42 = dataList[i].K42,
                        k43 = dataList[i].K43,
                        k44 = dataList[i].K44,
                        k45 = dataList[i].K45,
                        k46 = dataList[i].K46,
                        k47 = dataList[i].K47,
                        k48 = dataList[i].K48,
                        k49 = dataList[i].K49,
                        k50 = dataList[i].K50,

                        k51 = dataList[i].K51,
                        k52 = dataList[i].K52,
                        k53 = dataList[i].K53,
                        k54 = dataList[i].K54,
                        k55 = dataList[i].K55,
                        k56 = dataList[i].K56,
                        k57 = dataList[i].K57,
                        k58 = dataList[i].K58,
                        k59 = dataList[i].K59,
                        k60 = dataList[i].K60,
                    });
                }


                var data = new {
                    totalcount = totalCount,
                    list       = list,
                };

                resp.returnObj = new
                {
                    data    = data,
                    maplist = maplist
                };
            }
            catch (Exception ex)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                resp.errmsg  = ex.Message;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Exemple #13
0
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex  = Convert.ToInt32(context.Request["pageindex"]),
                pageSize   = Convert.ToInt32(context.Request["pagesize"]);
            var articleId  = context.Request["articleid"];
            var userAutoId = context.Request["user_autoid"];
            var reviewType = context.Request["review_type"];

            currentUserInfo = bllUser.GetCurrentUserInfo();

            var totalCount = 0;

            BLLJIMP.Enums.ReviewTypeKey nType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment;
            if (string.IsNullOrWhiteSpace(reviewType) && !string.IsNullOrWhiteSpace(articleId))
            {
                int            artId    = Convert.ToInt32(articleId);
                JuActivityInfo juArtcle = bll.GetJuActivity(artId);
                if (juArtcle.ArticleType.ToLower() == "question")
                {
                    nType = BLLJIMP.Enums.ReviewTypeKey.Answer;
                }
            }
            else
            {
                Enum.TryParse(reviewType, out nType);
            }
            string userId = "";

            if (!string.IsNullOrWhiteSpace(userAutoId))
            {
                UserInfo user = bllUser.GetUserInfoByAutoID(int.Parse(userAutoId));
                if (user != null)
                {
                    userId = user.UserID;
                }
                else
                {
                    userId = "-1";
                }
            }
            //仅显示审核通过的
            var sourceData = this.bllReview.GetReviewList(nType, out totalCount, pageIndex, pageSize, articleId, this.bll.WebsiteOwner, this.currentUserInfo == null ? "" : this.currentUserInfo.UserID, "", userId);

            List <dynamic> returnList = new List <dynamic>();

            foreach (var item in sourceData)
            {
                int actId = 0;
                int.TryParse(item.Expand1, out actId);
                JuActivityInfo actInfo = bll.GetJuActivity(actId);
                returnList.Add(new
                {
                    id               = item.ReviewMainId,
                    content          = item.ReviewContent,
                    createDate       = item.InsertDate.ToString(),
                    replyCount       = item.ReplyCount,  //回复数
                    praiseCount      = item.PraiseCount, //点赞数
                    pv               = item.Pv,          //浏览数
                    currUserIsPraise = item.CurrUserIsPraise,
                    articleId        = actInfo != null ? actInfo.JuActivityID : 0,
                    articleName      = actInfo != null ? actInfo.ActivityName : "",
                    pubUser          = new
                    {
                        id       = item.PubUser == null ? 0 : item.PubUser.AutoID,
                        userId   = item.PubUser == null ? "" : item.PubUser.UserID,
                        userName = item.PubUser == null ? "" : bllUser.GetUserDispalyName(item.PubUser),
                        avatar   = item.PubUser == null ? "" : bllUser.GetUserDispalyAvatar(item.PubUser),
                        isTutor  = item.PubUser == null ? false : bllUser.IsTutor(item.PubUser)
                    },
                    replayToUser = new
                    {
                        id       = item.ReplayToUser == null ? 0 : item.ReplayToUser.AutoID,
                        userId   = item.ReplayToUser == null ? "" : item.ReplayToUser.UserID,
                        userName = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyName(item.ReplayToUser),
                        avatar   = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyAvatar(item.ReplayToUser),
                        isTutor  = item.ReplayToUser == null ? false : bllUser.IsTutor(item.ReplayToUser)
                    }
                });
            }

            dynamic result = new
            {
                totalcount = totalCount,
                list       = returnList
            };

            apiResp.status = true;
            apiResp.msg    = "查询完成";
            apiResp.result = result;
            bllUser.ContextResponse(context, apiResp);
        }
Exemple #14
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (bll.IsLogin)
            {
                currentUserInfo = bll.GetCurrentUserInfo();
            }
            string activityId = context.Request["activity_id"];

            if (string.IsNullOrEmpty(activityId))
            {
                resp.errcode = 1;
                resp.errmsg  = "activity_id 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            JuActivityInfo juInfo = bll.GetJuActivity(int.Parse(activityId), true);

            if (juInfo == null)
            {
                resp.errcode = 4;
                resp.errmsg  = "活动不存在!";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            #region 是否可以报名
            if (juInfo.ActivityStatus.Equals(1))
            {
                resp.errcode = 2;
                resp.errmsg  = "活动已停止";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (juInfo.MaxSignUpTotalCount > 0)//检查报名人数
            {
                if (juInfo.SignUpTotalCount > (juInfo.MaxSignUpTotalCount - 1))
                {
                    resp.errcode = 3;
                    resp.errmsg  = "报名人数已满";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            if (juInfo.ActivityIntegral > 0)
            {
                if (currentUserInfo.TotalScore < juInfo.ActivityIntegral)
                {
                    resp.errcode = 4;
                    resp.errmsg  = "您的积分不足";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            if (juInfo.GuaranteeCreditAcount > 0)
            {
                if (currentUserInfo.CreditAcount < juInfo.GuaranteeCreditAcount)
                {
                    resp.errcode = 6;
                    resp.errmsg  = "您的信用金不足";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            #endregion
            dicPar = bll.GetRequestParameter();
            //string weixinOpenID = null;
            string activityIdBySignUp = juInfo.SignUpActivityID;
            string spreadUserId       = null;
            dicPar.TryGetValue("SpreadUserID", out spreadUserId);
            string strDistinctKeys = null;//检查重复的字段,多个字段用,分隔, //没有此参数默认用手机检查
            dicPar.TryGetValue("DistinctKeys", out strDistinctKeys);
            string monitorPlanID = null;
            dicPar.TryGetValue("MonitorPlanID", out monitorPlanID);
            string name = null;
            dicPar.TryGetValue("Name", out name);
            string phone = null;
            dicPar.TryGetValue("Phone", out phone);
            ActivityInfo activity = bll.Get <ActivityInfo>(string.Format("ActivityID='{0}'", activityIdBySignUp));

            #region IP限制
            //获取用户IP;
            string userHostAddress = context.Request.UserHostAddress;
            var    count           = DataCache.GetCache(userHostAddress);
            if (count != null)
            {
                int newCount = int.Parse(count.ToString()) + 1;
                DataCache.SetCache(userHostAddress, newCount);
                int limitCount = 1000;
                if (activity != null)
                {
                    limitCount = activity.LimitCount;
                }
                if (newCount >= limitCount)
                {
                    resp.errcode = 5;
                    resp.errmsg  = "您的提交过于频繁,请稍后再试";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            else
            {
                DataCache.SetCache(userHostAddress, 1, DateTime.MaxValue, new TimeSpan(4, 0, 0));
            }

            #endregion

            #region 活动权限验证
            if (juInfo == null)
            {
                resp.errcode = 6;
                resp.errmsg  = "活动不存在!";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (juInfo.ActivityStatus.Equals(1))
            {
                resp.errcode = 7;
                resp.errmsg  = "活动已关闭!";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }

            if (activity.IsDelete.Equals(1))
            {
                resp.errcode = 8;
                resp.errmsg  = "活动已删除!";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            #endregion

            #region 判断必填项
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(phone))
            {
                resp.errcode = 9;
                resp.errmsg  = "姓名和手机不能为空!";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }

            if ((!phone.StartsWith("1")) || (!phone.Length.Equals(11)))
            {
                resp.errcode = 10;
                resp.errmsg  = "手机号码无效!";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }

            #endregion

            #region 检查自定义必填项
            List <ActivityFieldMappingInfo> listRequiredField = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}' And FieldIsNull=1", activity.ActivityID));
            if (listRequiredField.Count > 0)
            {
                foreach (var requiredField in listRequiredField)
                {
                    if (string.IsNullOrEmpty(dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", requiredField.ExFieldIndex))).Value))
                    {
                        resp.errcode = 11;
                        resp.errmsg  = string.Format(" {0} 必填", requiredField.MappingName);
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
            }
            #endregion

            #region 检查数据格式
            //检查数据格式
            List <ActivityFieldMappingInfo> activityFieldMapping = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}'", activity.ActivityID));
            foreach (var item in activityFieldMapping)
            {
                string value = dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", item.ExFieldIndex))).Value;

                if (string.IsNullOrWhiteSpace(value))
                {
                    continue;
                }

                //检查数据格式
                if (item.FormatValiFunc == "email")//email检查
                {
                    if (!ZentCloud.Common.ValidatorHelper.EmailLogicJudge(value))
                    {
                        resp.errcode = 12;
                        resp.errmsg  = string.Format("{0}格式不正确", item.MappingName);
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
                if (item.FormatValiFunc == "url")                                                                                                             //url检查
                {
                    System.Text.RegularExpressions.Regex regUrl = new System.Text.RegularExpressions.Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"); //网址
                    System.Text.RegularExpressions.Match m      = regUrl.Match(value);
                    if (!m.Success)
                    {
                        resp.errcode = 13;
                        resp.errmsg  = string.Format("{0}格式不正确", item.MappingName);
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
            }
            #endregion

            #region 检查是否已经报名
            if (!string.IsNullOrEmpty(strDistinctKeys))
            {
                if (!strDistinctKeys.Equals("none"))//自定义检查重复
                {
                    System.Text.StringBuilder sb = new System.Text.StringBuilder("1=1 ");
                    string[] distinctKeys        = strDistinctKeys.Split(',');
                    foreach (var item in distinctKeys)
                    {
                        sb.AppendFormat("And {0}='{1}' ", item, dicPar.Single(p => p.Key.Equals(item)).Value);
                    }
                    sb.Append("  and IsDelete = 0  ");
                    if (bll.GetCount <ActivityDataInfo>(sb.ToString()) > 0)
                    {
                        resp.errcode = 14;
                        resp.errmsg  = "重复的报名!";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
                else//不检查重复
                {
                }
            }
            else//默认检查
            {
                if (bll.GetCount <ActivityDataInfo>(string.Format("ActivityID='{0}' And Phone='{1}' and IsDelete = 0 ", activityIdBySignUp, phone)) > 0)
                {
                    resp.errcode = 15;
                    resp.errmsg  = "已经报过名了!";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }



            #endregion


            var newActivityUID       = 1001;
            var lastActivityDataInfo = bll.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", activityIdBySignUp));
            if (lastActivityDataInfo != null)
            {
                newActivityUID = lastActivityDataInfo.UID + 1;
            }
            ActivityDataInfo model = bll.ConvertRequestToModel <ActivityDataInfo>(new ActivityDataInfo());
            model.UID          = newActivityUID;
            model.SpreadUserID = spreadUserId;
            model.ActivityID   = activityIdBySignUp;
            if (juInfo.GuaranteeCreditAcount > 0)
            {
                if (model.GuaranteeCreditAcount < juInfo.GuaranteeCreditAcount)
                {
                    resp.errcode = 18;
                    resp.errmsg  = string.Format("担保信用金不能少于{0}!", Convert.ToDouble(juInfo.GuaranteeCreditAcount));
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            if (!string.IsNullOrEmpty(monitorPlanID))
            {
                model.MonitorPlanID = int.Parse(monitorPlanID);
            }
            model.WebsiteOwner = bll.WebsiteOwner;
            if (bll.IsLogin)
            {
                UserInfo curUser = bll.GetCurrentUserInfo();
                model.UserId       = curUser.UserID;
                model.WeixinOpenID = curUser.WXOpenId;
                if (context.Request["limit_userid_signupcount"] == "1")//限制每个登录账号只能报名一次
                {
                    if (bll.GetCount <ActivityDataInfo>(string.Format(" UserId='{0}' AND ActivityID={1} AND IsDelete=0 "
                                                                      , model.UserId, juInfo.SignUpActivityID)) > 0)
                    {
                        resp.errcode = 14;
                        resp.errmsg  = "重复的报名!";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
                if (context.Request["limit_wxopenid_signupcount"] == "1")//限制每个微信只能报名一次
                {
                    if (bll.GetCount <ActivityDataInfo>(string.Format(" UserId='{0}' AND ActivityID={1} AND IsDelete=0 "
                                                                      , model.WeixinOpenID, juInfo.SignUpActivityID)) > 0)
                    {
                        resp.errcode = 14;
                        resp.errmsg  = "重复的报名!";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
            }

            if (bll.Add(model))
            {
                bll.PlusNumericalCol("SignUpCount", juInfo.JuActivityID);//报名数+1

                resp.errmsg    = "ok";
                resp.errcode   = 0;
                resp.isSuccess = true;
                #region 当ActivityIntegral>0   扣积分
                if (juInfo.ActivityIntegral > 0)//扣积分
                {
                    currentUserInfo.TotalScore -= juInfo.ActivityIntegral;
                    if (bll.Update(currentUserInfo, string.Format("TotalScore={0}", currentUserInfo.TotalScore), string.Format(" AutoID={0}", currentUserInfo.AutoID)) <= 0)
                    {
                        resp.errcode = 16;
                        resp.errmsg  = "扣除用户积分失败";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                    else
                    {
                        //
                        BLLJIMP.Model.WBHScoreRecord scoreRecord = new BLLJIMP.Model.WBHScoreRecord();
                        scoreRecord.Nums         = "b55";
                        scoreRecord.InsertDate   = DateTime.Now;
                        scoreRecord.WebsiteOwner = bll.WebsiteOwner;
                        scoreRecord.UserId       = currentUserInfo.UserID;
                        scoreRecord.RecordType   = "2";
                        scoreRecord.NameStr      = "参加活动:" + juInfo.ActivityName;
                        scoreRecord.ScoreNum     = string.Format("-{0}", juInfo.ActivityIntegral);
                        if (!bll.Add(scoreRecord))
                        {
                            resp.errcode = 17;
                            resp.errmsg  = "插入积分记录失败";
                            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                            return;
                        }
                    }
                }
                #endregion

                #region 当ActivityIntegral>0   扣信用金
                if (juInfo.GuaranteeCreditAcount > 0)//扣积分
                {
                    BLLJIMP.BLLUser bllUser = new BLLJIMP.BLLUser();
                    bllUser.AddUserCreditAcountDetails(currentUserInfo.UserID, "ApplyCost", bllUser.WebsiteOwner, 0 - model.GuaranteeCreditAcount
                                                       , string.Format("报名【{0}】消耗{1}信用金", juInfo.ActivityName, Convert.ToDouble(model.GuaranteeCreditAcount)));
                }
                #endregion
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "报名失败,请重试或联系管理员!";
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Exemple #15
0
        public void ProcessRequest(HttpContext context)
        {
            var articleId = context.Request["articleid"];
            var content   = context.Request["content"];
            var replyId   = Convert.ToInt32(context.Request["replyid"]);//评论了文章里的哪个评论

            int isHideUserName = Convert.ToInt32(context.Request["ishideusername"]);

            currentUserInfo = bllUser.GetCurrentUserInfo();
            if (this.currentUserInfo == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin;
                apiResp.msg  = "请先登录";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (string.IsNullOrWhiteSpace(articleId) || string.IsNullOrWhiteSpace(content))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (bllUser.GetCount <JuActivityInfo>(string.Format(" JuActivityID = {0} ", articleId)) == 0)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            //敏感词检查
            BLLFilterWord bllFilterWord = new BLLFilterWord();
            string        errmsg        = "";

            if (!bllFilterWord.CheckFilterWord(content, this.bllUser.WebsiteOwner, out errmsg, "0"))
            {
                apiResp.msg  = errmsg;
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            //添加评论
            int            reviewId = 0;
            JuActivityInfo article  = bll.GetJuActivity(int.Parse(articleId), true);

            BLLJIMP.Enums.ReviewTypeKey reviewType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment;
            if (article.ArticleType == "Question")
            {
                reviewType = BLLJIMP.Enums.ReviewTypeKey.Answer;
            }
            var addResult = bllReview.AddReview(reviewType, articleId, replyId, this.currentUserInfo.UserID, "评论", content, this.bll.WebsiteOwner, out reviewId, isHideUserName);

            if (addResult)
            {
                if (reviewType == BLLJIMP.Enums.ReviewTypeKey.Answer)
                {
                    bllUser.AddUserScoreDetail(this.currentUserInfo.UserID, EnumStringHelper.ToString(ScoreDefineType.AnswerQuestions), this.bll.WebsiteOwner, null, null);
                }

                if (article.ArticleType == "Question")
                {
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.QuestionIsAnswered, this.currentUserInfo, article, article.UserID, content);

                    List <UserInfo> users = bllUser.GetRelationUserList(BLLJIMP.Enums.CommRelationType.JuActivityFollow, articleId);
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.FollowQuestionIsAnswered, this.currentUserInfo, article, users, content);
                }
                apiResp.status = true;
                apiResp.msg    = "评论完成";
                apiResp.result = reviewId.ToString();
                apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            }
            else
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "评论出错";
            }
            bllReview.ContextResponse(context, apiResp);
        }
Exemple #16
0
        /// <summary>
        /// 获取篇文章内容
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetSingleArticle(HttpContext context)
        {
            var          source = bllJuactivity.GetJuActivity(Convert.ToInt32(context.Request["articleid"], 16));
            string       host   = string.Format("http://{0}", context.Request.Url.Authority);
            ArticleModel model  = new ArticleModel();

            model.ArticleTitle   = source.ActivityName;
            model.ArticleContent = source.ActivityDescription;

            #region 报名表单
            try
            {
                //加载报名表单
                if ((!string.IsNullOrEmpty(source.SignUpActivityID)) && (int.Parse(source.SignUpActivityID) > 0))
                {
                    //当前登录信息
                    ZentCloud.BLLJIMP.Model.UserInfo currUserInfo = new BLLJIMP.Model.UserInfo();
                    if (bll.IsLogin)
                    {
                        currUserInfo = DataLoadTool.GetCurrUserModel();
                    }

                    System.Text.StringBuilder sbAppend = new System.Text.StringBuilder();
                    sbAppend.AppendLine("<link type=\"text/css\" rel=\"stylesheet\" href=\"/css/buttons.css\"/>");
                    sbAppend.AppendLine(" <style type=\"text/css\">input[type='text'],textarea{height:30px;width:100%;border-radius: 2px;margin-top:5px;}</style>");
                    sbAppend.AppendLine("<script src=\"/Scripts/jquery.form.js\" type=\"text/javascript\"></script>");
                    sbAppend.AppendLine("<form id=\"formsignin\">");

                    var mapList = bllActivity.GetActivityFieldMappingList(source.SignUpActivityID);
                    foreach (var item in mapList)
                    {
                        if (item.FieldName.Equals("Name"))
                        {
                            sbAppend.AppendLine(string.Format("<input  placeholder=\"姓名\" name=\"Name\"  id=\"txtName\" type=\"text\" value=\"{0}\">", currUserInfo.TrueName));
                        }
                        else if (item.FieldName.Equals("Phone"))
                        {
                            sbAppend.AppendLine(string.Format("<input  placeholder=\"手机\" name=\"Phone\"  id=\"txtPhone\" type=\"text\" value=\"{0}\">", currUserInfo.Phone));
                        }
                        else
                        {
                            if (item.IsMultiline.Equals(1))
                            {
                                sbAppend.AppendLine(string.Format("<textarea  placeholder=\"{0}\" name=\"{1}\" style=\"height:50px;\" ></textarea>", item.MappingName, "K" + item.ExFieldIndex.ToString()));
                            }
                            else
                            {
                                if (item.MappingName.Contains("公司"))
                                {
                                    sbAppend.AppendLine(string.Format("<input  placeholder=\"{0}\" name=\"{1}\" type=\"text\" value=\"{2}\">", item.MappingName, "K" + item.ExFieldIndex.ToString(), currUserInfo.Company));
                                }
                                else if (item.MappingName.Contains("职位") || item.MappingName.Contains("职务"))
                                {
                                    sbAppend.AppendLine(string.Format("<input  placeholder=\"{0}\" name=\"{1}\" type=\"text\" value=\"{2}\">", item.MappingName, "K" + item.ExFieldIndex.ToString(), currUserInfo.Postion));
                                }
                                else if (item.MappingName.Contains("邮箱") || item.MappingName.Contains("邮件") || item.MappingName.ToLower().Contains("email"))
                                {
                                    sbAppend.AppendLine(string.Format("<input  placeholder=\"{0}\" name=\"{1}\" type=\"text\" value=\"{2}\">", item.MappingName, "K" + item.ExFieldIndex.ToString(), currUserInfo.Email));
                                }
                                else
                                {
                                    sbAppend.AppendLine(string.Format("<input  placeholder=\"{0}\" name=\"{1}\" type=\"text\">", item.MappingName, "K" + item.ExFieldIndex.ToString()));
                                }
                            }
                        }
                    }

                    sbAppend.AppendLine("<span class=\"button button-rounded button-flat-action\" style=\"width:86%;margin-top:10px;\"  onclick=\"SumitData()\" >提交</span>");
                    sbAppend.AppendLine(string.Format("<input  type=\"hidden\" value=\"{0}\" name=\"ActivityID\">", source.SignUpActivityID));
                    BLLJIMP.Model.UserInfo userInfo = bll.Get <BLLJIMP.Model.UserInfo>(string.Format(" UserId='{0}'", source.UserID));
                    sbAppend.AppendLine(string.Format("<input id=\"loginName\" type=\"hidden\" value=\"{0}\" name=\"LoginName\" />", ZentCloud.Common.Base64Change.EncodeBase64ByUTF8(userInfo.UserID))); //外部登录名
                    sbAppend.AppendLine(string.Format("<input id=\"loginPwd\" type=\"hidden\" value=\"{0}\" name=\"LoginPwd\" />", ZentCloud.Common.DEncrypt.ZCEncrypt(userInfo.Password)));              //外部登录密码
                    sbAppend.AppendLine("</form>");
                    //
                    sbAppend.AppendLine("<script type=\"text/javascript\">");
                    sbAppend.AppendLine("function SumitData() {");
                    sbAppend.AppendLine("var Name = $(\"#txtName\").val();");
                    sbAppend.AppendLine("var Phone = $(\"#txtPhone\").val();");
                    sbAppend.AppendLine("if (Name == \"\" || (Phone == \"\")) {alert(\"请输入姓名、手机号码\");return false; }");

                    sbAppend.AppendLine("$(\"#formsignin\").ajaxSubmit({");
                    sbAppend.AppendLine("url: \"/serv/ActivityApiJson.ashx\",");
                    sbAppend.AppendLine("type: \"post\",");
                    sbAppend.AppendLine("dataType: \"json\",");
                    sbAppend.AppendLine("success: function (resp) {");
                    sbAppend.AppendLine("if (resp.Status == 0) {//清空");
                    sbAppend.AppendLine(" $('input:text').val(\"\");");
                    sbAppend.AppendLine("$('textarea').val(\"\");");
                    sbAppend.AppendLine("alert(\"提交成功!\");");
                    sbAppend.AppendLine("return;");
                    sbAppend.AppendLine("}");
                    sbAppend.AppendLine("else if (resp.Status == 1) {alert(\"重复提交!\");}");
                    sbAppend.AppendLine(" else {alert(resp.Msg);}");
                    sbAppend.AppendLine("}});return false;  };");
                    sbAppend.AppendLine("</script>");


                    model.ArticleContent += sbAppend.ToString();
                }
            }
            catch (Exception)
            {
            }
            //加载报名表单
            #endregion

            model.ArticleThumbnails = bll.GetImgUrl(source.ThumbnailsPath);
            //model.ArticleUrl = string.Format("{0}/{1}/details.chtml", host, source.JuActivityIDHex);
            return(Common.JSONHelper.ObjectToJson(model));
        }
Exemple #17
0
        public void ProcessRequest(HttpContext context)
        {
            string rtype    = context.Request["rtype"],
                   mainId   = context.Request["mainId"],
                   exchange = context.Request["exchange"]; //1时mainId,relationId互换

            BLLJIMP.Enums.CommRelationType nType = new BLLJIMP.Enums.CommRelationType();
            if (!Enum.TryParse(rtype, out nType))
            {
                apiResp.code = 1;
                apiResp.msg  = "类型格式不能识别";
                bLLCommRelation.ContextResponse(context, apiResp);
                return;
            }
            if (mainId == "0" || string.IsNullOrWhiteSpace(mainId))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound;
                apiResp.msg  = "关联主Id错误";
                bLLCommRelation.ContextResponse(context, apiResp);
                return;
            }
            currentUserInfo = bLLCommRelation.GetCurrentUserInfo();
            if (this.currentUserInfo == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin;
                apiResp.msg  = "请先登录";
                bLLCommRelation.ContextResponse(context, apiResp);
                return;
            }
            string relationId = this.currentUserInfo.AutoID.ToString();

            if (mainId == relationId)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "不能跟自己建立关系";
                bLLCommRelation.ContextResponse(context, apiResp);
                return;
            }
            if (exchange == "1")
            {
                relationId = mainId;
                mainId     = this.currentUserInfo.AutoID.ToString();
            }

            if (!this.bLLCommRelation.ExistRelation(nType, mainId, relationId))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsRepeat;
                apiResp.msg  = "关系不存在";
                bLLCommRelation.ContextResponse(context, apiResp);
                return;
            }

            if (this.bLLCommRelation.DelCommRelation(nType, mainId, relationId))
            {
                if (nType == CommRelationType.FriendApply)
                {
                    UserInfo toUser = bllUser.GetUserInfoByAutoID(int.Parse(mainId));
                    //拒绝好友申请删除申请关系
                    bLLCommRelation.DelCommRelation(CommRelationType.FriendApply, relationId, mainId);
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.RejectFriendApply, this.currentUserInfo, null, new List <UserInfo>()
                    {
                        toUser
                    }, null);
                }
                else if (nType == CommRelationType.Friend)
                {
                    UserInfo toUser = bllUser.GetUserInfoByAutoID(int.Parse(mainId));
                    //删除好友关系
                    bLLCommRelation.DelCommRelation(CommRelationType.Friend, mainId, relationId);
                    bLLCommRelation.DelCommRelation(CommRelationType.Friend, relationId, mainId);

                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.DeleteFriend, this.currentUserInfo, null, new List <UserInfo>()
                    {
                        toUser
                    }, null);
                }
                else if (nType == CommRelationType.JuActivityPraise)
                {
                    JuActivityInfo article = bll.GetJuActivity(int.Parse(mainId), false);

                    //点赞数直接修改到主表
                    int praiseCount = bLLCommRelation.GetRelationCount(nType, mainId, null);
                    bll.Update(article, string.Format("PraiseCount={0}", praiseCount), string.Format("JuActivityID={0}", article.JuActivityID));
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.DisJuActivityPraise, this.currentUserInfo, article, article.UserID, null);
                }

                apiResp.status = true;
                apiResp.msg    = "删除完成";
                apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            }
            else
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "删除失败";
            }
            bLLCommRelation.ContextResponse(context, apiResp);
        }
Exemple #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     model = bllJuActivity.GetJuActivity(int.Parse(Request["aid"]));
 }