コード例 #1
0
        public override ActionResult Index()
        {
            //var tagList = MailListApi.GetTagList(GetToken()).taglist;
            var tagList = WeChatCommonService.GetTagListByAccountManageID(this.AccountManageID);

            ViewBag.taglist = tagList;



            return(View());
        }
コード例 #2
0
        public virtual ActionResult Edit(int appId)
        {
            var autoReplyId = Request["id"];

            var view = new AutoReplyView();

            // edit
            if (!string.IsNullOrEmpty(autoReplyId))
            {
                var id = int.Parse(autoReplyId);
                view = _autoReplyService.GetDetail(id);
            }

            var wechatConfig = WeChatCommonService.GetWeChatConfigByID(appId);

            if (wechatConfig.IsCorp.Value)
            {
                // 企业号口令类型
                ViewBag.KeywordTypes = typeof(AutoReplyKeywordEnum).GetAllItems().OrderBy(a => a.Value);
                ViewBag.IsCorp       = 1;
                var tagList = WeChatCommonService.GetTagListByAccountManageID(this.AccountManageID);
                Dictionary <int, string> UserTagMap = new Dictionary <int, string>();
                tagList.ForEach(a => UserTagMap.Add(int.Parse(a.tagid), a.tagname));
                ViewBag.UserTagMap = UserTagMap;
            }
            else
            {
                // 服务号口令类型
                ViewBag.KeywordTypes = typeof(AutoReplyMPKeywordEnum).GetAllItems().OrderBy(a => a.Value);
                ViewBag.IsCorp       = 0;
                var tagList = _messageTagService.Repository.Entities.Where(a => a.IsDeleted == false && a.AppID == appId).ToList();
                Dictionary <int, string> messageTagMap = new Dictionary <int, string>();
                tagList.ForEach(a => messageTagMap.Add(a.Id, a.TagName));
                ViewBag.MessageTagMap = messageTagMap;
                Dictionary <int, string> groupMap = new Dictionary <int, string>();
#if (DEBUG)
                {
                    groupMap.Add(1, "groupName1");
                    groupMap.Add(2, "groupName2");
                }
#else
                {
                    var groupResult = Innocellence.Weixin.MP.AdvancedAPIs.UserTagApi.Get(wechatConfig.WeixinAppId, wechatConfig.WeixinCorpSecret);
                    groupResult.tags.ForEach(g => groupMap.Add(g.id, g.name));
                }
#endif
                ViewBag.GroupMap = groupMap;
                Dictionary <int, string> userTagMap = new Dictionary <int, string>();
                lstUserTag.ForEach(t => userTagMap.Add(t.Id, t.Name));
                ViewBag.UserTagMap = userTagMap;
            }
            // 文本匹配类型
            ViewBag.TextMatchTypes = typeof(AutoReplyTextMatchEnum).GetAllItems();
            // 菜单类型
            ViewBag.MenuTypes = typeof(AutoReplyMenuEnum).GetAllItems();
            // 回复类型
            ViewBag.ReplyTypes = typeof(AutoReplyContentEnum).GetAllItems();
            // 回复类型
            ViewBag.ReplyNewsTypes = typeof(AutoReplyNewsEnum).GetAllItems();
            ViewBag.AppId          = appId;

            return(View("../AutoReply/Edit", view));
        }