/// <summary>
        /// 我的服务
        /// </summary>
        public ActionResult My()
        {
            var email = CookieHelper.Email;
            var user  = UserCache.Cache.GetValue(email);
            var my    = ProductService.MyInfo(user.Id);

            if (my == null || !my.status)
            {
                //服务不存在 或 已过期
                my = new MyProductDto();
            }
            var nodes = ServerNodeService.GetAll(my);

            ViewData["My"]    = my;
            ViewData["Nodes"] = nodes;
            return(View());
        }
예제 #2
0
        public static List <ServerNodeDto> GetAll(MyProductDto my)
        {
            var nodes = new List <ServerNodeDto>();

            using (var DB = new SSMMEntities())
            {
                var result = DB.ServerNode.OrderByDescending(x => x.SortNum).ToList();
                result.ForEach(x =>
                {
                    nodes.Add(new ServerNodeDto()
                    {
                        Id          = x.Id,
                        Name        = x.Name,
                        IP          = x.IP,
                        CNAME       = x.CNAME,
                        Description = x.Description,
                        Status      = x.Status,
                        SortNum     = x.SortNum,
                        QRCode      = $"ss://{FormatHelper.EncodeBase64ByUTF8($"rc4-md5:{my.password}@{x.IP}:{my.port}")}"
                    });
                });
            }
            return(nodes);
        }