public IHttpActionResult ReadMsg([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string        UserId = Convert.ToString(value.user_id);
                List <string> msgIds = JsonConvert.DeserializeObject <List <string> >(Convert.ToString(value.msg_ids));

                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());

                MessageDomain MD = new MessageDomain();
                result = MD.ReadMsg(UserId, msgIds);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Message", "ReadMsg", "api/message/read", "阅读通知接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "请求失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult GetFaqDtlById(string user_id, string faq_id)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(user_id, new VerifyUser());
                VD.Run(faq_id, new VerifyFaq());

                FeedDomain FD = new FeedDomain();
                result = FD.GetFaqDtlById(user_id, faq_id);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Feed", "GetTopicDtlById", "bus/feed/gettopicinfo", "根据话题ID获取话题的详细信息", $"用户ID:{user_id};问答ID:{faq_id};", ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult GetUnreadMessage(string userid)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(userid, new VerifyUser());

                MessageDomain MD = new MessageDomain();
                result = MD.UnreadMessage(userid);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Message", "GetUnreadMessage", "api/message/getunread", "获取用户未读通知数量", $"用户ID:{userid}", ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult GetMessageInfo(string userid, int cursor, int count)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(userid, new VerifyUser());

                MessageDomain MD = new MessageDomain();
                result = MD.GetMessageInfo(userid, cursor, count);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Message", "GetMessageInfo", "api/message/getmsg", "获取用户收到的通知", $"用户ID:{userid};已下发数:{cursor};本次请求数:{count}", ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult ShareContent([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId     = Convert.ToString(value.user_id);
                string ContentId  = Convert.ToString(value.content_id);
                string ToSharedId = Convert.ToString(value.to_shared_id);
                int    ShareType  = Convert.ToInt32(value.share_type);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                if (ShareType == 1)
                {
                    VD.Run(ContentId, new VerifyFirstPath());
                    VD.Run(ToSharedId, new VerifyFaq());
                }

                FeedDomain FD = new FeedDomain();
                result = FD.ShareContent(UserId, ContentId, ToSharedId, ShareType);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Feed", "ShareContent", "bus/feed/share", "分享接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "提交失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult GetPermission(string user_id)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                LoginDomain LD = new LoginDomain();
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(user_id, new VerifyUser());

                result = LD.GetRolePermission(user_id);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Login", "GetPermission", "api/login/per", "获取当前账号拥有的权限", "当前登录用户ID:" + user_id, ex.Message.ToString(), "POST");

                result.status = 0;
                result.msg    = "数据异常,请重试";
                result.time   = FunctionHelper.GetTimestamp();
                result.data   = new List <string>();
                return(Json(result));
            }
        }
Beispiel #7
0
        /// <summary>
        /// 获取用户所有权限
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public RetJsonModel GetRolePermission(string userId)
        {
            var db = DBContext.GetInstance;

            try
            {
                //返给前台的JSON实体
                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = FunctionHelper.GetTimestamp();

                List <string> data = db.Queryable <SYS_USER_PERMISSION>()
                                     .Where(x => x.USER_ID == userId && x.STATE == "A")
                                     .Select(x => x.PERMISSION_CODE).ToList();

                jsonModel.status = 1;
                jsonModel.msg    = "成功";
                jsonModel.data   = data;

                return(jsonModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IHttpActionResult Get(string user_id, string path_id, int cursor, int count)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(user_id, new VerifyUser());
                VD.Run(path_id, new VerifyFirstPath());

                PlanDomain PD = new PlanDomain();
                result = PD.GetPlanByPath(user_id, path_id, cursor, count);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Plan", "Get", "bus/plan/get", "根基规划id获取计划", "用户ID:" + user_id + "已经获取的卡片数量:" + cursor + ";本次请求的卡片数量:" + count + "计划头ID" + path_id, ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
Beispiel #9
0
        /// <summary>
        /// 分享计划
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="planId">计划头ID</param>
        /// <returns></returns>
        public RetJsonModel SharePlan(string userId, string planId)
        {
            var db = DBContext.GetInstance;

            try
            {
                DateTime now       = db.GetDate();
                int      timestamp = FunctionHelper.GetTimestamp();

                var data = db.Queryable <BUS_PLAN_HEADER>()
                           .Where(x => x.STATE == "A" && x.ID == planId)
                           .First();
                db.Ado.BeginTran();
                //分享计划的方法
                SharePlanFun(db, planId, now, timestamp);

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time   = timestamp;
                jsonModel.status = 1;
                jsonModel.msg    = "分享成功";

                db.Ado.CommitTran();

                return(jsonModel);
            }
            catch (Exception ex)
            {
                db.Ado.RollbackTran();
                throw ex;
            }
        }
Beispiel #10
0
        /// <summary>
        /// 点赞/取消点赞
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="typeId">被点赞的ID</param>
        /// <param name="favourType">点赞类型(1:一级职业路径;2:二级职业路径;3:三级职业路径;4:一级评论;5:二级评论)</param>
        /// <param name="pathType">职业路径等级</param>
        /// <returns></returns>
        public RetJsonModel Favour(string userId, string typeId, int favourType)
        {
            var db = DBContext.GetInstance;

            try
            {
                DateTime now       = db.GetDate();
                int      timestamp = FunctionHelper.GetTimestamp();

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = timestamp;

                db.Ado.BeginTran();
                //点赞
                RunFavour RF = new RunFavour(favourType);
                RF.Run(db, userId, typeId, favourType, now, timestamp);

                db.Ado.CommitTran();

                jsonModel.status = 1;
                jsonModel.msg    = "点赞成功";
                return(jsonModel);
            }
            catch (Exception ex)
            {
                db.Ado.RollbackTran();
                throw ex;
            }
        }
        public IHttpActionResult PostPlan([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId  = Convert.ToString(value.user_id);
                int    IsShare = Convert.ToInt32(value.is_share);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                PlanHeaderModel planModel = JsonConvert.DeserializeObject <PlanHeaderModel>(Convert.ToString(value.plan_info));
                VD.Run(planModel.FIRST_PATH_ID, new VerifyFirstPath());

                PlanDomain PD = new PlanDomain();
                result = PD.PostPlan(UserId, IsShare, planModel);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Plan", "PostPlan", "bus/plan/post", "发布计划接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "发布失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult ChangeNickName([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId   = Convert.ToString(value.user_id);
                string NickName = Convert.ToString(value.nick_name);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());

                UserDomain UD = new UserDomain();
                result = UD.ChangeNickName(UserId, NickName);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("User", "ChangeNickName", "api/user/changename", "修改用户名", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult PostComment([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId   = Convert.ToString(value.user_id);
                string pathId   = Convert.ToString(value.path_id);
                string content  = Convert.ToString(value.content);
                int    pathType = Convert.ToInt32(value.path_type);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                VD.Run(pathId, InterfaceArray.DicVD[pathType]);

                UserDomain UD = new UserDomain();
                result = UD.PublishComment(UserId, pathId, content, pathType);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("User", "PostComment", "api/user/p/comment", "发表对职业路线的评论", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "评论失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult PostCareerPath([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId  = Convert.ToString(value.user_id);
                string FirstId = Convert.ToString(value.first_id);

                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                VD.Run(FirstId, new VerifyFirstPath());

                UserDomain UD = new UserDomain();
                result = UD.FollowCareerPath(UserId, FirstId);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("User", "PostCareerPath", "api/user/path", "关注职业路径接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "关注失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult PostReviewerVote([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId    = Convert.ToString(value.user_id);
                string modifyId  = Convert.ToString(value.modify_id);
                int    isSupport = Convert.ToInt32(value.is_support);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                VD.Run(modifyId, new VerifyModifyPath());

                UserDomain UD = new UserDomain();
                result = UD.ReviewerVote(UserId, modifyId, isSupport);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("User", "PostReviewerVote", "api/user/p/rvote", "Reviewer表决接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult PostFavour([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId     = Convert.ToString(value.user_id);
                string TypeId     = Convert.ToString(value.type_id);
                int    favourType = Convert.ToInt32(value.favour_type);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                VD.Run(TypeId, InterfaceArray.DicVD[favourType]);

                UserDomain UD = new UserDomain();
                result = UD.Favour(UserId, TypeId, favourType);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("User", "PostFavour", "api/user/p/favour", "点赞接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult PostIsLogin([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId = Convert.ToString(value.user_id);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());

                LoginDomain LD = new LoginDomain();
                result = LD.IsLogin(UserId);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Login", "PostIsLogin", "api/login/status", "验证账号是否处在登陆中", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.msg    = "数据异常,请重试";
                result.time   = FunctionHelper.GetTimestamp();
                result.data   = false;
                return(Json(result));
            }
        }
        public IHttpActionResult GetDetailedPage(string user_id, string path_id)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                if (!string.IsNullOrEmpty(user_id))
                {
                    VD.Run(user_id, new VerifyUser());
                }
                VD.Run(path_id, new VerifyFirstPath());

                FeedDomain FD = new FeedDomain();
                result = FD.GetPathDetailedInfo(user_id, path_id);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Feed", "GetDetailedPage", "bus/feed/detailed", "获取职业路径详情页接口", "用户ID:" + user_id + ";职业路径ID:" + path_id, ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult PostAduit([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                int    isPass = Convert.ToInt32(value.is_pass);
                int    isDel  = Convert.ToInt32(value.is_del);
                string UserId = Convert.ToString(value.user_id);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());

                List <string> firstId = JsonConvert.DeserializeObject <List <string> >(Convert.ToString(value.first_id));
                FeedDomain    FD      = new FeedDomain();
                result = FD.AuditPath(firstId, isPass, isDel, UserId);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Feed", "PostAduit", "bus/feed/aduit", "审批职业路径接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "审核失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult PostModify([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string userId    = Convert.ToString(value.user_id);
                string pathId    = Convert.ToString(value.path_id);
                string content   = Convert.ToString(value.content);
                int    pathClass = Convert.ToInt32(value.path_class);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(userId, new VerifyUser());
                VD.Run(pathId, InterfaceArray.DicVD[pathClass]);

                FeedDomain FD = new FeedDomain();
                result = FD.ModifyPath(userId, pathId, pathClass, content);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Feed", "PostModify", "bus/feed/modify", "发起对某一级职业规划修改的接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult UpdateStatus([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId    = Convert.ToString(value.user_id);
                string PlanId    = Convert.ToString(value.plan_id);
                string PlanDtlId = Convert.ToString(value.plan_dtl_id);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                VD.Run(PlanId, new VerifyPlanHead());
                VD.Run(PlanDtlId, new VerifyPlanDetail());

                PlanDomain PD = new PlanDomain();
                result = PD.UpdateStatus(UserId, PlanId, PlanDtlId);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Plan", "UpdateStatus", "bus/plan/complete", "完成计划接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "请求失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult GetHistortModify(string user_id, string path_id, int path_class, int cursor, int count)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(user_id, new VerifyUser());
                VD.Run(path_id, InterfaceArray.DicVD[path_class]);

                FeedDomain FD = new FeedDomain();
                result = FD.GetHistortModify(user_id, path_id, path_class, cursor, count);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                string message = "用户ID:" + user_id + ";职业规划ID:" + path_id + ";职业规划等级:" + path_class + ";已下发数:" + cursor + ";本次请求数:" + count;
                FunctionHelper.SaveFailLog("Feed", "GetHistortModify", "bus/feed/hmodify", "查询某一职业规划的历史修改记录", message, ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult SharePlanCancel([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId = Convert.ToString(value.user_id);
                string PlanId = Convert.ToString(value.plan_id);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());
                VD.Run(PlanId, new VerifyPlanHead());

                PlanDomain PD = new PlanDomain();
                result = PD.SharePlanCancel(UserId, PlanId);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Plan", "SharePlanCancel", "bus/plan/sharecancel", "取消分享计划接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "取消失败,请重试";
                return(Json(result));
            }
        }
        public IHttpActionResult GetModifyDetailedInfo(string user_id, string modify_id)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(user_id, new VerifyUser());
                VD.Run(modify_id, new VerifyModifyPath());

                FeedDomain FD = new FeedDomain();
                result = FD.GetModifyDetailedInfo(user_id, modify_id);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                string message = "用户ID:" + user_id + ";修改职业规划表ID:" + modify_id;
                FunctionHelper.SaveFailLog("Feed", "GetModifyDetailedInfo", "bus/feed/hmodif/detailed", "查询修改职业规划的详情页", message, ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
Beispiel #25
0
        /// <summary>
        /// 删除计划
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="planId">计划头ID</param>
        /// <returns></returns>
        public RetJsonModel DeletePlan(string userId, string planId)
        {
            var db = DBContext.GetInstance;

            try
            {
                int timestamp = FunctionHelper.GetTimestamp();

                db.Ado.BeginTran();

                db.Deleteable <BUS_PLAN_HEADER>()
                .Where(x => x.ID == planId)
                .ExecuteCommand();
                db.Deleteable <BUS_PLAN_DETAIL>()
                .Where(x => x.HEADER_ID == planId)
                .ExecuteCommand();

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time   = timestamp;
                jsonModel.status = 1;
                jsonModel.msg    = "删除成功";

                db.Ado.CommitTran();

                return(jsonModel);
            }
            catch (Exception ex)
            {
                db.Ado.RollbackTran();
                throw ex;
            }
        }
        public IHttpActionResult PublishQues([FromBody] dynamic value)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                string UserId    = Convert.ToString(value.user_id);
                string Desc      = Convert.ToString(value.desc);
                string TopicName = Convert.ToString(value.topic_name);
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(UserId, new VerifyUser());

                FeedDomain FD = new FeedDomain();
                result = FD.PublishQues(UserId, Desc, TopicName);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Feed", "PublishQues", "bus/feed/publishques", "问答-发起提问接口", Convert.ToString(value), ex.Message.ToString(), "POST");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "提交失败,请重试";
                return(Json(result));
            }
        }
Beispiel #27
0
        /// <summary>
        /// 验证账号是否在登陆中
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        public RetJsonModel IsLogin(string userId)
        {
            var db = DBContext.GetInstance;

            try
            {
                //返给前台的JSON实体
                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = FunctionHelper.GetTimestamp();

                SYS_USER_ACCOUNT account = db.Queryable <SYS_USER_ACCOUNT>()
                                           .Where(x => x.STATE == "A" && x.ID == userId)
                                           .First();
                if (account != null && account.STATUS == 1)
                {
                    jsonModel.status = 1;
                    jsonModel.msg    = "账号登陆中";
                    jsonModel.data   = true;
                }
                else
                {
                    jsonModel.status = 0;
                    jsonModel.msg    = "账号未登录";
                    jsonModel.data   = false;
                }
                return(jsonModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IHttpActionResult GetTabsInfo(string user_id)
        {
            RetJsonModel result = new RetJsonModel();

            try
            {
                //数据校验
                RunVerify VD = new RunVerify();
                VD.Run(user_id, new VerifyUser());

                FeedDomain FD = new FeedDomain();
                result = FD.GetTabsInfo(user_id);
                return(Json(result));
            }
            catch (Exception ex)
            {
                //记录失败日志
                FunctionHelper.SaveFailLog("Feed", "GetTabsInfo", "bus/feed/gettabs", "下发用户个人页tab信息", $"用户ID:{user_id}", ex.Message.ToString(), "GET");

                result.status = 0;
                result.time   = FunctionHelper.GetTimestamp();
                result.msg    = "数据异常,请重试";
                return(Json(result));
            }
        }
Beispiel #29
0
        /// <summary>
        /// 普通用户投票
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="modifyId">修改职业规划ID</param>
        /// <param name="isSupport">是否赞同(1:赞同;2:反对)</param>
        /// <returns></returns>
        public RetJsonModel NormalVote(string userId, string modifyId, int isSupport)
        {
            var db = DBContext.GetInstance;

            try
            {
                DateTime now       = db.GetDate();
                int      timestamp = FunctionHelper.GetTimestamp();

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = timestamp;

                int count = db.Queryable <BUS_MODIFIED_VOTE>()
                            .Where(x => x.USER_ID == userId && x.MODIFY_PATH_ID == modifyId && x.STATE == "A")
                            .Count();
                if (count != 0)
                {
                    jsonModel.status = 0;
                    jsonModel.msg    = "您已经参与过此投票";
                    return(jsonModel);
                }

                db.Ado.BeginTran();
                //在投票记录表插入投票人的投票情况
                BUS_MODIFIED_VOTE model = new BUS_MODIFIED_VOTE();
                model.ID = Guid.NewGuid().ToString();
                model.DATETIME_CREATED = now;
                model.STATE            = "A";
                model.TIMESTAMP_INT    = timestamp;
                model.USER_ID          = userId;
                model.MODIFY_PATH_ID   = modifyId;
                model.IS_SUPPORT       = isSupport;
                db.Insertable(model).ExecuteCommand();

                //根据赞成还是反对,更新修改职业规划表的投票情况
                db.Updateable <BUS_MODIFY_PATH>()
                .SetColumnsIF(isSupport == 1, x => new BUS_MODIFY_PATH()
                {
                    DATETIME_MODIFIED = now,
                    SUPPORT           = x.SUPPORT + 1
                })
                .SetColumnsIF(isSupport == 0, x => new BUS_MODIFY_PATH()
                {
                    DATETIME_MODIFIED = now,
                    OPPOSE            = x.OPPOSE + 1
                }).Where(x => x.ID == modifyId && x.STATE == "A").ExecuteCommand();

                db.Ado.CommitTran();

                jsonModel.status = 1;
                jsonModel.msg    = "投票成功";
                return(jsonModel);
            }
            catch (Exception ex)
            {
                db.Ado.RollbackTran();
                throw ex;
            }
        }
Beispiel #30
0
        /// <summary>
        /// 登录方法
        /// </summary>
        /// <param name="userId">账号</param>
        /// <param name="passWord">密码</param>
        /// <returns></returns>
        public RetJsonModel Login(string userId, string passWord)
        {
            var db = DBContext.GetInstance;

            try
            {
                DateTime now = db.GetDate();
                //返给前台的JSON实体
                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = FunctionHelper.GetTimestamp();

                var data = db.Queryable <SYS_USER_ACCOUNT, SYS_USER_INFO>((a, b) => new object[] {
                    JoinType.Left, a.ID == b.USER_ID && a.STATE == b.STATE
                }).Where((a, b) => a.ACCOUNT_NUMBER == userId && a.STATE == "A")
                           .Select((a, b) => new
                {
                    a.ID,
                    a.PASSWORD,
                    b.NICK_NAME
                }).First();
                if (data != null)
                {
                    if (data.PASSWORD == passWord)
                    {
                        db.Updateable <SYS_USER_ACCOUNT>().SetColumns(x => new SYS_USER_ACCOUNT()
                        {
                            STATUS            = 1,
                            DATETIME_MODIFIED = now
                        }).Where(x => x.ID == data.ID).ExecuteCommand();

                        LoginReturnModel lrm = new LoginReturnModel();
                        lrm.user_info = new UserInfoReturnModel
                        {
                            USER_ID   = data.ID,
                            NiCK_NAME = data.NICK_NAME
                        };
                        jsonModel.status = 1;
                        jsonModel.msg    = "登录成功";
                        jsonModel.data   = lrm;
                    }
                    else
                    {
                        jsonModel.status = 0;
                        jsonModel.msg    = "密码错误,请重试";
                    }
                }
                else
                {
                    jsonModel.status = 0;
                    jsonModel.msg    = "账号不存在,请重试";
                }
                return(jsonModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public JsonResult ArticleUpdate()
 {
     var ret = new RetJsonModel();
     var articleContent = HttpUtility.UrlDecode(Request.Form["Content"]);
     var userIdStr = Request.Form["UserID"];
     var articeIdStr = Request.Form["ArticleID"];
     try
     {
         var articleId = long.Parse(articeIdStr);
         var userId = long.Parse(userIdStr);
         var article = _db.Articles.Find(articleId);
         if (Session["LoggedUserID"].Equals(userIdStr) && article.AuthorId == userId)
             if (Session["LoggedUserID"].Equals(userIdStr) && article.AuthorId == userId)
             {
                 if (articleContent != null)
                     article.Content = HttpUtility.HtmlEncode(articleContent.Replace("style=\"height:", "style=\"name:"));
                 article.ModifyDate = DateTime.Now;
                 _db.SaveChanges();
                 ret.IsAccept = 1;
                 ret.UserId = article.AuthorId.ToString();
             }
             else
             {
                 ret.IsAccept = 0;
                 ret.Error = "Update Failed";
             }
     }
     catch (Exception ex)
     {
         ret.IsAccept = 0;
         ret.Error = ex.ToString();
     }
     return Json(ret);
 }
        public JsonResult FileUpload()
        {
            var retList = new LinkedList<RetJsonModel>();
            for (var i = 0; i < Request.Files.Count; i++)
            {
                var file = Request.Files[i];
                if (file == null) continue;
                var ret = new RetJsonModel
                {
                    ContentType = file.ContentType,
                    UserId = Session["LoggedUserID"].ToString()
                };
                if (ret.ContentType.Contains("image/"))
                {
                    ret.IsAccept = 0;
                    ret.FileTypeAccept = "yes";
                    ret.FileName = DateTime.Now.ToString("yyyyMMddHHmmss") + '_' + i + '_' + file.FileName;
                    if (!string.IsNullOrEmpty(ret.UserId))
                    {

                        ret.Url = "/Content/Users/" + ret.UserId + "/" + ret.FileName;
                        var path = Path.Combine(Server.MapPath("~/Content/Users/" + ret.UserId + ""), ret.FileName);
                        var stream = file.InputStream;
                        using (var fileStream = System.IO.File.Create(path))
                        {
                            stream.CopyTo(fileStream);
                        }
                        var resizer = new ImageResizer(@path);
                        var thumbtailPath = Path.Combine(Server.MapPath("~/Content/Users/" + ret.UserId + "/thumbtail/"), ret.FileName);
                        resizer.Resize(400, 400, ImageEncoding.Jpg90);
                        if (!Directory.Exists(Server.MapPath("~/Content/Users/" + ret.UserId + "/thumbtail/")))
                            Directory.CreateDirectory(Server.MapPath("~/Content/Users/" + ret.UserId + "/thumbtail/"));
                        resizer.SaveToFile(@thumbtailPath);
                        var image = new ImageViewModel();
                        var imageMetaDate = new ImageMetaData(Server.MapPath(ret.Url));
                        image.FileName = ret.FileName;
                        image.UpdateDate = DateTime.Now;
                        image.UserId = long.Parse(ret.UserId);
                        image.Url = ret.Url;
                        image.ContentType = file.ContentType;
                        _db.Images.Add(image);
                        imageMetaDate.FetchData();
                        var metadata = imageMetaDate.GetMetaData();
                        _db.ImageMetaData.Add(metadata);
                        _db.SaveChanges();
                    }
                    else
                    {
                        ret.IsAccept = 1;
                        ret.Error = "Member Session Expired";
                    }

                }
                else
                {
                    ret.IsAccept = 1;
                    ret.FileName = file.FileName;
                    ret.Error = "Content Type Deny";
                }
                retList.AddLast(ret);
            }
            var javaScriptSerializer = new JavaScriptSerializer();
            var jsonString = javaScriptSerializer.Serialize(retList);
            return Json(jsonString);
        }
 public JsonResult TitleUpdate()
 {
     var ret = new RetJsonModel();
     var titleStr = HttpUtility.UrlDecode(Request.Form["Title"]);
     var subTitleStr = HttpUtility.UrlDecode(Request.Form["SubTitle"]);
     var userIdStr = Request.Form["UserID"];
     var articeIdStr = Request.Form["ArticleID"];
     try
     {
         var articleId = long.Parse(articeIdStr);
         var userId = long.Parse(userIdStr);
         var article = _db.Articles.First(a => a.ArticleId == articleId);
         if (Session["LoggedUserID"].Equals(userIdStr) && article.AuthorId == userId)
         {
             if (titleStr != null) article.Title = Regex.Replace(titleStr, "[^0-9a-zA-Z \u4E00-\u9FFF]+", "");
             if (subTitleStr != null)
                 article.SubTitle = Regex.Replace(subTitleStr, "[^0-9a-zA-Z \u4E00-\u9FFF]+", "");
             article.ModifyDate = DateTime.Now;
             _db.SaveChanges();
             ret.IsAccept = 1;
             ret.UserId = article.AuthorId.ToString();
         }
         else
         {
             ret.IsAccept = 0;
             ret.Error = "Update Failed";
         }
     }
     catch (Exception ex)
     {
         ret.IsAccept = 0;
         ret.Error = ex.ToString();
     }
     return Json(ret);
 }