Exemple #1
0
        /// <summary>
        /// 添加
        /// </summary>
        private static string Add(HttpContext context)
        {
            //if (!_isedit)
            //{
            //    return null;
            //}

            try
            {
                //var userid = websiteOwner; //Comm.DataLoadTool.GetCurrUserID();
                //if (string.IsNullOrEmpty(userid))
                //{
                //    return "请重新登录";
                //}
                var keyword   = context.Request["MsgKeyword"];
                var matchtype = context.Request["MatchType"];
                if (!bll.CheckUserKeyword(websiteOwner, keyword))
                {
                    return("关键字重复");
                }
                var model = new WeixinReplyRuleInfo();
                model.MsgKeyword  = keyword;
                model.MatchType   = matchtype;
                model.ReceiveType = "news";
                model.ReplyType   = "news";
                model.CreateDate  = DateTime.Now;
                model.RuleType    = 1;
                var sourceIds = context.Request["SourceIds"];
                model.UID    = bll.GetGUID(BLLJIMP.TransacType.WeixinReplyRuleAdd);
                model.UserID = websiteOwner;
                WeixinReplyRuleImgsInfo ruleImgsInfo;
                if (bll.Add(model))//规则表添加成功,往图文表插入
                {
                    if (!string.IsNullOrEmpty(sourceIds))
                    {
                        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");
                    }
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            return("false");
        }
        /// <summary>
        /// 添加
        /// </summary>
        private static string Add(HttpContext context)
        {
            //if (!_isedit)
            //{
            //    return null;
            //}


            var userid = Comm.DataLoadTool.GetCurrUserID();

            if (string.IsNullOrEmpty(userid))
            {
                return("请重新登录");
            }
            var flowname    = context.Request["FlowName"];
            var flowkeyword = context.Request["FlowKeyword"];

            if (!bll.CheckUserKeyword(userid, flowkeyword))
            {
                return("关键字重复");
            }
            WXFlowInfo model = new WXFlowInfo();

            model.FlowID           = int.Parse(bll.GetGUID(TransacType.WeixinFlowAdd));
            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.FlowSysType      = 1;
            model.IsEnable         = int.Parse(context.Request["IsEnable"]);
            return(bll.Add(model).ToString().ToLower());
        }
        /// <summary>
        /// 添加
        /// </summary>
        private static string Add(HttpContext context)
        {
            //if (!_isedit)
            //{
            //    return null;
            //}

            try
            {
                //var userid = websiteOwner;
                //if (string.IsNullOrEmpty(userid))
                //{
                //    return "请重新登录";
                //}
                var keyword   = context.Request["MsgKeyword"];
                var matchType = context.Request["MatchType"];
                if (!bll.CheckUserKeyword(websiteOwner, keyword))
                {
                    return("关键字重复");
                }
                var model = new WeixinReplyRuleInfo();
                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.UID          = bll.GetGUID(BLLJIMP.TransacType.WeixinReplyRuleAdd);
                model.UserID       = websiteOwner;
                return(bll.Add(model).ToString().ToLower());
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            //return "false";
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            string type      = context.Request["type"];
            string code      = context.Request["code"];
            string id        = context.Request["id"];
            string qrCodeUrl = "";

            if (string.IsNullOrEmpty(type))
            {
                apiResp.msg = "type 参数必传";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            if (string.IsNullOrEmpty(id))
            {
                apiResp.msg = "id 参数必传";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            if (string.IsNullOrEmpty(code))
            {
                apiResp.msg = "code 参数必传";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }

            switch (type.ToLower())
            {
            case "activitysignin":    //活动签到

                var wxQrcode = bllWeixin.Get <WXQrCode>(string.Format(" WebsiteOwner='{0}'   And Id={1} And QrCodeType='ActivitySignIn'", bllWeixin.WebsiteOwner, id));
                if (wxQrcode != null)
                {
                    qrCodeUrl = wxQrcode.QrCodeUrl;
                    //qrCodeUrl = bllWeixin.CompoundImageLogo(qrCodeUrl);
                    qrCodeUrl = bllWeixin.CompoundImageLogoToOss(qrCodeUrl, bllWeixin.WebsiteOwner);
                }
                else
                {
                    qrCodeUrl = bllWeixin.GetWxQrcodeLimit(code);
                    WXQrCode qrCodeModel = new WXQrCode();
                    qrCodeModel.WebsiteOwner = bllWeixin.WebsiteOwner;
                    qrCodeModel.Id           = id;
                    qrCodeModel.QrCodeType   = "ActivitySignIn";
                    qrCodeModel.QrCodeUrl    = qrCodeUrl;
                    bllWeixin.Add(qrCodeModel);
                }
                break;

            default:
                break;
            }


            apiResp.status = true;
            apiResp.msg    = "ok";
            if (string.IsNullOrEmpty(qrCodeUrl))
            {
                apiResp.status = false;
                apiResp.msg    = "生成二维码失败";
            }
            apiResp.result = new
            {
                qrcode_url = qrCodeUrl
            };
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }