Exemplo n.º 1
0
        public async Task LoginUserCard()
        {
            var data = await account.GetHomeUserCard();

            if (data != null)
            {
                Profile = data;
                return;
            }
            //检查Token
        }
Exemplo n.º 2
0
        public async Task <HomeUserCardModel> GetHomeUserCard()
        {
            try
            {
                var mine_api    = accountApi.MineProfile();
                var mine_result = await mine_api.Request();

                if (!mine_result.status)
                {
                    return(null);
                }
                var mine_obj = mine_result.GetJObject();
                if (mine_obj["code"].ToInt32() != 0)
                {
                    return(null);
                }
                var space_api    = accountApi.Space(SettingHelper.Account.UserID.ToString());
                var space_result = await space_api.Request();

                if (!space_result.status)
                {
                    return(null);
                }
                var space_obj = space_result.GetJObject();
                if (space_obj["code"].ToInt32() != 0)
                {
                    return(null);
                }
                var data = new HomeUserCardModel();
                data.current_exp = space_obj["data"]["card"]["level_info"]["current_exp"].ToInt32();
                data.next_exp    = space_obj["data"]["card"]["level_info"]["next_exp"].ToInt32();
                data.dynamic     = mine_obj["data"]["dynamic"].ToInt32();
                data.face        = mine_obj["data"]["face"].ToString();
                data.fans        = mine_obj["data"]["follower"].ToInt32();
                data.follow      = mine_obj["data"]["following"].ToInt32();
                data.level       = mine_obj["data"]["level"].ToInt32();
                data.mid         = mine_obj["data"]["mid"].ToString();
                data.name        = mine_obj["data"]["name"].ToString();
                data.pendant     = space_obj["data"]["card"]["pendant"]["image"].ToString();
                if (data.pendant == "")
                {
                    data.pendant = AppHelper.TRANSPARENT_IMAGE;
                }
                data.vip_type = mine_obj["data"]["vip_type"].ToInt32();
                return(data);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }