Ejemplo n.º 1
0
        public UserProfile GetUserProfile(Guid accountGid)
        {
            var profileSDK = new UserProfileAgent();
            var data       = profileSDK.GetUserProfile(accountGid);

            return(data);
        }
Ejemplo n.º 2
0
        public InfoOM Info(UserAccount user, bool isZH)
        {
            var agent = new UserProfileAgent();

            var profile = agent.GetUserProfile(user.Id);
            var country = new CountryComponent().GetById(user.CountryId);

            if (profile == null)
            {
                var userProfile = new UserProfile
                {
                    Country        = user.CountryId,
                    LastName       = "F" + RandomAlphaNumericGenerator.GenerateCode(8),
                    UserAccountId  = user.Id,
                    Cellphone      = user.Cellphone,
                    L1VerifyStatus = VerifyStatus.Uncertified,
                    L2VerifyStatus = VerifyStatus.Uncertified
                };
                var hasCreate = agent.AddProfile(userProfile);
                if (hasCreate)
                {
                    profile = userProfile;
                    _log.Info("Create profile info success. user id = " + user.Id);
                }
                else
                {
                    _log.Error("Create profile info error. user id = " + user.Id);
                }

                _log.Error("get profile info error, user id = " + user.Id);
            }

            return(new InfoOM
            {
                Avatar = user.Photo,
                Birthday = profile.DateOfBirth?.ToUnixTime().ToString(),
                Cellphone = new UserAccountComponent().GetMaskedCellphone(country.PhoneCode, user.Cellphone),
                CountryName = isZH ? country.Name_CN : country.Name,
                Email = new UserAccountComponent().GetMaskedEmail(user.Email),
                FullName = (string.IsNullOrEmpty(profile.FirstName) ? "" : "* ") + profile.LastName,
                Gender = profile.Gender,
                VerifiedStatus = GetVerifiedStatus(user)
            });
        }