示例#1
0
        /// <summary>
        /// 只添加关键字
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public ActionResult AddAloneKeyword(wx_request_rule entity)
        {
            try
            {
                var wx_Reque = Wx_RequestRuleService.LoadEntities(w => w.req_keywords.Equals(entity.req_keywords)).FirstOrDefault();
                if (wx_Reque != null)
                {
                    return(Json(SysEnum.失败, "此关键字已存在"));
                }
                entity.add_time = DateTime.Now;

                if (Wx_RequestRuleService.AddEntity(entity) != null)
                {
                    SaveSyslog("添加关键字成功", SysLogType.后台日志, nowManager.name);
                    return(Json(SysEnum.成功, "添加成功"));
                }
                else
                {
                    SaveSyslog("添加关键字失败", SysLogType.后台日志, nowManager.name);
                    return(Json(SysEnum.成功, "添加失败"));
                }
            }
            catch (Exception)
            {
                return(Json(SysEnum.失败, "系统异常"));
            }
        }
示例#2
0
        public ActionResult AddKeyword(wx_request_content entity)
        {
            string keywords = Request["keywords"];
            var    wx_Reque = Wx_RequestRuleService.LoadEntities(w => w.req_keywords.Equals(keywords)).FirstOrDefault();

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

            wx_request_rule newWx_Rule = new wx_request_rule();

            newWx_Rule.rule_name     = Request["RuleName"];
            newWx_Rule.req_keywords  = keywords;
            newWx_Rule.request_type  = (int)WXRequestState.关键字回复;
            newWx_Rule.response_type = int.Parse(Request["ResponseType"]);
            newWx_Rule.add_time      = DateTime.Now;


            wx_request_content newWx_Content = new wx_request_content();

            newWx_Content.req_title   = entity.req_title;
            newWx_Content.detail_url  = entity.detail_url;
            newWx_Content.pic_url     = entity.pic_url;
            newWx_Content.media_url   = entity.media_url;
            newWx_Content.req_content = entity.req_content;
            newWx_Content.add_time    = DateTime.Now;
            newWx_Content.type_msg    = int.Parse(Request["ResponseType"]);
            newWx_Content.remark      = entity.remark;
            //newWx_Content.RId = newWx_Rule.RId;


            if (Wx_RequestRuleService.AddEntity(newWx_Rule, newWx_Content))
            {
                SaveSyslog("添加微信消息关键字成功", SysLogType.后台日志, nowManager.name);
                return(Json(SysEnum.成功, "添加成功"));
            }
            else
            {
                SaveSyslog("添加微信消息关键字失败", SysLogType.后台日志, nowManager.name);
                return(Json(SysEnum.失败, "添加失败"));
            }
        }