/// <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> 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()); }
protected void Page_Load(object sender, EventArgs e) { model = bll.Get <BLLJIMP.Model.WXQiyeConfig>(string.Format("WebsiteOwner='{0}'", bll.WebsiteOwner)); if (model == null) { model = new BLLJIMP.Model.WXQiyeConfig(); } }
protected void Page_Load(object sender, EventArgs e) { user = Comm.DataLoadTool.GetCurrUserModel(); userBll = new BLLJIMP.BLLUser(user.UserID); weixinBll = new BLLJIMP.BLLWeixin(user.UserID); if (!IsPostBack) { SystemSet systemset = weixinBll.Get <SystemSet>(""); //this.lbURL.Text = user.WeixinAPIUrl; this.txtToken.Text = user.WeixinToken; this.txtWeinxinPublicName.Text = user.WeixinPublicName; this.lbURL.Text = string.Format("{0}/Weixin/OAuthPage.aspx?u={1}", systemset.weiXinAdDomain, Common.Base64Change.EncodeBase64ByUTF8(user.UserID)); ZentCloud.BLLJIMP.Model.WeixinReplyRuleInfo menuModel = weixinBll.Get <ZentCloud.BLLJIMP.Model.WeixinReplyRuleInfo>(string.Format(" UserID = '{0}' and RuleType = 4 ", user.UserID)); if (menuModel != null) { this.txtMenuContent.Text = menuModel.ReplyContent; } txtAppId.Text = user.WeixinAppId; txtAppSecret.Text = user.WeixinAppSecret; this.rblIsWeixinVerify.SelectedValue = user.IsWeixinVerify.ToString(); if (user.WeixinIsEnableMenu != null) { if (user.WeixinIsEnableMenu == 1) { rblEnableMenu.SelectedIndex = 0; } else { rblEnableMenu.SelectedIndex = 1; } } else { rblEnableMenu.SelectedIndex = 1; } } }
protected void Page_Load(object sender, EventArgs e) { this.user = userBll.GetCurrWebSiteUserInfo(); menuModel = weixinBll.Get <ZentCloud.BLLJIMP.Model.WeixinReplyRuleInfo>(string.Format(" UserID = '{0}' and RuleType = 4 ", user.UserID)); currentWebsiteInfo = userBll.GetWebsiteInfoModelFromDataBase(); OauthDomain = ZentCloud.Common.ConfigHelper.GetConfigString("WeixinOpenOAuthDoMain"); WebsiteInfo model = bllWeisite.GetWebsiteInfo(); if (model != null && !string.IsNullOrEmpty(model.WeiXinBindDomain)) { strDomain = model.WeiXinBindDomain; } }
/// <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"); }
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)); }
protected void btnSave_Click(object sender, EventArgs e) { /* * 1.保存Token、链接、公众号名称,并且设置注册也验证状态都为开启状态; * 2.保存或者更改注册回复; * 3.保存或者更改菜单回复; * */ try { user = Comm.DataLoadTool.GetCurrUserModel(); user.WeixinPublicName = this.txtWeinxinPublicName.Text.Trim(); user.WeixinAPIUrl = this.lbURL.Text.Trim(); user.WeixinToken = this.txtToken.Text.Trim(); user.WeixinIsEnableMenu = int.Parse(rblEnableMenu.SelectedValue); user.IsWeixinVerify = int.Parse(rblIsWeixinVerify.SelectedValue); user.WeixinAppId = txtAppId.Text; user.WeixinAppSecret = txtAppSecret.Text; if (user.WeixinIsEnableMenu == 0) { weixinBll.DeleteWeixinClientMenu(weixinBll.GetAccessToken(user.UserID)); } //关闭内定注册模块 user.WeixinIsOpenReg = 0; user.WeixinRegIsVerifySMS = 0; this.userBll.Update(user); ZentCloud.BLLJIMP.Model.WeixinReplyRuleInfo regModel = weixinBll.Get <ZentCloud.BLLJIMP.Model.WeixinReplyRuleInfo>(string.Format(" UserID = '{0}' and RuleType = 3 ", user.UserID)); if (regModel != null) { regModel.MsgKeyword = this.txtRegKeyWord.Text.Trim(); this.weixinBll.Update(regModel); } else { regModel = new WeixinReplyRuleInfo(); regModel.ReplyContent = "请输入手机号码进行注册"; regModel.ReplyType = "text"; regModel.ReceiveType = "text"; regModel.MatchType = "全文匹配"; regModel.UserID = user.UserID; regModel.UID = this.weixinBll.GetGUID(BLLJIMP.TransacType.WeixinReplyRuleAdd); regModel.RuleType = 3; regModel.MsgKeyword = this.txtRegKeyWord.Text.Trim(); regModel.CreateDate = DateTime.Now; this.weixinBll.Add(regModel); } ZentCloud.BLLJIMP.Model.WeixinReplyRuleInfo menuModel = weixinBll.Get <ZentCloud.BLLJIMP.Model.WeixinReplyRuleInfo>(string.Format(" UserID = '{0}' and RuleType = 4 ", user.UserID)); if (menuModel != null) { menuModel.MsgKeyword = this.txtMenuKeyWord.Text.Trim(); menuModel.ReplyContent = this.txtMenuContent.Text.Trim(); this.weixinBll.Update(menuModel); } else { menuModel = new WeixinReplyRuleInfo(); menuModel.ReplyContent = this.txtMenuContent.Text.Trim(); menuModel.ReplyType = "text"; menuModel.ReceiveType = "text"; menuModel.MatchType = "全文匹配"; menuModel.UserID = user.UserID; menuModel.UID = this.weixinBll.GetGUID(BLLJIMP.TransacType.WeixinReplyRuleAdd); menuModel.RuleType = 4; menuModel.MsgKeyword = this.txtMenuKeyWord.Text.Trim(); menuModel.CreateDate = DateTime.Now; this.weixinBll.Add(menuModel); } //添加默认注册流程 if (this.weixinBll.GetList <WXFlowInfo>(string.Format(" UserID = '{0}' and FlowSysType = 3", user.UserID)).Count.Equals(0)) { this.weixinBll.AddUserDefaultFlow(user.UserID); } this.ShowMessge("保存成功!"); } catch (Exception ex) { this.ShowMessge("保存失败:" + ex.Message); } }