Beispiel #1
0
    protected override async Task ExecuteAsync(CancellationToken cancellationToken)
    {
        while (!cancellationToken.IsCancellationRequested)
        {
            try
            {
                var html = @"https://wx.5i5j.com/ershoufang/n1/";

                HtmlWeb web          = new HtmlWeb();
                var     htmlDoc      = web.Load(html);
                var     nodehousetit = htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[5]/div[1]/div[1]/div/span");
                // var nodeprice = htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[3]/div[2]/div[2]/div[1]/span");
                // var nodeSellHouseCount = htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[3]/div[2]/div[2]/div[2]/ul/li[5]/a");
                // var nodeRentHouseCount = htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[3]/div[2]/div[2]/div[2]/ul/li[6]/a");
                // var nodeSeeCountRecentThirtyDays = htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[3]/div[2]/div[2]/ul/li[1]/div[2]/p");

                GlobalStatus status = new  GlobalStatus();
                status.StatusFrom          = "5i5j";
                status.TotalCommunityCount = int.Parse(nodehousetit.InnerText);
                // status.CreateTime = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();
                dbStorage.SaveGlobalStatus(status);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            await Task.Delay(1000 * 60 * 30);
        }
    }
Beispiel #2
0
 public bool SaveGlobalStatus(GlobalStatus status)
 {
     using (var db = new efContext())
     {
         db.GlobalStatuses.Add(status);
         return(db.SaveChanges() > 0);
     }
 }
        public void enableControlSurfaces(KSPActionParam param)
        {
            if (toggles == null)
            {
                Start();
            }

            ModuleEngineGimbal.EnableGlobal();
            globalStatus = GlobalStatus.enabled;
        }
 public void EventEnableAll()
 {
     if (toggles == null)
     {
         Debug.Log("ERROR: ModuleEngineGimbal.EventEnableAll, toggles is null");
         Start();
     }
     ModuleEngineGimbal.EnableGlobal();
     globalStatus = GlobalStatus.enabled;
 }
Beispiel #5
0
    void Awake()
    {
        if (Instance == null)
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        LevelOne   = false;
        LevelTwo   = false;
        LevelThree = false;
    }
Beispiel #6
0
 protected IHttpActionResult NoOK(GlobalStatus statusCode)
 {
     return(NoOK(statusCode.ToString()) as ResponseMessageResult);
 }
Beispiel #7
0
        public String LoginValidate(string uid, string password, string areaCode)
        {
            if (string.IsNullOrEmpty(uid) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(areaCode))
            {
                return(GlobalStatus.GetStatus("HX06"));
            }


            //List<ParameterJson> list = new List<ParameterJson>();
            //if (uid == "InforCenterAdmin")
            //{
            //    list.Add(new ParameterJson("U_IsValid", ConditionOperate.Equal.ToString(), "1"));
            //    list.Add(new ParameterJson("UID", ConditionOperate.Equal.ToString(), uid));
            //    list.Add(new ParameterJson("PassWord", ConditionOperate.Equal.ToString(), MD5Helper.MD5Encrypt64(password)));
            //    areaCode = "0CFD858E";
            //    list.Add(new ParameterJson("U_AreaCode", ConditionOperate.Equal.ToString(), areaCode));
            //}
            //else
            //{
            //    list.Add(new ParameterJson("U_IsValid", ConditionOperate.Equal.ToString(), "1"));
            //    list.Add(new ParameterJson("UID", ConditionOperate.Equal.ToString(), uid));
            //    list.Add(new ParameterJson("PassWord", ConditionOperate.Equal.ToString(), MD5Helper.MD5Encrypt64(password)));
            //    list.Add(new ParameterJson("U_AreaCode", ConditionOperate.Equal.ToString(), areaCode));
            //}
            //string sCondition = JsonConvert.SerializeObject(list);
            //#endregion

            string     pwd   = MD5Helper.MD5Encrypt32(password);
            Power_User model = _userRepository.List(x => x.U_IsValid == true && x.UID == uid && x.PassWord == pwd && x.U_AreaCode == areaCode).FirstOrDefault();


            //用户、密码、区域验证不通过,不跳转页面
            if (model == null)
            {
                return(GlobalStatus.GetStatus("HX02"));
            }

            //验证 账号同时只能一个在线
            //bool IsOpenOnlyUser = _op.IsOpenOnlyUser;
            //if (IsOpenOnlyUser)
            //{
            //    bool flag = CacheHelper.HashExists((int)RedisDB.Power, "RegisterUCRelation", model.ID.ToString());
            //    if (flag)
            //    {
            //        return GlobalStatus.GetStatus("HX03");
            //    }
            //}


            //List<ParameterJson> listparam = new List<ParameterJson>();
            //listparam.Add(new ParameterJson("U_IsValid", ConditionOperate.Equal.ToString(), "1"));
            //listparam.Add(new ParameterJson("UserId", ConditionOperate.Equal.ToString(), model.ID.ToString()));
            //string sCondition1 = JsonConvert.SerializeObject(listparam);
            //#endregion
            //string strRoleMenu = _userRolebll.GetListJson(sCondition1);
            //string roleIds = string.Empty;
            //if (!string.IsNullOrEmpty(strRoleMenu))
            //{
            //    List<Power_RoleMenuView> aaa = JsonConvert.DeserializeObject<List<Power_RoleMenuView>>(strRoleMenu);
            //    var ccc = aaa.Select(x => x.RoleID.ToString()).Distinct().ToList();
            //    roleIds = string.Join(",", ccc.ToArray());
            //}


            //Guid? orgId = Guid.Empty;
            //#region 条件组合
            //List<ParameterJson> listparam1 = new List<ParameterJson>();
            //listparam1.Add(new ParameterJson("U_IsValid", ConditionOperate.Equal.ToString(), "1"));
            //listparam1.Add(new ParameterJson("UserId", ConditionOperate.Equal.ToString(), model.ID.ToString()));
            //string sCondition2 = JsonConvert.SerializeObject(listparam1);
            //#endregion
            //string strjson = _userorgbll.GetListJson(sCondition2);
            //if (strjson != null && strjson != "[]")
            //{
            //    List<Power_UserOrgView> userorglist = JsonConvert.DeserializeObject<List<Power_UserOrgView>>(strjson);
            //    if (userorglist.Count > 0)
            //    {
            //        Power_UserOrgView entity = userorglist.FirstOrDefault();
            //        orgId = entity.OrgID;
            //    }
            //}
            //else
            //{
            //    return GlobalStatus.GetStatus("HX04");
            //}


            MessageUser mu = new MessageUser();

            mu.ID         = model.ID;
            mu.Cn         = model.Cn;
            mu.IPAddress  = CommonHelper.GetIP(); //???
            mu.Isinitial  = true;
            mu.IsSystem   = true;
            mu.LogTime    = DateTime.Now;
            mu.UID        = model.UID;
            mu.U_AreaCode = model.U_AreaCode;
            //mu.RoleIds = roleIds;
            //mu.OrgId = orgId;


            //HttpContext.Current.Session.Set("CurrentUserId", ByteConvertHelper.Object2Bytes(mu.ID));
            //HttpContext.Current.Session.Set("CurrentAreaCode", ByteConvertHelper.Object2Bytes(mu.U_AreaCode));

            ManageProvider.UserId  = mu.ID.ToString();
            ManageProvider.Current = mu;


            //读取用户权限
            //List<MenuPower> list11 = menuCache.GetAllMenuByRoleIds(roleIds, areaCode);
            //if (list11 == null || list11.Count == 0)
            //{
            //    return GlobalStatus.GetStatus("HX05");
            //}
            //ManageProvider.CurrentMenuList = new LoginUserMenuPower() { UserId = mu.ID.ToString(), menuList = list11 };

            //使用Form验证方式
            List <Claim> claims = new List <Claim>();

            claims.Add(new Claim(ClaimTypes.Name, model.Cn, ClaimValueTypes.String, model.ID.ToString()));
            var userIdentity = new ClaimsIdentity("管理员"); //角色

            userIdentity.AddClaims(claims);
            var userPrincipal = new ClaimsPrincipal(userIdentity);


            HttpContext.SignInAsync(CookieAuthenInfo.WebCookieInstance, userPrincipal,
                                    new Microsoft.AspNetCore.Authentication.AuthenticationProperties
            {
                ExpiresUtc   = DateTime.UtcNow.AddHours(12),
                IsPersistent = true,
                AllowRefresh = false
            });

            //SignalR中缓存登录状态
            //GlobalStatus.connection.Start().ContinueWith(task =>
            //{
            //    if (!task.IsFaulted)
            //    {
            //        GlobalStatus.myHub.Invoke("Register", mu.ID, mu.U_AreaCode);//必須與 MyHub 的 Register 方法名稱一樣
            //    }
            //    else
            //    {
            //        throw new Exception("连线失败!");
            //    }
            //}).Wait();


            //记录日志
            //string message = string.Format("{0}({1})登陆系统!", mu.Cn, mu.UID);
            //List<ParameterJson> areaList = new List<ParameterJson>();
            //areaList.Add(new ParameterJson("U_IsValid", ConditionOperate.Equal.ToString(), "1"));
            //areaList.Add(new ParameterJson("Code", ConditionOperate.Equal.ToString(), areaCode));
            //string areaCondition = JsonConvert.SerializeObject(areaList);
            //strJson = _areaBll.GetListJson(areaCondition);
            //Power_AreaView areaModel = !string.IsNullOrEmpty(strJson) ? JsonConvert.DeserializeObject<List<Power_AreaView>>(strJson).FirstOrDefault() : null;
            //if (areaModel != null)
            //{
            //    CookieOptions options = new CookieOptions();
            //    options.Expires = DateTime.Now.AddYears(6);
            //    HttpContext.Response.Cookies.Append("loginAreaCode", areaCode, options);
            //    HttpContext.Response.Cookies.Append("loginAreaName", areaModel.Title, options);
            //}
            //logcache.AddSystemLog(Guid.Empty, message, true, "", "");
            return(GlobalStatus.GetStatus("HX00"));
        }
 protected IActionResult NoOK(GlobalStatus statusCode)
 {
     return(NoOK(statusCode.ToString()));
 }
Beispiel #9
0
 protected virtual void OnGlobalStatus(long speed)
 {
     GlobalStatus?.Invoke(speed);
 }
 public void disableControlSurfaces(KSPActionParam param)
 {
     ModuleEngineGimbal.DisableGlobal(false);
     globalStatus = GlobalStatus.disabled;
 }
 public void toggleControlSurfaces(KSPActionParam param)
 {
     globalStatus = GlobalStatus.none;
 }
 public void EventResetAll()
 {
     globalStatus = GlobalStatus.none;
 }