Ejemplo n.º 1
0
        private string approvedApply(HttpContext context)
        {
            string        ids     = context.Request["ids"];
            List <string> userIds = ids.Split(',').ToList();

            for (int i = 0; i < userIds.Count; i++)
            {
                if (string.IsNullOrWhiteSpace(userIds[i]))
                {
                    continue;
                }
                if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.ApplyToTutor, null, userIds[i]) && !bllTutor.ExistTutor(userIds[i]))
                {
                    UserInfo user = bllUser.GetUserInfo(userIds[i]);
                    bllTutor.UpdateTutorInfoByUserInfo(user);
                }
                bllCommRelation.DelCommRelation(BLLJIMP.Enums.CommRelationType.ApplyToTutor, null, userIds[i]);
                bllSystemNotice.SendNotice(BLLSystemNotice.NoticeType.SystemMessage, null, null, userIds[i], "您已通过审核成为专家!");
            }
            resp.Status = 1;
            resp.Msg    = "审核完成";
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除商品收藏
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Delete(HttpContext context)
        {
            string collectType = context.Request["type"];
            string id          = context.Request["id"];

            BLLJIMP.Enums.CommRelationType relaType = BLLJIMP.Enums.CommRelationType.ProductCollect;
            if (!string.IsNullOrEmpty(collectType))
            {
                Enum.TryParse(collectType, out relaType);
            }
            if (bllCommRela.DelCommRelation(relaType, currentUserInfo.UserID, id))
            {
                resp.errmsg = "删除成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "删除失败";
            }
            return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Ejemplo n.º 3
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);
        }