コード例 #1
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            WeiXinHelper.UpdateRencentOpenID(clickEventRequest.FromUserName);
            Hidistro.Entities.VShop.MenuInfo menu = VShopHelper.GetMenu(Convert.ToInt32(clickEventRequest.EventKey));
            if (menu == null)
            {
                return(null);
            }
            Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);
            if (reply == null)
            {
                return(null);
            }
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(clickEventRequest);
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
コード例 #2
0
        public Hidistro.Entities.VShop.ReplyInfo ReaderBind(IDataReader dataReader)
        {
            Hidistro.Entities.VShop.ReplyInfo info = null;
            object obj2 = dataReader["MessageType"];

            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                if (((MessageType)obj2) == MessageType.Text)
                {
                    info = new TextReplyInfo();
                }
                else
                {
                    info = new NewsReplyInfo();
                }
            }
            obj2 = dataReader["ReplyId"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.Id = (int)obj2;
            }
            info.Keys = dataReader["Keys"].ToString();
            obj2      = dataReader["MatchType"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.MatchType = (MatchType)obj2;
            }
            obj2 = dataReader["ReplyType"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.ReplyType = (ReplyType)obj2;
            }
            obj2 = dataReader["MessageType"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.MessageType = (MessageType)obj2;
            }
            obj2 = dataReader["IsDisable"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.IsDisable = (bool)obj2;
            }
            obj2 = dataReader["LastEditDate"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.LastEditDate = (DateTime)obj2;
            }
            info.LastEditor = dataReader["LastEditor"].ToString();
            obj2            = dataReader["ActivityId"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.ActivityId = (int)obj2;
            }
            obj2 = dataReader["ArticleID"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                info.ArticleID = (int)obj2;
            }
            return(info);
        }
コード例 #3
0
 public AbstractResponse GetResponse(ReplyInfo reply, string openId)
 {
     if (reply.MessageType == MessageType.Text)
     {
         TextReplyInfo info = reply as TextReplyInfo;
         TextResponse response = new TextResponse {
             CreateTime = DateTime.Now,
             Content = info.Text
         };
         if (reply.Keys == "登录")
         {
             string str = string.Format("http://{0}/Vshop/Login.aspx?SessionId={1}", HttpContext.Current.Request.Url.Host, openId);
             response.Content = response.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", str));
         }
         return response;
     }
     NewsResponse response2 = new NewsResponse {
         CreateTime = DateTime.Now,
         Articles = new List<Article>()
     };
     foreach (NewsMsgInfo info2 in (reply as NewsReplyInfo).NewsMsg)
     {
         Article item = new Article {
             Description = info2.Description,
             PicUrl = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info2.PicUrl),
             Title = info2.Title,
             Url = string.IsNullOrEmpty(info2.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", HttpContext.Current.Request.Url.Host, info2.Id) : info2.Url
         };
         response2.Articles.Add(item);
     }
     return response2;
 }
コード例 #4
0
ファイル: AliFuwuReplyDao.cs プロジェクト: llenroc/kangaroo
        public IList <Hidistro.Entities.VShop.ReplyInfo> GetReplies(ReplyType type)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select ReplyId,Keys,MatchType,ReplyType,MessageType,IsDisable,LastEditDate,LastEditor,Content,Type,ActivityId,ArticleID ");
            stringBuilder.Append(" FROM vshop_AliFuwuReply ");
            stringBuilder.Append(" where ReplyType = @ReplyType and IsDisable=0");
            stringBuilder.Append(" order by replyid desc");
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());
            this.database.AddInParameter(sqlStringCommand, "ReplyType", System.Data.DbType.Int32, (int)type);
            List <Hidistro.Entities.VShop.ReplyInfo> list = new List <Hidistro.Entities.VShop.ReplyInfo>();

            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    Hidistro.Entities.VShop.ReplyInfo replyInfo = this.ReaderBind(dataReader);
                    TextReplyInfo textReplyInfo;
                    object        obj;
                    switch (replyInfo.MessageType)
                    {
                    case MessageType.Text:
                        textReplyInfo = (replyInfo as TextReplyInfo);
                        obj           = dataReader["Content"];
                        if (obj != null && obj != DBNull.Value)
                        {
                            textReplyInfo.Text = obj.ToString();
                        }
                        list.Add(textReplyInfo);
                        break;

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo newsReplyInfo = replyInfo as NewsReplyInfo;
                        newsReplyInfo.NewsMsg = this.GetNewsReplyInfo(newsReplyInfo.Id);
                        list.Add(newsReplyInfo);
                        break;
                    }

                    case (MessageType)3:
                        goto IL_11F;

                    default:
                        goto IL_11F;
                    }
                    continue;
IL_11F:
                    textReplyInfo = (replyInfo as TextReplyInfo);
                    obj           = dataReader["Content"];
                    if (obj != null && obj != DBNull.Value)
                    {
                        textReplyInfo.Text = obj.ToString();
                    }
                    list.Add(textReplyInfo);
                }
            }
            return(list);
        }
コード例 #5
0
        public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest)
        {
            string text = "";

            if (subscribeEventRequest.EventKey != null)
            {
                text = subscribeEventRequest.EventKey;
            }
            if (text.Contains("qrscene_"))
            {
                text = text.Replace("qrscene_", "").Trim();
                if (text == "1")
                {
                    if (WeiXinHelper.BindAdminOpenId.Count > 10)
                    {
                        WeiXinHelper.BindAdminOpenId.Clear();
                    }
                    if (WeiXinHelper.BindAdminOpenId.ContainsKey(subscribeEventRequest.Ticket))
                    {
                        WeiXinHelper.BindAdminOpenId[subscribeEventRequest.Ticket] = subscribeEventRequest.FromUserName;
                    }
                    else
                    {
                        WeiXinHelper.BindAdminOpenId.Add(subscribeEventRequest.Ticket, subscribeEventRequest.FromUserName);
                    }
                    return(new TextResponse
                    {
                        CreateTime = System.DateTime.Now,
                        Content = "您正在扫描尝试绑定管理员身份,身份已识别",
                        ToUserName = subscribeEventRequest.FromUserName,
                        FromUserName = subscribeEventRequest.ToUserName
                    });
                }
                ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(subscribeEventRequest.Ticket);
                Globals.Debuglog(text + ":" + subscribeEventRequest.Ticket, "_Debuglog.txt");
                if (!MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName) && scanInfosByTicket != null && scanInfosByTicket.BindUserId > 0)
                {
                    this.CreatMember(subscribeEventRequest.FromUserName, scanInfosByTicket.BindUserId);
                    ScanHelp.updateScanInfosLastActiveTime(System.DateTime.Now, scanInfosByTicket.Sceneid);
                }
            }
            WeiXinHelper.UpdateRencentOpenID(subscribeEventRequest.FromUserName);
            Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply();
            if (subscribeReply == null)
            {
                return(null);
            }
            subscribeReply.Keys = "登录";
            AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(subscribeEventRequest);
            }
            response.ToUserName   = subscribeEventRequest.FromUserName;
            response.FromUserName = subscribeEventRequest.ToUserName;
            return(response);
        }
コード例 #6
0
ファイル: ReplyDao.cs プロジェクト: sriramsoftware/wxshop
        public IList <Hidistro.Entities.VShop.ReplyInfo> GetReplies(ReplyType type, string wid)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select ReplyId,Keys,MatchType,ReplyType,MessageType,IsDisable,LastEditDate,LastEditor,Content,Type,ActivityId,ArticleID,wid ");
            builder.Append(" FROM vshop_Reply ");
            builder.Append(" where ReplyType = @ReplyType and IsDisable=0 and wid=@wid");
            builder.Append(" order by replyid desc");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, (int)type);
            this.database.AddInParameter(sqlStringCommand, "wid", DbType.String, wid);
            List <Hidistro.Entities.VShop.ReplyInfo> list = new List <Hidistro.Entities.VShop.ReplyInfo>();

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (reader.Read())
                {
                    TextReplyInfo info3;
                    object        obj2;
                    Hidistro.Entities.VShop.ReplyInfo info = this.ReaderBind(reader);
                    switch (info.MessageType)
                    {
                    case MessageType.Text:
                    {
                        info3 = info as TextReplyInfo;
                        obj2  = reader["Content"];
                        if ((obj2 != null) && (obj2 != DBNull.Value))
                        {
                            info3.Text = obj2.ToString();
                        }
                        list.Add(info3);
                        continue;
                    }

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo item = info as NewsReplyInfo;
                        item.NewsMsg = this.GetNewsReplyInfo(item.Id);
                        list.Add(item);
                        continue;
                    }
                    }
                    info3 = info as TextReplyInfo;
                    obj2  = reader["Content"];
                    if ((obj2 != null) && (obj2 != DBNull.Value))
                    {
                        info3.Text = obj2.ToString();
                    }
                    list.Add(info3);
                }
            }
            return(list);
        }
コード例 #7
0
        public override AbstractResponse OnEvent_ScanRequest(ScanEventRequest scanEventRequest)
        {
            string eventKey = scanEventRequest.EventKey;

            if (eventKey == "1")
            {
                if (WeiXinHelper.BindAdminOpenId.Count > 10)
                {
                    WeiXinHelper.BindAdminOpenId.Clear();
                }
                if (WeiXinHelper.BindAdminOpenId.ContainsKey(scanEventRequest.Ticket))
                {
                    WeiXinHelper.BindAdminOpenId[scanEventRequest.Ticket] = scanEventRequest.FromUserName;
                }
                else
                {
                    WeiXinHelper.BindAdminOpenId.Add(scanEventRequest.Ticket, scanEventRequest.FromUserName);
                }
                return(new TextResponse {
                    CreateTime = DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName
                });
            }
            ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(scanEventRequest.Ticket);

            Globals.Debuglog(eventKey + ":" + scanEventRequest.Ticket, "_Debuglog.txt");
            bool flag = MemberProcessor.IsExitOpenId(scanEventRequest.FromUserName);

            if ((!flag && (scanInfosByTicket != null)) && (scanInfosByTicket.BindUserId > 0))
            {
                this.CreatMember(scanEventRequest.FromUserName, scanInfosByTicket.BindUserId);
            }
            if (scanInfosByTicket != null)
            {
                ScanHelp.updateScanInfosLastActiveTime(DateTime.Now, scanInfosByTicket.Sceneid);
            }
            if (flag)
            {
                return(new TextResponse {
                    CreateTime = DateTime.Now, Content = "您刚扫描了分销商公众号二维码!", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName
                });
            }
            Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply();
            if (subscribeReply == null)
            {
                return(null);
            }
            subscribeReply.Keys = "扫描";
            AbstractResponse response = this.GetResponse(subscribeReply, scanEventRequest.FromUserName);

            response.ToUserName   = scanEventRequest.FromUserName;
            response.FromUserName = scanEventRequest.ToUserName;
            return(response);
        }
コード例 #8
0
ファイル: ReplyDao.cs プロジェクト: sriramsoftware/wxshop
        public bool UpdateReply(Hidistro.Entities.VShop.ReplyInfo reply)
        {
            switch (reply.MessageType)
            {
            case MessageType.Text:
                return(this.UpdateTextReply(reply as TextReplyInfo));

            case MessageType.News:
            case MessageType.List:
                return(this.UpdateNewsReply(reply as NewsReplyInfo));
            }
            return(this.UpdateTextReply(reply as TextReplyInfo));
        }
コード例 #9
0
        public IList <Hidistro.Entities.VShop.ReplyInfo> GetAllReply()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select ReplyId,Keys,MatchType,ReplyType,MessageType,IsDisable,LastEditDate,LastEditor,Content,Type,ActivityId,ArticleID");
            builder.Append(" FROM vshop_AliFuwuReply order by Replyid desc ");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
            List <Hidistro.Entities.VShop.ReplyInfo> list = new List <Hidistro.Entities.VShop.ReplyInfo>();

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (reader.Read())
                {
                    object obj2;
                    Hidistro.Entities.VShop.ReplyInfo info = this.ReaderBind(reader);
                    switch (info.MessageType)
                    {
                    case MessageType.Text:
                    {
                        TextReplyInfo info3 = info as TextReplyInfo;
                        obj2 = reader["Content"];
                        if ((obj2 != null) && (obj2 != DBNull.Value))
                        {
                            info3.Text = obj2.ToString();
                        }
                        list.Add(info3);
                        continue;
                    }

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo info2 = info as NewsReplyInfo;
                        info2.NewsMsg = this.GetNewsReplyInfo(info2.Id);
                        list.Add(info2);
                        continue;
                    }
                    }
                    TextReplyInfo item = info as TextReplyInfo;
                    obj2 = reader["Content"];
                    if ((obj2 != null) && (obj2 != DBNull.Value))
                    {
                        item.Text = obj2.ToString();
                    }
                    list.Add(item);
                }
            }
            return(list);
        }
コード例 #10
0
ファイル: AliFuwuReplyDao.cs プロジェクト: llenroc/kangaroo
        public bool SaveReply(Hidistro.Entities.VShop.ReplyInfo reply)
        {
            bool result = false;

            switch (reply.MessageType)
            {
            case MessageType.Text:
                result = this.SaveTextReply(reply as TextReplyInfo);
                break;

            case MessageType.News:
            case MessageType.List:
                result = this.SaveNewsReply(reply as NewsReplyInfo);
                break;
            }
            return(result);
        }
コード例 #11
0
ファイル: CustomMsgHandler.cs プロジェクト: llenroc/kangaroo
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            AbstractResponse abstractResponse;
            IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Vote);

            if (replies != null && replies.Count > 0)
            {
                using (IEnumerator <Hidistro.Entities.VShop.ReplyInfo> enumerator = replies.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Hidistro.Entities.VShop.ReplyInfo current = enumerator.Current;
                        if (current.Keys != key)
                        {
                            continue;
                        }
                        VoteInfo voteById = StoreHelper.GetVoteById((long)current.ActivityId);
                        if (voteById == null || !voteById.IsBackup)
                        {
                            continue;
                        }
                        NewsResponse newsResponse = new NewsResponse()
                        {
                            CreateTime   = DateTime.Now,
                            FromUserName = request.ToUserName,
                            ToUserName   = request.FromUserName,
                            Articles     = new List <Article>()
                        };
                        IList <Article> articles = newsResponse.Articles;
                        Article         article  = new Article()
                        {
                            Description = voteById.VoteName,
                            PicUrl      = this.FormatImgUrl(voteById.ImageUrl),
                            Title       = voteById.VoteName,
                            Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", HttpContext.Current.Request.Url.Host, voteById.VoteId)
                        };
                        articles.Add(article);
                        abstractResponse = newsResponse;
                        return(abstractResponse);
                    }
                    return(null);
                }
                return(abstractResponse);
            }
            return(null);
        }
コード例 #12
0
ファイル: ReplyOnKey.cs プロジェクト: llenroc/kangaroo
        protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            int num = Globals.ToNum(e.CommandArgument.ToString());

            if (e.CommandName == "Delete")
            {
                AliFuwuReplyHelper.DeleteReply(num);
                this.BindArticleCategory();
                this.ShowMsg("删除成功!", true);
                return;
            }
            if (e.CommandName == "Release")
            {
                AliFuwuReplyHelper.UpdateReplyRelease(num);
                base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
                return;
            }
            if (e.CommandName == "Edit")
            {
                Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(num);
                if (reply != null)
                {
                    switch (reply.MessageType)
                    {
                    case MessageType.Text:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num));
                        break;

                    case MessageType.News:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num));
                        return;

                    case (MessageType)3:
                        break;

                    case MessageType.List:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num));
                        return;

                    default:
                        return;
                    }
                }
            }
        }
コード例 #13
0
ファイル: ReplyDao.cs プロジェクト: sriramsoftware/wxshop
        public bool SaveReply(Hidistro.Entities.VShop.ReplyInfo reply)
        {
            bool flag = false;

            switch (reply.MessageType)
            {
            case MessageType.Text:
                return(this.SaveTextReply(reply as TextReplyInfo));

            case MessageType.News:
            case MessageType.List:
                return(this.SaveNewsReply(reply as NewsReplyInfo));

            case (MessageType.News | MessageType.Text):
                return(flag);
            }
            return(flag);
        }
コード例 #14
0
ファイル: CustomMsgHandler.cs プロジェクト: llenroc/kangaroo
        public override AbstractResponse DefaultResponse(AbstractRequest requestMessage)
        {
            WeiXinHelper.UpdateRencentOpenID(requestMessage.FromUserName);
            Hidistro.Entities.VShop.ReplyInfo mismatchReply = ReplyHelper.GetMismatchReply();
            if (mismatchReply == null || this.IsOpenManyService())
            {
                return(this.GotoManyCustomerService(requestMessage));
            }
            AbstractResponse response = this.GetResponse(mismatchReply, requestMessage.FromUserName);

            if (response == null)
            {
                return(this.GotoManyCustomerService(requestMessage));
            }
            response.ToUserName   = requestMessage.FromUserName;
            response.FromUserName = requestMessage.ToUserName;
            return(response);
        }
コード例 #15
0
ファイル: ReplyDao.cs プロジェクト: sriramsoftware/wxshop
        public Hidistro.Entities.VShop.ReplyInfo GetReply(int id)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM vshop_Reply WHERE ReplyId = @ReplyId");

            this.database.AddInParameter(sqlStringCommand, "ReplyId", DbType.Int32, id);
            Hidistro.Entities.VShop.ReplyInfo info = null;
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                TextReplyInfo info3;
                if (reader.Read())
                {
                    info = this.ReaderBind(reader);
                    switch (info.MessageType)
                    {
                    case MessageType.Text:
                        goto Label_0089;

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo info2 = info as NewsReplyInfo;
                        info2.NewsMsg = this.GetNewsReplyInfo(info2.Id);
                        return(info2);
                    }

                    case (MessageType.News | MessageType.Text):
                        return(info);
                    }
                }
                return(info);

Label_0089:
                info3 = info as TextReplyInfo;
                object obj2 = reader["Content"];
                if ((obj2 != null) && (obj2 != DBNull.Value))
                {
                    info3.Text = obj2.ToString();
                }
                return(info3);
            }
        }
コード例 #16
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Globals.ToNum(e.CommandArgument.ToString());

            if (e.CommandName == "Delete")
            {
                ReplyHelper.DeleteReply(id);
                this.BindArticleCategory();
                this.ShowMsg("删除成功!", true);
            }
            else if (e.CommandName == "Release")
            {
                ReplyHelper.UpdateReplyRelease(id);
                base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
            else if (e.CommandName == "Edit")
            {
                Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(id);
                if (reply != null)
                {
                    switch (reply.MessageType)
                    {
                    case MessageType.Text:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id));
                        return;

                    case MessageType.News:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id));
                        return;

                    case (MessageType.News | MessageType.Text):
                        return;

                    case MessageType.List:
                        base.Response.Redirect(string.Format("replyedit.aspx?id={0}", id));
                        return;
                    }
                }
            }
        }
コード例 #17
0
ファイル: AliFuwuReplyDao.cs プロジェクト: llenroc/kangaroo
        public bool UpdateReplyRelease(int id)
        {
            Hidistro.Entities.VShop.ReplyInfo reply = this.GetReply(id);
            StringBuilder stringBuilder             = new StringBuilder();

            if (reply.IsDisable)
            {
                if ((reply.ReplyType & ReplyType.NoMatch) == ReplyType.NoMatch)
                {
                    stringBuilder.AppendFormat("update  vshop_AliFuwuReply set IsDisable = 1 where ReplyType&{0}>0;", 4);
                }
                if ((reply.ReplyType & ReplyType.Subscribe) == ReplyType.Subscribe)
                {
                    stringBuilder.AppendFormat("update  vshop_AliFuwuReply set IsDisable = 1 where ReplyType&{0}>0;", 1);
                }
            }
            stringBuilder.Append("update vshop_AliFuwuReply set ");
            stringBuilder.Append("IsDisable=~IsDisable");
            stringBuilder.Append(" where ReplyId=@ReplyId");
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());
            this.database.AddInParameter(sqlStringCommand, "ReplyId", System.Data.DbType.Int32, id);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
コード例 #18
0
ファイル: AliFuwuReplyDao.cs プロジェクト: llenroc/kangaroo
        public Hidistro.Entities.VShop.ReplyInfo GetReply(int id)
        {
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM vshop_AliFuwuReply WHERE ReplyId = @ReplyId");
            this.database.AddInParameter(sqlStringCommand, "ReplyId", System.Data.DbType.Int32, id);
            Hidistro.Entities.VShop.ReplyInfo replyInfo = null;
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    replyInfo = this.ReaderBind(dataReader);
                    switch (replyInfo.MessageType)
                    {
                    case MessageType.Text:
                    {
                        TextReplyInfo textReplyInfo = replyInfo as TextReplyInfo;
                        object        obj           = dataReader["Content"];
                        if (obj != null && obj != DBNull.Value)
                        {
                            textReplyInfo.Text = obj.ToString();
                        }
                        replyInfo = textReplyInfo;
                        break;
                    }

                    case MessageType.News:
                    case MessageType.List:
                    {
                        NewsReplyInfo newsReplyInfo = replyInfo as NewsReplyInfo;
                        newsReplyInfo.NewsMsg = this.GetNewsReplyInfo(newsReplyInfo.Id);
                        replyInfo             = newsReplyInfo;
                        break;
                    }
                    }
                }
            }
            return(replyInfo);
        }
コード例 #19
0
ファイル: AliPayFuwuApi.cs プロジェクト: 123456-cq/xkq34_src
        private void replyAction(string FromUserId, string eventType, string textContent, string ActionParam)
        {
            Articles articles6 = new Articles
            {
                toUserId = FromUserId,
                msgType  = "text"
            };
            MessageText text5 = new MessageText
            {
                content = "系统未找到相关信息!"
            };

            articles6.text = text5;
            Articles articles = articles6;

            if (eventType != "")
            {
                if ("follow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.AddFuwuFollowUser(FromUserId);
                    }
                    string aliOHFollowRelayTitle = this.siteSettings.AliOHFollowRelayTitle;
                    Hidistro.Entities.VShop.ReplyInfo subscribeReply = AliFuwuReplyHelper.GetSubscribeReply();
                    if (subscribeReply != null)
                    {
                        if (subscribeReply.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                        {
                            TextReplyInfo info2 = subscribeReply as TextReplyInfo;
                            articles.text.content = info2.Text;
                        }
                        else if (subscribeReply.ArticleID > 0)
                        {
                            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(subscribeReply.ArticleID);
                            if (articleInfo != null)
                            {
                                articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                            }
                            else
                            {
                                articles.text.content = aliOHFollowRelayTitle;
                            }
                        }
                    }
                    else
                    {
                        articles.text.content = aliOHFollowRelayTitle;
                    }
                }
                else if ("unfollow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.DelFuwuFollowUser(FromUserId);
                    }
                }
                else if ("click".Equals(eventType))
                {
                    int result = 0;
                    if (((ActionParam != "") && int.TryParse(ActionParam, out result)) && (result > 0))
                    {
                        Hidistro.Entities.VShop.MenuInfo fuwuMenu = VShopHelper.GetFuwuMenu(result);
                        if (fuwuMenu != null)
                        {
                            Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(fuwuMenu.ReplyId);
                            if (reply != null)
                            {
                                ArticleInfo info6 = ArticleHelper.GetArticleInfo(reply.ArticleID);
                                if (info6 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(info6, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                }
                            }
                        }
                    }
                }
                else if ("enter".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(this.UserInfo))
                    {
                        MemberInfo openIdMember = MemberProcessor.GetOpenIdMember(FromUserId, "fuwu");
                        if ((openIdMember != null) && openIdMember.AlipayLoginId.StartsWith("FW*"))
                        {
                            JObject obj2 = JsonConvert.DeserializeObject(this.UserInfo) as JObject;
                            string  str2 = "";
                            string  str3 = "";
                            if (obj2["logon_id"] != null)
                            {
                                str2 = obj2["logon_id"].ToString();
                            }
                            if (obj2["user_name"] != null)
                            {
                                str3 = obj2["user_name"].ToString();
                            }
                            if ((str3 != "") && (str3 != ""))
                            {
                                openIdMember.AlipayLoginId  = str2;
                                openIdMember.AlipayUsername = str3;
                                MemberProcessor.SetAlipayInfos(openIdMember);
                            }
                        }
                    }
                    if (!ActionParam.Contains("sceneId"))
                    {
                        return;
                    }
                    JObject obj3 = JsonConvert.DeserializeObject(ActionParam) as JObject;
                    if (obj3["scene"]["sceneId"] != null)
                    {
                        string key = obj3["scene"]["sceneId"].ToString();
                        if (key.StartsWith("bind"))
                        {
                            if (AlipayFuwuConfig.BindAdmin.Count > 10)
                            {
                                AlipayFuwuConfig.BindAdmin.Clear();
                            }
                            if (AlipayFuwuConfig.BindAdmin.ContainsKey(key))
                            {
                                AlipayFuwuConfig.BindAdmin[key] = FromUserId;
                            }
                            else
                            {
                                AlipayFuwuConfig.BindAdmin.Add(key, FromUserId);
                            }
                            articles.text.content = "您正在尝试绑定服务窗管理员身份!";
                        }
                    }
                }
            }
            else if (textContent != "")
            {
                articles = null;
                IList <Hidistro.Entities.VShop.ReplyInfo> replies = AliFuwuReplyHelper.GetReplies(ReplyType.Keys);
                if ((replies != null) && (replies.Count > 0))
                {
                    foreach (Hidistro.Entities.VShop.ReplyInfo info8 in replies)
                    {
                        if (info8 != null)
                        {
                            if ((info8.MatchType == MatchType.Equal) && (info8.Keys == textContent))
                            {
                                if (info8.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                                {
                                    Articles articles2 = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text"
                                    };
                                    MessageText text = new MessageText
                                    {
                                        content = ""
                                    };
                                    articles2.text = text;
                                    articles       = articles2;
                                    TextReplyInfo info9 = info8 as TextReplyInfo;
                                    articles.text.content = info9.Text;
                                    break;
                                }
                                if (info8.ArticleID > 0)
                                {
                                    ArticleInfo info10 = ArticleHelper.GetArticleInfo(info8.ArticleID);
                                    if (info10 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(info10, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                            if ((info8.MatchType == MatchType.Like) && info8.Keys.Contains(textContent))
                            {
                                if (info8.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                                {
                                    Articles articles3 = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text"
                                    };
                                    MessageText text2 = new MessageText
                                    {
                                        content = ""
                                    };
                                    articles3.text = text2;
                                    articles       = articles3;
                                    TextReplyInfo info11 = info8 as TextReplyInfo;
                                    articles.text.content = info11.Text;
                                    break;
                                }
                                if (info8.ArticleID > 0)
                                {
                                    ArticleInfo info12 = ArticleHelper.GetArticleInfo(info8.ArticleID);
                                    if (info12 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(info12, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (articles == null)
            {
                IList <Hidistro.Entities.VShop.ReplyInfo> list2 = AliFuwuReplyHelper.GetReplies(ReplyType.NoMatch);
                if ((list2 != null) && (list2.Count > 0))
                {
                    foreach (Hidistro.Entities.VShop.ReplyInfo info13 in list2)
                    {
                        if (info13.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                        {
                            Articles articles4 = new Articles
                            {
                                toUserId = FromUserId,
                                msgType  = "text"
                            };
                            MessageText text3 = new MessageText
                            {
                                content = ""
                            };
                            articles4.text = text3;
                            articles       = articles4;
                            TextReplyInfo info14 = info13 as TextReplyInfo;
                            articles.text.content = info14.Text;
                            break;
                        }
                        if (info13.ArticleID > 0)
                        {
                            ArticleInfo info15 = ArticleHelper.GetArticleInfo(info13.ArticleID);
                            if (info15 != null)
                            {
                                articles = this.GetAlipayArticlesFromArticleInfo(info15, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                if (articles != null)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    Articles articles5 = new Articles
                    {
                        toUserId = FromUserId,
                        msgType  = "text"
                    };
                    MessageText text4 = new MessageText
                    {
                        content = "系统未找到相关信息!"
                    };
                    articles5.text = text4;
                    articles       = articles5;
                }
            }
            AliOHHelper.log(AliOHHelper.CustomSend(articles).Body);
        }
コード例 #20
0
ファイル: CustomMsgHandler.cs プロジェクト: llenroc/kangaroo
        public AbstractResponse GetResponse(Hidistro.Entities.VShop.ReplyInfo reply, string openId)
        {
            string log = string.Concat(new string[]
            {
                reply.MessageType.ToString(),
                "||",
                reply.MessageType.ToString(),
                "||",
                reply.MessageTypeName
            });

            Globals.Debuglog(log, "_DebuglogYY.txt");
            if (reply.MessageType == MessageType.Text)
            {
                TextReplyInfo textReplyInfo = reply as TextReplyInfo;
                TextResponse  textResponse  = new TextResponse();
                textResponse.CreateTime = System.DateTime.Now;
                textResponse.Content    = Globals.FormatWXReplyContent(textReplyInfo.Text);
                if (reply.Keys == "登录")
                {
                    string arg = Globals.GetWebUrlStart() + "/Vshop/MemberCenter.aspx";
                    textResponse.Content = textResponse.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", arg));
                }
                return(textResponse);
            }
            NewsResponse newsResponse = new NewsResponse();

            newsResponse.CreateTime = System.DateTime.Now;
            newsResponse.Articles   = new System.Collections.Generic.List <Article>();
            if (reply.ArticleID > 0)
            {
                ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(reply.ArticleID);
                if (articleInfo.ArticleType == ArticleType.News)
                {
                    Article item = new Article
                    {
                        Description = articleInfo.Memo,
                        PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                        Title       = articleInfo.Title,
                        Url         = (string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", System.Web.HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url)
                    };
                    newsResponse.Articles.Add(item);
                    return(newsResponse);
                }
                if (articleInfo.ArticleType != ArticleType.List)
                {
                    return(newsResponse);
                }
                Article item2 = new Article
                {
                    Description = articleInfo.Memo,
                    PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                    Title       = articleInfo.Title,
                    Url         = (string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", System.Web.HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url)
                };
                newsResponse.Articles.Add(item2);
                using (System.Collections.Generic.IEnumerator <ArticleItemsInfo> enumerator = articleInfo.ItemsInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ArticleItemsInfo current = enumerator.Current;
                        item2 = new Article
                        {
                            Description = "",
                            PicUrl      = this.FormatImgUrl(current.ImageUrl),
                            Title       = current.Title,
                            Url         = (string.IsNullOrEmpty(current.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?iid={1}", System.Web.HttpContext.Current.Request.Url.Host, current.Id) : current.Url)
                        };
                        newsResponse.Articles.Add(item2);
                    }
                    return(newsResponse);
                }
            }
            foreach (NewsMsgInfo current2 in (reply as NewsReplyInfo).NewsMsg)
            {
                Article item3 = new Article
                {
                    Description = current2.Description,
                    PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, current2.PicUrl),
                    Title       = current2.Title,
                    Url         = (string.IsNullOrEmpty(current2.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", System.Web.HttpContext.Current.Request.Url.Host, current2.Id) : current2.Url)
                };
                newsResponse.Articles.Add(item3);
            }
            return(newsResponse);
        }
コード例 #21
0
ファイル: ReplyHelper.cs プロジェクト: ZhangVic/asp1110git
 public static bool UpdateReply(ReplyInfo reply)
 {
     reply.LastEditDate = DateTime.Now;
     reply.LastEditor = ManagerHelper.GetCurrentManager().UserName;
     return new ReplyDao().UpdateReply(reply);
 }
コード例 #22
0
ファイル: CustomMsgHandler.cs プロジェクト: llenroc/kangaroo
        public override AbstractResponse OnEvent_ScanRequest(ScanEventRequest scanEventRequest)
        {
            string eventKey = scanEventRequest.EventKey;

            if (eventKey == "1")
            {
                if (WeiXinHelper.BindAdminOpenId.Count > 10)
                {
                    WeiXinHelper.BindAdminOpenId.Clear();
                }
                if (WeiXinHelper.BindAdminOpenId.ContainsKey(scanEventRequest.Ticket))
                {
                    WeiXinHelper.BindAdminOpenId[scanEventRequest.Ticket] = scanEventRequest.FromUserName;
                }
                else
                {
                    WeiXinHelper.BindAdminOpenId.Add(scanEventRequest.Ticket, scanEventRequest.FromUserName);
                }
                return(new TextResponse
                {
                    CreateTime = System.DateTime.Now,
                    Content = "您正在扫描尝试绑定管理员身份,身份已识别",
                    ToUserName = scanEventRequest.FromUserName,
                    FromUserName = scanEventRequest.ToUserName
                });
            }
            ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(scanEventRequest.Ticket);

            Globals.Debuglog(eventKey + ":" + scanEventRequest.Ticket, "_Debuglog.txt");
            bool flag = MemberProcessor.IsExitOpenId(scanEventRequest.FromUserName);

            if (!flag && scanInfosByTicket != null && scanInfosByTicket.BindUserId > 0)
            {
                this.CreatMember(scanEventRequest.FromUserName, scanInfosByTicket.BindUserId, "");
            }
            if (scanInfosByTicket != null)
            {
                ScanHelp.updateScanInfosLastActiveTime(System.DateTime.Now, scanInfosByTicket.Sceneid);
            }
            string text = "";

            System.Data.DataSet dataSet = new System.Data.DataSet();
            string text2 = System.Web.HttpContext.Current.Server.MapPath("/config/WifiConfig.xml");

            if (System.IO.File.Exists(text2))
            {
                dataSet.ReadXml(text2);
                if (dataSet != null && dataSet.Tables.Count > 0)
                {
                    foreach (System.Data.DataRow dataRow in dataSet.Tables[0].Rows)
                    {
                        if (dataRow["id"].ToString() == eventKey)
                        {
                            text = string.Concat(new string[]
                            {
                                dataRow["WifiDescribe"].ToString(),
                                "\r\nWIFI帐号:",
                                dataRow["WifiName"].ToString(),
                                "\r\n WIFI密码:",
                                dataRow["WifiPwd"].ToString()
                            });
                        }
                    }
                }
            }
            if (text != "")
            {
                return(new TextResponse
                {
                    CreateTime = System.DateTime.Now,
                    Content = text,
                    ToUserName = scanEventRequest.FromUserName,
                    FromUserName = scanEventRequest.ToUserName
                });
            }
            if (flag)
            {
                return(new TextResponse
                {
                    CreateTime = System.DateTime.Now,
                    Content = "您刚扫描了分销商公众号二维码!",
                    ToUserName = scanEventRequest.FromUserName,
                    FromUserName = scanEventRequest.ToUserName
                });
            }
            Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply();
            if (subscribeReply == null)
            {
                return(null);
            }
            subscribeReply.Keys = "扫描";
            AbstractResponse response = this.GetResponse(subscribeReply, scanEventRequest.FromUserName);

            response.ToUserName   = scanEventRequest.FromUserName;
            response.FromUserName = scanEventRequest.ToUserName;
            return(response);
        }
コード例 #23
0
ファイル: CustomMsgHandler.cs プロジェクト: llenroc/kangaroo
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            string userOpenId = clickEventRequest.FromUserName;

            WeiXinHelper.UpdateRencentOpenID(userOpenId);
            AbstractResponse result;

            try
            {
                int menuId = System.Convert.ToInt32(clickEventRequest.EventKey);
                Hidistro.Entities.VShop.MenuInfo menu = VShopHelper.GetMenu(menuId);
                if (menu == null)
                {
                    result = null;
                }
                else
                {
                    if (menu.BindType == BindType.StoreCard)
                    {
                        try
                        {
                            SiteSettings siteSettings = SettingsManager.GetMasterSettings(false);
                            string       access_token = TokenApi.GetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret);
                            access_token = JsonConvert.DeserializeObject <Token>(access_token).access_token;
                            MemberInfo member = MemberProcessor.GetOpenIdMember(userOpenId, "wx");
                            if (member == null)
                            {
                                this.CreatMember(userOpenId, 0, access_token);
                                member = MemberProcessor.GetOpenIdMember(userOpenId, "wx");
                            }
                            string           userHead        = member.UserHead;
                            string           storeLogo       = siteSettings.DistributorLogoPic;
                            string           webStart        = Globals.GetWebUrlStart();
                            string           imageUrl        = "/Storage/master/DistributorCards/MemberCard" + member.UserId + ".jpg";
                            string           mediaid         = string.Empty;
                            int              ReferralId      = 0;
                            string           storeName       = siteSettings.SiteName;
                            string           NotSuccessMsg   = string.Empty;
                            DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(member.UserId);
                            if (distributorInfo != null)
                            {
                                ReferralId = member.UserId;
                                if (siteSettings.IsShowDistributorSelfStoreName)
                                {
                                    storeName = distributorInfo.StoreName;
                                    storeLogo = distributorInfo.Logo;
                                }
                                imageUrl = "/Storage/master/DistributorCards/StoreCard" + ReferralId + ".jpg";
                            }
                            else if (!siteSettings.IsShowSiteStoreCard)
                            {
                                string content = "您还不是分销商,不能为您生成推广图片,立即<a href='" + webStart + "/Vshop/DistributorCenter.aspx'>申请分销商</a>";
                                if (!string.IsNullOrEmpty(siteSettings.ToRegistDistributorTips))
                                {
                                    content = System.Text.RegularExpressions.Regex.Replace(siteSettings.ToRegistDistributorTips, "{{申请分销商}}", "<a href='" + webStart + "/Vshop/DistributorCenter.aspx'>申请分销商</a>");
                                }
                                result = new TextResponse
                                {
                                    CreateTime   = System.DateTime.Now,
                                    ToUserName   = userOpenId,
                                    FromUserName = clickEventRequest.ToUserName,
                                    Content      = content
                                };
                                return(result);
                            }
                            string postData = string.Empty;
                            string creatingStoreCardTips = siteSettings.CreatingStoreCardTips;
                            if (!string.IsNullOrEmpty(creatingStoreCardTips))
                            {
                                postData = string.Concat(new string[]
                                {
                                    "{\"touser\":\"",
                                    userOpenId,
                                    "\",\"msgtype\":\"text\",\"text\":{\"content\":\"",
                                    Globals.String2Json(creatingStoreCardTips),
                                    "\"}}"
                                });
                                NewsApi.KFSend(access_token, postData);
                            }
                            string filePath = System.Web.HttpContext.Current.Request.MapPath(imageUrl);
                            Task.Factory.StartNew(delegate
                            {
                                try
                                {
                                    System.IO.File.Exists(filePath);
                                    string setJson = System.IO.File.ReadAllText(System.Web.HttpRuntime.AppDomainAppPath + "/Storage/Utility/StoreCardSet.js");
                                    string codeUrl = webStart + "/Follow.aspx?ReferralId=" + ReferralId.ToString();
                                    ScanInfos scanInfosByUserId = ScanHelp.GetScanInfosByUserId(ReferralId, 0, "WX");
                                    if (scanInfosByUserId == null)
                                    {
                                        ScanHelp.CreatNewScan(ReferralId, "WX", 0);
                                        scanInfosByUserId = ScanHelp.GetScanInfosByUserId(ReferralId, 0, "WX");
                                    }
                                    if (scanInfosByUserId != null && !string.IsNullOrEmpty(scanInfosByUserId.CodeUrl))
                                    {
                                        codeUrl = BarCodeApi.GetQRImageUrlByTicket(scanInfosByUserId.CodeUrl);
                                    }
                                    else
                                    {
                                        string token_Message = TokenApi.GetToken_Message(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret);
                                        if (TokenApi.CheckIsRightToken(token_Message))
                                        {
                                            string text = BarCodeApi.CreateTicket(token_Message, scanInfosByUserId.Sceneid, "QR_LIMIT_SCENE", "2592000");
                                            if (!string.IsNullOrEmpty(text))
                                            {
                                                codeUrl = BarCodeApi.GetQRImageUrlByTicket(text);
                                                scanInfosByUserId.CodeUrl        = text;
                                                scanInfosByUserId.CreateTime     = System.DateTime.Now;
                                                scanInfosByUserId.LastActiveTime = System.DateTime.Now;
                                                ScanHelp.updateScanInfosCodeUrl(scanInfosByUserId);
                                            }
                                        }
                                    }
                                    StoreCardCreater storeCardCreater = new StoreCardCreater(setJson, userHead, storeLogo, codeUrl, member.UserName, storeName, ReferralId, member.UserId);
                                    if (storeCardCreater.ReadJson() && storeCardCreater.CreadCard(out NotSuccessMsg))
                                    {
                                        if (ReferralId > 0)
                                        {
                                            DistributorsBrower.UpdateStoreCard(ReferralId, NotSuccessMsg);
                                        }
                                        string media_IDByPath = NewsApi.GetMedia_IDByPath(access_token, webStart + imageUrl);
                                        mediaid = NewsApi.GetJsonValue(media_IDByPath, "media_id");
                                    }
                                    else
                                    {
                                        Globals.Debuglog(NotSuccessMsg, "_DebugCreateStoreCardlog.txt");
                                    }
                                    postData = string.Concat(new string[]
                                    {
                                        "{\"touser\":\"",
                                        userOpenId,
                                        "\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"",
                                        mediaid,
                                        "\"}}"
                                    });
                                    NewsApi.KFSend(access_token, postData);
                                }
                                catch (System.Exception ex3)
                                {
                                    postData = string.Concat(new string[]
                                    {
                                        "{\"touser\":\"",
                                        userOpenId,
                                        "\",\"msgtype\":\"text\",\"text\":{\"content\":\"生成图片失败,",
                                        Globals.String2Json(ex3.ToString()),
                                        "\"}}"
                                    });
                                    NewsApi.KFSend(access_token, postData);
                                }
                            });
                            result = null;
                            return(result);
                        }
                        catch (System.Exception ex)
                        {
                            result = new TextResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                ToUserName   = userOpenId,
                                FromUserName = clickEventRequest.ToUserName,
                                Content      = "问题:" + ex.ToString()
                            };
                            return(result);
                        }
                    }
                    Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);
                    if (reply == null)
                    {
                        result = null;
                    }
                    else
                    {
                        if (reply.MessageType != MessageType.Image)
                        {
                            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);
                            if (keyResponse != null)
                            {
                                result = keyResponse;
                                return(result);
                            }
                        }
                        AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);
                        if (response == null)
                        {
                            this.GotoManyCustomerService(clickEventRequest);
                        }
                        response.ToUserName   = clickEventRequest.FromUserName;
                        response.FromUserName = clickEventRequest.ToUserName;
                        result = response;
                    }
                }
            }
            catch (System.Exception ex2)
            {
                result = new TextResponse
                {
                    CreateTime   = System.DateTime.Now,
                    ToUserName   = clickEventRequest.FromUserName,
                    FromUserName = clickEventRequest.ToUserName,
                    Content      = "问题:" + ex2.ToString()
                };
            }
            return(result);
        }
コード例 #24
0
ファイル: CustomMsgHandler.cs プロジェクト: llenroc/kangaroo
        public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest)
        {
            string text = "";

            MemberProcessor.UpdateUserFollowStateByOpenId(subscribeEventRequest.FromUserName, 1);
            if (subscribeEventRequest.EventKey != null)
            {
                text = subscribeEventRequest.EventKey;
            }
            if (text.Contains("qrscene_"))
            {
                text = text.Replace("qrscene_", "").Trim();
                if (text == "1")
                {
                    if (WeiXinHelper.BindAdminOpenId.Count > 10)
                    {
                        WeiXinHelper.BindAdminOpenId.Clear();
                    }
                    if (WeiXinHelper.BindAdminOpenId.ContainsKey(subscribeEventRequest.Ticket))
                    {
                        WeiXinHelper.BindAdminOpenId[subscribeEventRequest.Ticket] = subscribeEventRequest.FromUserName;
                    }
                    else
                    {
                        WeiXinHelper.BindAdminOpenId.Add(subscribeEventRequest.Ticket, subscribeEventRequest.FromUserName);
                    }
                    return(new TextResponse
                    {
                        CreateTime = System.DateTime.Now,
                        Content = "您正在扫描尝试绑定管理员身份,身份已识别",
                        ToUserName = subscribeEventRequest.FromUserName,
                        FromUserName = subscribeEventRequest.ToUserName
                    });
                }
                ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(subscribeEventRequest.Ticket);
                bool      flag = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName);
                int       num  = scanInfosByTicket.BindUserId;
                if (num < 0)
                {
                    num = 0;
                }
                if (!flag && scanInfosByTicket != null)
                {
                    this.CreatMember(subscribeEventRequest.FromUserName, num, "");
                    ScanHelp.updateScanInfosLastActiveTime(System.DateTime.Now, scanInfosByTicket.Sceneid);
                }
            }
            else
            {
                bool flag2 = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName);
                Globals.Debuglog("关注公众号1", "_DebuglogConcern.txt");
                int num2 = 0;
                if (num2 < 0)
                {
                    num2 = 0;
                }
                if (!flag2)
                {
                    Globals.Debuglog("关注公众号生成用户1", "_DebuglogConcern.txt");
                    this.CreatMember(subscribeEventRequest.FromUserName, num2, "");
                }
            }
            WeiXinHelper.UpdateRencentOpenID(subscribeEventRequest.FromUserName);
            string text2 = "";

            System.Data.DataSet dataSet = new System.Data.DataSet();
            string text3 = System.Web.HttpContext.Current.Server.MapPath("/config/WifiConfig.xml");

            if (System.IO.File.Exists(text3))
            {
                dataSet.ReadXml(text3);
                if (dataSet != null && dataSet.Tables.Count > 0)
                {
                    foreach (System.Data.DataRow dataRow in dataSet.Tables[0].Rows)
                    {
                        if (dataRow["id"].ToString() == text)
                        {
                            text2 = string.Concat(new string[]
                            {
                                dataRow["WifiDescribe"].ToString(),
                                "\r\nWIFI帐号:",
                                dataRow["WifiName"].ToString(),
                                "\r\n WIFI密码:",
                                dataRow["WifiPwd"].ToString()
                            });
                        }
                    }
                }
            }
            if (text2 != "")
            {
                return(new TextResponse
                {
                    CreateTime = System.DateTime.Now,
                    Content = text2,
                    ToUserName = subscribeEventRequest.FromUserName,
                    FromUserName = subscribeEventRequest.ToUserName
                });
            }
            Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply();
            if (subscribeReply == null)
            {
                return(null);
            }
            subscribeReply.Keys = "登录";
            AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(subscribeEventRequest);
            }
            response.ToUserName   = subscribeEventRequest.FromUserName;
            response.FromUserName = subscribeEventRequest.ToUserName;
            return(response);
        }
コード例 #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (base.IsPostBack)
            {
                return;
            }
            if (!(this.type == "getarticleinfo"))
            {
                if ((this.type == "subscribe") && (this.replyID == 0))
                {
                    this.replyID = ReplyHelper.GetSubscribeID(0);
                    if (this.replyID > 0)
                    {
                        base.Response.Redirect("replyedit.aspx?type=subscribe&id=" + this.replyID);
                        base.Response.End();
                    }
                    this.rbtlMatchType.SelectedIndex = 0;
                    if (string.IsNullOrEmpty(this.htmlInfo))
                    {
                        this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                    }
                    this.litInfo.Text = this.htmlInfo;
                }
                else
                {
                    if (this.replyID > 0)
                    {
                        this.htmlTitle = "修改自动回复";
                        Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(this.replyID);
                        if (reply == null)
                        {
                            base.Response.Redirect("replyonkey.aspx");
                            base.Response.End();
                        }
                        else
                        {
                            MessageType messageType = reply.MessageType;
                            if (ReplyType.NoMatch == reply.ReplyType)
                            {
                                this.txtKeys.Text = "*";
                            }
                            else if (ReplyType.Subscribe == reply.ReplyType)
                            {
                                this.txtKeys.Text = "";
                                if (this.type != "subscribe")
                                {
                                    base.Response.Redirect("replyedit.aspx?type=subscribe&id=" + this.replyID);
                                    base.Response.End();
                                }
                            }
                            else
                            {
                                this.txtKeys.Text = reply.Keys.Trim();
                            }
                            for (int i = 0; i < this.rbtlMatchType.Items.Count; i++)
                            {
                                if (this.rbtlMatchType.Items[i].Value == ((int)reply.MatchType).ToString())
                                {
                                    this.rbtlMatchType.Items[i].Selected = true;
                                    break;
                                }
                            }
                            this.hdfMessageType.Value = ((int)reply.MessageType).ToString();
                            this.hdfArticleID.Value   = reply.ArticleID.ToString();
                            int articleID = reply.ArticleID;
                            switch (messageType)
                            {
                            case MessageType.Text:
                            {
                                TextReplyInfo info7 = ReplyHelper.GetReply(this.replyID) as TextReplyInfo;
                                if (info7 != null)
                                {
                                    string str2 = Regex.Replace(Regex.Replace(info7.Text, "</?([^>^a^p]*)>", ""), "<img([^>]*)>", "");
                                    this.fkContent.Text = str2;
                                }
                                break;
                            }

                            case MessageType.News:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo info6 = ReplyHelper.GetReply(this.replyID) as NewsReplyInfo;
                                    if (((info6 != null) && (info6.NewsMsg != null)) && (info6.NewsMsg.Count != 0))
                                    {
                                        this.htmlInfo = "<div class=\"mate-inner\"><h3 id=\"singelTitle\">" + info6.NewsMsg[0].Title + "</h3><span>" + info6.LastEditDate.ToString("M月d日") + "</span><div class=\"mate-img\"><img id=\"img1\" src=\"" + info6.NewsMsg[0].PicUrl + "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">" + info6.NewsMsg[0].Description + "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>";
                                    }
                                }
                                break;

                            case MessageType.List:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo info4 = ReplyHelper.GetReply(this.replyID) as NewsReplyInfo;
                                    if (info4 != null)
                                    {
                                        StringBuilder builder2 = new StringBuilder();
                                        if ((info4.NewsMsg != null) && (info4.NewsMsg.Count > 0))
                                        {
                                            int num4 = 0;
                                            foreach (NewsMsgInfo info5 in info4.NewsMsg)
                                            {
                                                num4++;
                                                if (num4 == 1)
                                                {
                                                    builder2.Append("<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"" + info5.PicUrl + "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">" + info5.Title + "</div>                 </div>             </div>");
                                                }
                                                else
                                                {
                                                    builder2.Append("             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">" + info5.Title + "</div>                         <div class=\"img\">                             <img src=\"" + info5.PicUrl + "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>");
                                                }
                                            }
                                            this.htmlInfo = builder2.ToString();
                                        }
                                    }
                                }
                                break;
                            }
                        }
                    }
                    if (string.IsNullOrEmpty(this.htmlInfo))
                    {
                        this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                    }
                    this.litInfo.Text = this.htmlInfo;
                }
                goto Label_0800;
            }
            base.Response.ContentType = "application/json";
            string s         = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
            int    articleid = Globals.RequestFormNum("articleid");

            if (articleid > 0)
            {
                ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(articleid);
                if (articleInfo != null)
                {
                    StringBuilder builder = new StringBuilder();
                    switch (articleInfo.ArticleType)
                    {
                    case ArticleType.News:
                        s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", String2Json(articleInfo.Title), "\",\"date\":\"", String2Json(articleInfo.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", String2Json(articleInfo.ImageUrl), "\",\"memo\":\"", String2Json(articleInfo.Memo), "\"}" });
                        goto Label_0301;

                    case ArticleType.List:
                        foreach (ArticleItemsInfo info2 in articleInfo.ItemsInfo)
                        {
                            builder.Append("{\"title\":\"" + String2Json(info2.Title) + "\",\"imgurl\":\"" + String2Json(info2.ImageUrl) + "\"},");
                        }
                        s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", String2Json(articleInfo.Title), "\",\"date\":\"", String2Json(articleInfo.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", String2Json(articleInfo.ImageUrl), "\",\"items\":[", builder.ToString().Trim(new char[] { ',' }), "]}" });
                        goto Label_0301;
                    }
                    s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", String2Json(articleInfo.Title), "\",\"date\":\"", String2Json(articleInfo.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", String2Json(articleInfo.ImageUrl), "\",\"memo\":\"", String2Json(articleInfo.Content), "\"}" });
                }
            }
Label_0301:
            base.Response.Write(s);
            base.Response.End();
Label_0800:
            if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0)
            {
                for (int j = 0; j < this.rbtlMatchType.Items.Count; j++)
                {
                    if (this.rbtlMatchType.Items[j].Value == "4")
                    {
                        this.rbtlMatchType.Items[j].Enabled = false;
                    }
                }
            }
        }
コード例 #26
0
ファイル: ReplyEdit.cs プロジェクト: zwkjgs/XKD
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (this.type == "getarticleinfo")
                {
                    base.Response.ContentType = "application/json";
                    string s   = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                    int    num = Globals.RequestFormNum("articleid");
                    if (num > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo != null)
                        {
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            switch (articleInfo.ArticleType)
                            {
                            case ArticleType.News:
                                s = string.Concat(new object[]
                                {
                                    "{\"type\":\"1\",\"articletype\":",
                                    (int)articleInfo.ArticleType,
                                    ",\"title\":\"",
                                    ReplyEdit.String2Json(articleInfo.Title),
                                    "\",\"date\":\"",
                                    ReplyEdit.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                    "\",\"imgurl\":\"",
                                    ReplyEdit.String2Json(articleInfo.ImageUrl),
                                    "\",\"memo\":\"",
                                    ReplyEdit.String2Json(articleInfo.Memo),
                                    "\"}"
                                });
                                goto IL_301;

                            case ArticleType.List:
                            {
                                System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
                                foreach (ArticleItemsInfo current in itemsInfo)
                                {
                                    stringBuilder.Append(string.Concat(new string[]
                                        {
                                            "{\"title\":\"",
                                            ReplyEdit.String2Json(current.Title),
                                            "\",\"imgurl\":\"",
                                            ReplyEdit.String2Json(current.ImageUrl),
                                            "\"},"
                                        }));
                                }
                                s = string.Concat(new object[]
                                    {
                                        "{\"type\":\"1\",\"articletype\":",
                                        (int)articleInfo.ArticleType,
                                        ",\"title\":\"",
                                        ReplyEdit.String2Json(articleInfo.Title),
                                        "\",\"date\":\"",
                                        ReplyEdit.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                        "\",\"imgurl\":\"",
                                        ReplyEdit.String2Json(articleInfo.ImageUrl),
                                        "\",\"items\":[",
                                        stringBuilder.ToString().Trim(new char[]
                                        {
                                            ','
                                        }),
                                        "]}"
                                    });
                                goto IL_301;
                            }
                            }
                            s = string.Concat(new object[]
                            {
                                "{\"type\":\"1\",\"articletype\":",
                                (int)articleInfo.ArticleType,
                                ",\"title\":\"",
                                ReplyEdit.String2Json(articleInfo.Title),
                                "\",\"date\":\"",
                                ReplyEdit.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                "\",\"imgurl\":\"",
                                ReplyEdit.String2Json(articleInfo.ImageUrl),
                                "\",\"memo\":\"",
                                ReplyEdit.String2Json(articleInfo.Content),
                                "\"}"
                            });
                        }
                    }
IL_301:
                    base.Response.Write(s);
                    base.Response.End();
                }
                else if (this.type == "subscribe" && this.replyID == 0)
                {
                    this.replyID = ReplyHelper.GetSubscribeID(0);
                    if (this.replyID > 0)
                    {
                        base.Response.Redirect("replyedit.aspx?type=subscribe&id=" + this.replyID);
                        base.Response.End();
                    }
                    this.rbtlMatchType.SelectedIndex = 0;
                    if (string.IsNullOrEmpty(this.htmlInfo))
                    {
                        this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                    }
                    this.litInfo.Text = this.htmlInfo;
                }
                else
                {
                    if (this.replyID > 0)
                    {
                        this.htmlTitle = "修改自动回复";
                        Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(this.replyID);
                        if (reply != null)
                        {
                            MessageType messageType = reply.MessageType;
                            if (ReplyType.NoMatch == reply.ReplyType)
                            {
                                this.txtKeys.Text = "*";
                            }
                            else if (ReplyType.Subscribe == reply.ReplyType)
                            {
                                this.txtKeys.Text = "";
                                if (this.type != "subscribe")
                                {
                                    base.Response.Redirect("replyedit.aspx?type=subscribe&id=" + this.replyID);
                                    base.Response.End();
                                }
                            }
                            else
                            {
                                this.txtKeys.Text = reply.Keys.Trim();
                            }
                            for (int i = 0; i < this.rbtlMatchType.Items.Count; i++)
                            {
                                if (this.rbtlMatchType.Items[i].Value == ((int)reply.MatchType).ToString())
                                {
                                    this.rbtlMatchType.Items[i].Selected = true;
                                    break;
                                }
                            }
                            this.hdfMessageType.Value = ((int)reply.MessageType).ToString();
                            this.hdfArticleID.Value   = reply.ArticleID.ToString();
                            int articleID = reply.ArticleID;
                            switch (messageType)
                            {
                            case MessageType.Text:
                            {
                                TextReplyInfo textReplyInfo = ReplyHelper.GetReply(this.replyID) as TextReplyInfo;
                                if (textReplyInfo != null)
                                {
                                    string text = textReplyInfo.Text;
                                    text = System.Text.RegularExpressions.Regex.Replace(text, "</?([^>^a^p]*)>", "");
                                    text = System.Text.RegularExpressions.Regex.Replace(text, "<img([^>]*)>", "");
                                    text = text.Replace("</p>", "\r\n");
                                    text = text.Replace("<p>", "");
                                    this.fkContent.Text = text;
                                }
                                break;
                            }

                            case MessageType.News:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.replyID) as NewsReplyInfo;
                                    if (newsReplyInfo != null && newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count != 0)
                                    {
                                        this.htmlInfo = string.Concat(new string[]
                                        {
                                            "<div class=\"mate-inner\"><h3 id=\"singelTitle\">",
                                            newsReplyInfo.NewsMsg[0].Title,
                                            "</h3><span>",
                                            newsReplyInfo.LastEditDate.ToString("M月d日"),
                                            "</span><div class=\"mate-img\"><img id=\"img1\" src=\"",
                                            newsReplyInfo.NewsMsg[0].PicUrl,
                                            "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">",
                                            newsReplyInfo.NewsMsg[0].Description,
                                            "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>"
                                        });
                                    }
                                }
                                break;

                            case MessageType.List:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.replyID) as NewsReplyInfo;
                                    if (newsReplyInfo2 != null)
                                    {
                                        System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                                        if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0)
                                        {
                                            int num2 = 0;
                                            foreach (NewsMsgInfo current2 in newsReplyInfo2.NewsMsg)
                                            {
                                                num2++;
                                                if (num2 == 1)
                                                {
                                                    stringBuilder2.Append(string.Concat(new string[]
                                                    {
                                                        "<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"",
                                                        current2.PicUrl,
                                                        "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">",
                                                        current2.Title,
                                                        "</div>                 </div>             </div>"
                                                    }));
                                                }
                                                else
                                                {
                                                    stringBuilder2.Append(string.Concat(new string[]
                                                    {
                                                        "             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">",
                                                        current2.Title,
                                                        "</div>                         <div class=\"img\">                             <img src=\"",
                                                        current2.PicUrl,
                                                        "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>"
                                                    }));
                                                }
                                            }
                                            this.htmlInfo = stringBuilder2.ToString();
                                        }
                                    }
                                }
                                break;
                            }
                        }
                        else
                        {
                            base.Response.Redirect("replyonkey.aspx");
                            base.Response.End();
                        }
                    }
                    if (string.IsNullOrEmpty(this.htmlInfo))
                    {
                        this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                    }
                    this.litInfo.Text = this.htmlInfo;
                }
                if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0)
                {
                    for (int j = 0; j < this.rbtlMatchType.Items.Count; j++)
                    {
                        if (this.rbtlMatchType.Items[j].Value == "4")
                        {
                            this.rbtlMatchType.Items[j].Enabled = false;
                        }
                    }
                }
            }
        }
コード例 #27
0
ファイル: ReplyDao.cs プロジェクト: ZhangVic/asp1110git
        public bool UpdateReply(ReplyInfo reply)
        {
            switch (reply.MessageType)
            {
                case MessageType.Text:
                    return this.UpdateTextReply(reply as TextReplyInfo);

                case MessageType.News:
                case MessageType.List:
                    return this.UpdateNewsReply(reply as NewsReplyInfo);
            }
            return this.UpdateTextReply(reply as TextReplyInfo);
        }
コード例 #28
0
ファイル: ReplyDao.cs プロジェクト: ZhangVic/asp1110git
        public bool SaveReply(ReplyInfo reply)
        {
            bool flag = false;
            switch (reply.MessageType)
            {
                case MessageType.Text:
                    return this.SaveTextReply(reply as TextReplyInfo);

                case MessageType.News:
                case MessageType.List:
                    return this.SaveNewsReply(reply as NewsReplyInfo);

                case (MessageType.News | MessageType.Text):
                    return flag;
            }
            return flag;
        }
コード例 #29
0
        public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest)
        {
            string eventKey = "";

            if (subscribeEventRequest.EventKey != null)
            {
                eventKey = subscribeEventRequest.EventKey;
            }
            if (eventKey.Contains("qrscene_"))
            {
                eventKey = eventKey.Replace("qrscene_", "").Trim();
                if (eventKey == "1")
                {
                    if (WeiXinHelper.BindAdminOpenId.Count > 10)
                    {
                        WeiXinHelper.BindAdminOpenId.Clear();
                    }
                    if (WeiXinHelper.BindAdminOpenId.ContainsKey(subscribeEventRequest.Ticket))
                    {
                        WeiXinHelper.BindAdminOpenId[subscribeEventRequest.Ticket] = subscribeEventRequest.FromUserName;
                    }
                    else
                    {
                        WeiXinHelper.BindAdminOpenId.Add(subscribeEventRequest.Ticket, subscribeEventRequest.FromUserName);
                    }
                    return(new TextResponse {
                        CreateTime = DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = subscribeEventRequest.FromUserName, FromUserName = subscribeEventRequest.ToUserName
                    });
                }
                ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(subscribeEventRequest.Ticket);
                bool      flag       = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName);
                int       bindUserId = scanInfosByTicket.BindUserId;
                if (bindUserId < 0)
                {
                    bindUserId = 0;
                }
                if (!flag && (scanInfosByTicket != null))
                {
                    this.CreatMember(subscribeEventRequest.FromUserName, bindUserId, "");
                    ScanHelp.updateScanInfosLastActiveTime(DateTime.Now, scanInfosByTicket.Sceneid);
                }
            }
            else
            {
                bool flag2 = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName);
                Globals.Debuglog("关注公众号1", "_DebuglogConcern.txt");
                int referralUserId = 0;
                if (referralUserId < 0)
                {
                    referralUserId = 0;
                }
                if (!flag2)
                {
                    Globals.Debuglog("关注公众号生成用户1", "_DebuglogConcern.txt");
                    this.CreatMember(subscribeEventRequest.FromUserName, referralUserId, "");
                }
            }
            WeiXinHelper.UpdateRencentOpenID(subscribeEventRequest.FromUserName);
            string  str2 = "";
            DataSet set  = new DataSet();
            string  path = HttpContext.Current.Server.MapPath("/config/WifiConfig.xml");

            if (File.Exists(path))
            {
                set.ReadXml(path);
                if ((set != null) && (set.Tables.Count > 0))
                {
                    foreach (DataRow row in set.Tables[0].Rows)
                    {
                        if (row["id"].ToString() == eventKey)
                        {
                            str2 = row["WifiDescribe"].ToString() + "\r\nWIFI帐号:" + row["WifiName"].ToString() + "\r\n WIFI密码:" + row["WifiPwd"].ToString();
                        }
                    }
                }
            }
            if (str2 != "")
            {
                return(new TextResponse {
                    CreateTime = DateTime.Now, Content = str2, ToUserName = subscribeEventRequest.FromUserName, FromUserName = subscribeEventRequest.ToUserName
                });
            }
            Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply();
            if (subscribeReply == null)
            {
                return(null);
            }
            subscribeReply.Keys = "登录";
            AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(subscribeEventRequest);
            }
            response.ToUserName   = subscribeEventRequest.FromUserName;
            response.FromUserName = subscribeEventRequest.ToUserName;
            return(response);
        }
コード例 #30
0
ファイル: AliPayFuwuApi.cs プロジェクト: llenroc/kangaroo
        private void replyAction(string FromUserId, string eventType, string textContent, string ActionParam)
        {
            Articles articles = new Articles
            {
                toUserId = FromUserId,
                msgType  = "text",
                text     = new MessageText
                {
                    content = "系统未找到相关信息!"
                }
            };

            if (eventType != "")
            {
                if ("follow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.AddFuwuFollowUser(FromUserId);
                    }
                    string aliOHFollowRelayTitle = this.siteSettings.AliOHFollowRelayTitle;
                    Hidistro.Entities.VShop.ReplyInfo subscribeReply = AliFuwuReplyHelper.GetSubscribeReply();
                    if (subscribeReply != null)
                    {
                        if (subscribeReply.MessageType == MessageType.Text)
                        {
                            TextReplyInfo textReplyInfo = subscribeReply as TextReplyInfo;
                            articles.text.content = textReplyInfo.Text;
                        }
                        else if (subscribeReply.ArticleID > 0)
                        {
                            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(subscribeReply.ArticleID);
                            if (articleInfo != null)
                            {
                                articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                            }
                            else
                            {
                                articles.text.content = aliOHFollowRelayTitle;
                            }
                        }
                    }
                    else
                    {
                        articles.text.content = aliOHFollowRelayTitle;
                    }
                }
                else if ("unfollow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.DelFuwuFollowUser(FromUserId);
                    }
                }
                else if ("click".Equals(eventType))
                {
                    int num = 0;
                    if (ActionParam != "" && int.TryParse(ActionParam, out num) && num > 0)
                    {
                        Hidistro.Entities.VShop.MenuInfo fuwuMenu = VShopHelper.GetFuwuMenu(num);
                        if (fuwuMenu != null)
                        {
                            Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(fuwuMenu.ReplyId);
                            if (reply != null)
                            {
                                ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(reply.ArticleID);
                                if (articleInfo2 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(articleInfo2, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                }
                            }
                        }
                    }
                }
                else if ("enter".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(this.UserInfo))
                    {
                        MemberInfo openIdMember = MemberProcessor.GetOpenIdMember(FromUserId, "fuwu");
                        if (openIdMember != null && openIdMember.AlipayLoginId.StartsWith("FW*"))
                        {
                            JObject jObject       = JsonConvert.DeserializeObject(this.UserInfo) as JObject;
                            string  alipayLoginId = "";
                            string  text          = "";
                            if (jObject["logon_id"] != null)
                            {
                                alipayLoginId = jObject["logon_id"].ToString();
                            }
                            if (jObject["user_name"] != null)
                            {
                                text = jObject["user_name"].ToString();
                            }
                            if (text != "" && text != "")
                            {
                                openIdMember.AlipayLoginId  = alipayLoginId;
                                openIdMember.AlipayUsername = text;
                                MemberProcessor.SetAlipayInfos(openIdMember);
                            }
                        }
                    }
                    if (!ActionParam.Contains("sceneId"))
                    {
                        return;
                    }
                    JObject jObject2 = JsonConvert.DeserializeObject(ActionParam) as JObject;
                    if (jObject2["scene"]["sceneId"] != null)
                    {
                        string text2 = jObject2["scene"]["sceneId"].ToString();
                        if (text2.StartsWith("bind"))
                        {
                            if (AlipayFuwuConfig.BindAdmin.Count > 10)
                            {
                                AlipayFuwuConfig.BindAdmin.Clear();
                            }
                            if (AlipayFuwuConfig.BindAdmin.ContainsKey(text2))
                            {
                                AlipayFuwuConfig.BindAdmin[text2] = FromUserId;
                            }
                            else
                            {
                                AlipayFuwuConfig.BindAdmin.Add(text2, FromUserId);
                            }
                            articles.text.content = "您正在尝试绑定服务窗管理员身份!";
                        }
                    }
                }
            }
            else if (textContent != "")
            {
                articles = null;
                System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies = AliFuwuReplyHelper.GetReplies(ReplyType.Keys);
                if (replies != null && replies.Count > 0)
                {
                    foreach (Hidistro.Entities.VShop.ReplyInfo current in replies)
                    {
                        if (current != null)
                        {
                            if (current.MatchType == MatchType.Equal && current.Keys == textContent)
                            {
                                if (current.MessageType == MessageType.Text)
                                {
                                    articles = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text",
                                        text     = new MessageText
                                        {
                                            content = ""
                                        }
                                    };
                                    TextReplyInfo textReplyInfo2 = current as TextReplyInfo;
                                    articles.text.content = textReplyInfo2.Text;
                                    break;
                                }
                                if (current.ArticleID > 0)
                                {
                                    ArticleInfo articleInfo3 = ArticleHelper.GetArticleInfo(current.ArticleID);
                                    if (articleInfo3 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(articleInfo3, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                            if (current.MatchType == MatchType.Like && current.Keys.Contains(textContent))
                            {
                                if (current.MessageType == MessageType.Text)
                                {
                                    articles = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text",
                                        text     = new MessageText
                                        {
                                            content = ""
                                        }
                                    };
                                    TextReplyInfo textReplyInfo3 = current as TextReplyInfo;
                                    articles.text.content = textReplyInfo3.Text;
                                    break;
                                }
                                if (current.ArticleID > 0)
                                {
                                    ArticleInfo articleInfo4 = ArticleHelper.GetArticleInfo(current.ArticleID);
                                    if (articleInfo4 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(articleInfo4, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (articles == null)
            {
                System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies2 = AliFuwuReplyHelper.GetReplies(ReplyType.NoMatch);
                if (replies2 != null && replies2.Count > 0)
                {
                    using (System.Collections.Generic.IEnumerator <Hidistro.Entities.VShop.ReplyInfo> enumerator2 = replies2.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            Hidistro.Entities.VShop.ReplyInfo current2 = enumerator2.Current;
                            if (current2.MessageType == MessageType.Text)
                            {
                                articles = new Articles
                                {
                                    toUserId = FromUserId,
                                    msgType  = "text",
                                    text     = new MessageText
                                    {
                                        content = ""
                                    }
                                };
                                TextReplyInfo textReplyInfo4 = current2 as TextReplyInfo;
                                articles.text.content = textReplyInfo4.Text;
                                break;
                            }
                            if (current2.ArticleID > 0)
                            {
                                ArticleInfo articleInfo5 = ArticleHelper.GetArticleInfo(current2.ArticleID);
                                if (articleInfo5 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(articleInfo5, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                    if (articles != null)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        goto IL_674;
                    }
                }
                articles = new Articles
                {
                    toUserId = FromUserId,
                    msgType  = "text",
                    text     = new MessageText
                    {
                        content = "系统未找到相关信息!"
                    }
                };
            }
IL_674:
            AliOHHelper.log(AliOHHelper.CustomSend(articles).Body);
        }
コード例 #31
0
        public AbstractResponse GetResponse(Hidistro.Entities.VShop.ReplyInfo reply, string openId)
        {
            if (reply.MessageType == Hidistro.Entities.VShop.MessageType.Text)
            {
                TextReplyInfo info     = reply as TextReplyInfo;
                TextResponse  response = new TextResponse
                {
                    CreateTime = DateTime.Now,
                    Content    = info.Text
                };
                if (reply.Keys == "登录")
                {
                    string str = string.Format("http://{0}/Vshop/Login.aspx?SessionId={1}", HttpContext.Current.Request.Url.Host, openId);
                    response.Content = response.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", str));
                }
                return(response);
            }
            NewsResponse response2 = new NewsResponse
            {
                CreateTime = DateTime.Now,
                Articles   = new List <Article>()
            };

            if (reply.ArticleID > 0)
            {
                ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(reply.ArticleID);
                if (articleInfo.ArticleType == ArticleType.News)
                {
                    Article item = new Article
                    {
                        Description = articleInfo.Memo,
                        PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                        Title       = articleInfo.Title,
                        Url         = string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url
                    };
                    response2.Articles.Add(item);
                    return(response2);
                }
                if (articleInfo.ArticleType == ArticleType.List)
                {
                    Article article3 = new Article
                    {
                        Description = articleInfo.Memo,
                        PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                        Title       = articleInfo.Title,
                        Url         = string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url
                    };
                    response2.Articles.Add(article3);
                    foreach (ArticleItemsInfo info3 in articleInfo.ItemsInfo)
                    {
                        article3 = new Article
                        {
                            Description = "",
                            PicUrl      = this.FormatImgUrl(info3.ImageUrl),
                            Title       = info3.Title,
                            Url         = string.IsNullOrEmpty(info3.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?iid={1}", HttpContext.Current.Request.Url.Host, info3.Id) : info3.Url
                        };
                        response2.Articles.Add(article3);
                    }
                }
                return(response2);
            }
            foreach (NewsMsgInfo info4 in (reply as NewsReplyInfo).NewsMsg)
            {
                Article article6 = new Article
                {
                    Description = info4.Description,
                    PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info4.PicUrl),
                    Title       = info4.Title,
                    Url         = string.IsNullOrEmpty(info4.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", HttpContext.Current.Request.Url.Host, info4.Id) : info4.Url
                };
                response2.Articles.Add(article6);
            }
            return(response2);
        }