示例#1
0
        /// <summary>
        /// 判断用户访问的地址的格式是否与指定AppFunction定义的相同
        /// </summary>
        /// <param name="userLoc">用户的地址</param>
        /// <returns>是/否</returns>
        public bool MatchLocation(string userLoc)
        {
            string funcLoc = Location ?? "";
            string regTail = RegTail;

            if (regTail.IsEmpty())
            {
                userLoc = CommOp.CutStr(userLoc, '?', '#');
                if (!funcLoc.EndsWith("/"))
                {
                    funcLoc += "/";
                }
                if (!userLoc.EndsWith("/"))
                {
                    userLoc += "/";
                }
                if (funcLoc.Equals(userLoc, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }
            else
            {
                string pattern = "^" + funcLoc + "(" + regTail + ")";
                if (Regex.IsMatch(userLoc, pattern, RegexOptions.IgnoreCase))
                {
                    return(true);
                }
            }
            return(false);
        }
        public ActionResult Index(string title, string msg)
        {
            title = CommOp.CutStr(title, 20);

            ApiHelper.BroadCastMessage(new JMessage
            {
                Channel  = SendChannel.Custom, //Custom代表发微信
                Content  = CommOp.CutStr(msg, 100),
                Title    = title,
                SenderId = CurrentUserId.ToInt(),
                //SendToIds = new int[] { CurrentUserId.ToInt() },
                Url = Url.Action("Detail", new { title = title })
            });
            msgDict[title] = msg;
            return(JsonTips("success", "发送成功!"));
        }