示例#1
0
        //校验票据(数据库数据匹配)
        private bool ValidateTicket(string encryptToken, string appId)
        {
            YLApiEntities db   = new YLApiEntities();
            bool          flag = false;

            try
            {
                //获取数据库Token
                var model = db.Account.Where(d => d.token == encryptToken).SingleOrDefault();
                if (model != null && model.token == encryptToken) //存在
                {
                    //未超时
                    flag = (DateTime.Now <= model.expireDate) ? true : false;
                }
            }
            catch (Exception ex) { }
            return(flag);
        }
示例#2
0
        public static void SetAppIdlog(string appid, string controller, string action)
        {
            YLApiEntities db       = new YLApiEntities();
            AppIdLog      appidlog = new AppIdLog();

            appidlog.appId      = appid;
            appidlog.actionName = action;
            appidlog.addTime    = DateTime.Now;
            appidlog.controller = controller;
            appidlog.remark     = "";
            try
            {
                db.AppIdLog.Add(appidlog);
                db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }