示例#1
0
        /// <summary>
        /// 修改关键字
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public ActionResult EditAloneKeyword(wx_request_rule entity)
        {
            try
            {
                var wx_Reque = Wx_RequestRuleService.LoadEntities(w => w.id == entity.id).FirstOrDefault();
                if (wx_Reque == null)
                {
                    return(Json(SysEnum.失败, "数据错误"));
                }

                var wx_RequeTwo = Wx_RequestRuleService.LoadEntities(w => w.req_keywords.Equals(entity.req_keywords) && w.id != entity.id).FirstOrDefault();
                if (wx_RequeTwo != null)
                {
                    return(Json(SysEnum.失败, "此关键字已存在"));
                }

                wx_Reque.req_keywords = entity.req_keywords;
                if (Wx_RequestRuleService.EditEntity(wx_Reque))
                {
                    SaveSyslog("修改关键字成功", SysLogType.后台日志, nowManager.name);
                    return(Json(SysEnum.成功, "修改成功"));
                }
                else
                {
                    SaveSyslog("修改关键字失败", SysLogType.后台日志, nowManager.name);
                    return(Json(SysEnum.成功, "修改失败"));
                }
            }
            catch (Exception)
            {
                return(Json(SysEnum.失败, "系统异常"));
            }
        }
示例#2
0
        /// <summary>
        /// 修改关键字与回复
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public ActionResult EditKeyword(wx_request_content entity)
        {
            var wx_Reque = Wx_RequestRuleService.LoadEntities(w => w.id == entity.rule_id).FirstOrDefault();

            if (wx_Reque == null)
            {
                return(Json(SysEnum.失败, "数据不存在"));
            }
            var keywords    = Request["keywords"];
            var wx_RequeTwo = Wx_RequestRuleService.LoadEntities(w => w.req_keywords.Equals(keywords) && w.id != entity.rule_id).FirstOrDefault();

            if (wx_RequeTwo != null)
            {
                return(Json(SysEnum.失败, "此关键字已存在"));
            }

            wx_Reque.req_keywords = keywords;


            var wx_Content = Wx_RequestContentService.LoadEntities(w => w.id == entity.id).FirstOrDefault();

            wx_Content.req_title   = entity.req_title;
            wx_Content.detail_url  = entity.detail_url;
            wx_Content.pic_url     = entity.pic_url;
            wx_Content.media_url   = entity.media_url;
            wx_Content.req_content = entity.req_content;
            wx_Content.remark      = entity.remark;
            if (Wx_RequestRuleService.EditEntity(wx_Reque, wx_Content))
            {
                SaveSyslog("修改微信消息关键字成功", SysLogType.后台日志, nowManager.name);
                return(Json(SysEnum.成功, "修改成功"));
            }
            else
            {
                SaveSyslog("修改微信消息关键字失败", SysLogType.后台日志, nowManager.name);
                return(Json(SysEnum.失败, "修改失败"));
            }
        }