예제 #1
0
        public static bool DeleteRouter(int countryId)
        {
            var dac    = new ProfileRouterDAC();
            var result = dac.DeleteById(countryId);

            if (result)
            {
                Init();
            }
            return(false);
        }
예제 #2
0
        private static void Init()
        {
            _dict = new Dictionary <int, ProfileRouter>();
            var dac  = new ProfileRouterDAC();
            var list = dac.GetAll();

            foreach (var item in list)
            {
                _dict.Add(item.Country, item);
            }
        }
예제 #3
0
        public static bool UpdateRouter(ProfileRouter router)
        {
            var dac    = new ProfileRouterDAC();
            var result = dac.UpdateRouter(router);

            if (result)
            {
                Init();
            }
            return(false);
        }
예제 #4
0
        public List <UserProfile> GetUserProfileListForL2(string cellphone, int country, string orderByFiled, bool isDesc, int?L2VerifyStatus, int pageSize, int index, out int totalCount)
        {
            var routerDAC = new ProfileRouterDAC();
            var server    = routerDAC.GetRouter(country);

            if (server == null)
            {
                throw new InvalidProfileServiceException();
            }

            var dac = new UserProfileRPC(server);

            return(dac.GetUserProfileListForL2(cellphone, country, orderByFiled, isDesc, L2VerifyStatus, pageSize, index, out totalCount));
        }
예제 #5
0
        public static ProfileRouter GetByCountryId(int countryId)
        {
            if (_dict.Keys.Contains(countryId))
            {
                return(_dict[countryId]);
            }

            var dac  = new ProfileRouterDAC();
            var data = dac.GetRouter(countryId);

            if (data != null)
            {
                _dict.Add(countryId, data);
            }

            return(data);
        }
예제 #6
0
        private async Task <LoginDto> IssueAccessToken(UserAccount user)
        {
            //var keyLoginTokenPrefix = "FiiiShop:Token:";
            //var keyLoginToken = $"{keyLoginTokenPrefix}{user.Id}";
            //var accessToken = AccessTokenGenerator.IssueToken(user.Id.ToString());
            //RedisHelper.StringSet(Constant.REDIS_TOKEN_DBINDEX, keyLoginToken, accessToken, TimeSpan.FromSeconds(AccessTokenGenerator.DefaultExpiryTime));

            ProfileRouter pRouter = new ProfileRouterDAC().GetRouter(user.CountryId);
            var           profile = GetProfileByAccountId(pRouter, user.Id);

            string countryCode = "";

            if (profile.Country.HasValue)
            {
                var country = new CountryDAC().GetById(user.CountryId);
                if (country != null)
                {
                    countryCode = country.Code;
                }
            }

            var result = new LoginDto
            {
                UserId       = user.Id.ToString("N"),
                Email        = user.Email,
                LastName     = profile.LastName,
                FirstName    = profile.FirstName,
                CountryCode  = countryCode,
                ProvinceName = profile.State,
                CityName     = profile.City,
                Address      = profile.Address1 + (string.IsNullOrEmpty(profile.Address1 + profile.Address2) ? "" : " ") + profile.Address2,
                Postcode     = profile.Postcode,
                Cellphone    = profile.Cellphone
            };

            return(await Task.FromResult(result));
        }
예제 #7
0
        public UserProfileSet GetUserProfileSet(Guid id)
        {
            var            profileSet     = new UserProfileSet();
            UserAccountDAC userAccountDAC = new UserAccountDAC();
            UserAccount    userAccount    = userAccountDAC.GetById(id);

            if (userAccount == null)
            {
                return(null);//查无
            }
            //赋值
            profileSet.Id                = userAccount.Id;
            profileSet.Cellphone         = userAccount.Cellphone;
            profileSet.Email             = userAccount.Email;
            profileSet.IsVerifiedEmail   = userAccount.IsVerifiedEmail;
            profileSet.RegistrationDate  = userAccount.RegistrationDate;
            profileSet.CountryId         = userAccount.CountryId;
            profileSet.Photo             = userAccount.Photo;
            profileSet.Password          = userAccount.Password;
            profileSet.Pin               = userAccount.Pin;
            profileSet.SecretKey         = userAccount.SecretKey;
            profileSet.Status            = userAccount.Status;
            profileSet.IsAllowWithdrawal = userAccount.IsAllowWithdrawal;
            profileSet.IsAllowExpense    = userAccount.IsAllowExpense;
            profileSet.FiatCurrency      = userAccount.FiatCurrency;
            profileSet.InvitationCode    = userAccount.InvitationCode;
            profileSet.InviterCode       = userAccount.InviterCode;
            profileSet.ValidationFlag    = userAccount.ValidationFlag;
            profileSet.AuthSecretKey     = userAccount.AuthSecretKey;


            var         routerDAC   = new ProfileRouterDAC();
            var         server      = routerDAC.GetRouter(userAccount.CountryId);
            UserProfile userProfile = null;

            if (server == null)
            {
                throw new InvalidProfileServiceException();
            }

            var userProfileDAC = new UserProfileRPC(server);

            userProfile = userProfileDAC.GetById(userAccount.Id);
            if (userProfile != null)
            {
                profileSet.UserAccountId = userProfile.UserAccountId;
                profileSet.LastName      = userProfile.LastName;
                profileSet.FirstName     = userProfile.FirstName;
                //profileSet.Fullname = userProfile.Fullname;
                profileSet.IdentityDocNo   = userProfile.IdentityDocNo;
                profileSet.IdentityDocType = userProfile.IdentityDocType;
                //profileSet.IdentityDocFile = userProfile.IdentityDocFile;
                //profileSet.IsIdentityDocVerified = userProfile.IsIdentityDocVerified;
                profileSet.IdentityExpiryDate = userProfile.IdentityExpiryDate;
                profileSet.DateOfBirth        = userProfile.DateOfBirth;
                profileSet.Address1           = userProfile.Address1;
                profileSet.Address2           = userProfile.Address2;
                profileSet.City               = userProfile.City;
                profileSet.State              = userProfile.State;
                profileSet.Postcode           = userProfile.Postcode;
                profileSet.Country            = userProfile.Country;
                profileSet.Gender             = userProfile.Gender;
                profileSet.FrontIdentityImage = userProfile.FrontIdentityImage;
                profileSet.ResidentImage      = userProfile.ResidentImage;
                profileSet.BackIdentityImage  = userProfile.BackIdentityImage;
                profileSet.HandHoldWithCard   = userProfile.HandHoldWithCard;
                profileSet.L1VerifyStatus     = userProfile.L1VerifyStatus;
                profileSet.L2VerifyStatus     = userProfile.L2VerifyStatus;
                profileSet.L1SubmissionDate   = userProfile.L1SubmissionDate;
                profileSet.L2SubmissionDate   = userProfile.L2SubmissionDate;
                profileSet.L1Remark           = userProfile.L1Remark;
                profileSet.L2Remark           = userProfile.L2Remark;
            }
            return(profileSet);
        }
예제 #8
0
        /// <summary>
        ///  查询用户状态列表
        /// </summary>
        /// <param name="cellphone"></param>
        /// <param name="country"></param>
        /// <param name="status"></param>
        /// <param name="pageSize"></param>
        /// <param name="index"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public List <UserAccountStatus> GetUserAccountStatusList(string cellphone, int country, int?status, int pageSize, int index, out int totalCount)
        {
            var routerDAC = new ProfileRouterDAC();
            var list      = new List <UserAccountStatus>();

            var accountDAC  = new UserAccountDAC();
            var accountList = accountDAC.GetUserAccountStatusList(cellphone, country, status, pageSize, index, out totalCount);
            var guids       = new List <Guid>();

            if (accountList != null)
            {
                foreach (var ac in accountList)
                {
                    guids.Add(ac.Id);
                }
            }
            else
            {
                return(null);
            }

            //UserLoginLogDAC logDAC = new UserLoginLogDAC();
            //List<UserLoginLog> logs = logDAC.GetLastLoginTimeListByIds(guids);

            var server = routerDAC.GetRouter(country);

            if (server == null)
            {
                throw new InvalidProfileServiceException();
            }

            var dac         = new UserProfileRPC(server);
            var profileList = dac.GetListByIds(guids);

            foreach (var account in accountList)
            {
                //UserLoginLog log = null;
                var accountStatus = new UserAccountStatus
                {
                    UserAccountId     = account.Id,
                    IsAllowExpense    = account.IsAllowExpense,
                    IsAllowWithdrawal = account.IsAllowWithdrawal,
                    Cellphone         = account.Cellphone,
                    Country           = account.CountryId,
                    RegistrationDate  = account.RegistrationDate,
                    Status            = account.Status
                };
                UserProfile profile = null;
                if (profileList != null)
                {
                    foreach (var item in profileList)
                    {
                        if (item.UserAccountId == account.Id)
                        {
                            profile = item;
                            break;
                        }
                    }
                }
                if (profile != null)
                {
                    accountStatus.L1VerifyStatus = profile.L1VerifyStatus;
                    accountStatus.L2VerifyStatus = profile.L2VerifyStatus;
                    //accountStatus.Remark = profile.Remark;
                }

                //if (logs != null)
                //{
                //    foreach (var item in logs)
                //    {
                //        if (item.UserAccountId == account.Id)
                //        {
                //            log = item;
                //            break;
                //        }
                //    }
                //}
                //if (log != null)
                //{
                //    accountStatus.LastLoginTimeStamp = log.Timestamp;
                //}

                list.Add(accountStatus);
            }
            return(list);
        }