/// <summary>
        /// 修改
        /// </summary>
        public static string Edit(HttpContext context)
        {
            var uid = context.Request["UID"];
            //var userId = websiteOwner;//Comm.DataLoadTool.GetCurrUserID();
            //if (string.IsNullOrEmpty(userid))
            //{
            //    return "请重新登录";
            //}
            var keyword   = context.Request["MsgKeyword"];
            var matchType = context.Request["MatchType"];
            var oldInfo   = bll.Get <WeixinReplyRuleInfo>(string.Format("UID={0}", uid));

            if (oldInfo.MsgKeyword != keyword)//对比关键字已经改变
            {
                //关键字改变,检查关键字是否重复
                if (!bll.CheckUserKeyword(websiteOwner, keyword))
                {
                    return("关键字重复");
                }
            }

            var model = new WeixinReplyRuleInfo();

            model.UID          = uid;
            model.MsgKeyword   = keyword;
            model.MatchType    = matchType;
            model.ReplyContent = context.Request["ReplyContent"];
            model.ReceiveType  = "text";
            model.ReplyType    = "text";
            model.CreateDate   = DateTime.Now;
            model.RuleType     = 1;
            model.UserID       = websiteOwner;
            return(bll.Update(model).ToString().ToLower());
        }
Esempio n. 2
0
        /// <summary>
        /// 修改
        /// </summary>
        public static string Edit(HttpContext context)
        {
            //if (!_isedit)
            //{
            //    return null;
            //}
            var userid = Comm.DataLoadTool.GetCurrUserID();

            if (string.IsNullOrEmpty(userid))
            {
                return("请重新登录");
            }
            var flowid      = int.Parse(context.Request["FlowID"]);
            var flowname    = context.Request["FlowName"];
            var flowkeyword = context.Request["FlowKeyword"];
            var oldflowinfo = bll.Get <WXFlowInfo>(string.Format("FlowID={0}", flowid));

            if (oldflowinfo.FlowKeyword != flowkeyword)//对比关键字是否改变
            {
                //关键字改变,检查关键字是否重复
                if (!bll.CheckUserKeyword(userid, flowkeyword))
                {
                    return("关键字重复");
                }
            }
            WXFlowInfo model = new WXFlowInfo();

            model.FlowID           = flowid;
            model.UserID           = userid;
            model.FlowName         = flowname;
            model.FlowKeyword      = flowkeyword;
            model.FlowEndMsg       = context.Request["FlowEndMsg"];
            model.MemberLimitState = int.Parse(context.Request["MemberLimitState"]);
            model.FlowLimitMsg     = context.Request["FlowLimitMsg"];
            model.IsEnable         = int.Parse(context.Request["IsEnable"]);
            if (bll.Update(model, string.Format("FlowName='{0}',FlowKeyword='{1}',FlowEndMsg='{2}',MemberLimitState='{3}',FlowLimitMsg='{4}',IsEnable='{5}'", model.FlowName, model.FlowKeyword, model.FlowEndMsg, model.MemberLimitState, model.FlowLimitMsg, model.IsEnable), "FlowID=" + model.FlowID) > 0)
            {
                return("true");
            }
            return("false");
        }
Esempio n. 3
0
        private static string Edit(HttpContext context)
        {
            //if (!_isedit)
            //{
            //    return null;
            //}

            try
            {
                var uid = context.Request["UID"];
                //if (string.IsNullOrEmpty(userid))
                //{
                //    return "请重新登录";
                //}
                var keyword   = context.Request["MsgKeyword"];
                var matchType = context.Request["MatchType"];
                var oldInfo   = bll.Get <WeixinReplyRuleInfo>(string.Format("UID={0}", uid));
                if (oldInfo.MsgKeyword != keyword)//对比关键字已经改变
                {
                    //关键字改变,检查关键字是否重复
                    if (!bll.CheckUserKeyword(websiteOwner, keyword))
                    {
                        return("关键字重复");
                    }
                }
                var sourceType = context.Request["SourceType"];
                var sourceIds  = context.Request["SourceIds"];
                var model      = new WeixinReplyRuleInfo();
                model.UID         = uid;
                model.MsgKeyword  = keyword;
                model.MatchType   = matchType;
                model.ReceiveType = "news";
                model.ReplyType   = "news";
                model.RuleType    = 1;
                model.UID         = context.Request["UID"];
                model.UserID      = websiteOwner;
                WeixinReplyRuleImgsInfo ruleImgsInfo;
                if (bll.Update(model))//规则表更新成功,更新图文表信息
                {
                    if (!string.IsNullOrEmpty(sourceIds))
                    {
                        if (sourceType.Equals("imagelist"))//原有的图文表
                        {
                            //更新图文列表
                            bll.Delete(new WeixinReplyRuleImgsInfo(), string.Format("RuleID='{0}' And UID Not IN ({1})", uid, sourceIds));
                            return("true");
                        }
                        else if (sourceType.Equals("source"))//从素材表中选择
                        {
                            //删除旧图片
                            bll.Delete(new WeixinReplyRuleImgsInfo(), string.Format("RuleID='{0}'", uid));
                            //添加新图片
                            foreach (var item in sourceIds.Split(','))
                            {
                                var sourceInfo = bll.Get <WeixinMsgSourceInfo>(string.Format("SourceID='{0}'", item));
                                ruleImgsInfo             = new WeixinReplyRuleImgsInfo();
                                ruleImgsInfo.UID         = bll.GetGUID(BLLJIMP.TransacType.WeixinReplyRuleImgAdd);
                                ruleImgsInfo.RuleID      = model.UID;
                                ruleImgsInfo.Title       = sourceInfo.Title;
                                ruleImgsInfo.Description = sourceInfo.Description;
                                ruleImgsInfo.PicUrl      = sourceInfo.PicUrl;
                                ruleImgsInfo.Url         = sourceInfo.Url;
                                bll.Add(ruleImgsInfo);
                            }
                            return("true");
                        }
                    }
                    else
                    {
                        return("请选择素材");
                    }
                }
                else
                {
                    return("更新规则表失败");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            return("false");
        }