Ejemplo n.º 1
0
        public void FillIdentityInfo(int userId, Dictionary <string, object> dictionary)
        {
            string        birth = null, industry = null;
            int?          gender = null, cityId = null;
            Vnet_Identity daIdentity = new Vnet_Identity();

            if (daIdentity.SelectByUser_Id(userId))
            {
                birth  = daIdentity.Birthday.HasValue ? daIdentity.Birthday.Value.ToString() : string.Empty;
                gender = daIdentity.Gender;
                if (daIdentity.Region_Id.HasValue)
                {
                    var region = ChinaArea.GetRegion(daIdentity.Region_Id.Value);
                    cityId = region?.City_ID;
                }
            }
            Tnet_User_Profile daUserProfile = new Tnet_User_Profile();

            if (daUserProfile.SelectByPk(userId))
            {
                if (daUserProfile.City_Id.HasValue)
                {
                    cityId = daUserProfile.City_Id.Value;
                }
                industry = daUserProfile.Industry;
            }
            dictionary.Add("Birthday", birth);
            dictionary.Add("Industry", industry);
            dictionary.Add("Gender", gender);
            dictionary.Add("CityId", cityId);
        }
Ejemplo n.º 2
0
        public JsonResult GetIdentityDetails(int userId)
        {
            var fac = UserModuleFactory.GetUserModuleInstance();

            if (fac == null)
            {
                return(FailResult("用户模块加载失败"));
            }
            IUser user = fac.GetUserByID(userId);

            if (user == null)
            {
                return(FailResult("找不到会员信息"));
            }
            Vnet_Identity daIdentity = new Vnet_Identity();

            if (!daIdentity.SelectByUser_Id(user.UserId))
            {
                return(FailResult("找不到认证信息"));
            }
            var data = new
            {
                User         = user,
                IdentityInfo = daIdentity.DataRow.Table.ToDynamic(forceToCollection: false, OnFieldGenerating: nvp =>
                {
                    if ("remarks".Equals(nvp.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        nvp.Value = xUtils.GetValidateRemarks(nvp.Value.ToString());
                    }
                    return(nvp);
                })
            };

            return(SuccessResult(data));
        }
Ejemplo n.º 3
0
        public JsonResult GetUserInfo(int userId)
        {
            var fac = UserModuleFactory.GetUserModuleInstance();

            if (fac == null)
            {
                return(FailResult("系统错误"));
            }
            IUser user = fac.GetUserByID(userId);

            if (user == null)
            {
                return(FailResult("找不到用户信息"));
            }
            IUser referUser = null;

            if (user.Refer_ID.HasValue)
            {
                referUser = fac.GetUserByID(user.Refer_ID.Value);
            }
            Vnet_Identity daIdentity = new Vnet_Identity();
            bool          isAuth     = daIdentity.SelectByUser_Id(userId) && daIdentity.Validate_Status == (int)ValidateStatus.审核通过;
            var           data       = new
            {
                user_id       = user.UserId,
                user_name     = user.UserName,
                user_code     = user.UserCode,
                email         = user.Email,
                auth_status   = user.Auth_Status,
                status        = user.Status,
                avatar        = user.Avatar,
                grade_level   = user.Grade.Level,
                grade_name    = user.Grade.Name,
                register_time = user.Register_Time,
                refer_id      = user.Refer_ID,
                refer_code    = referUser == null ? null : referUser.UserCode,
                refer_name    = referUser == null ? null : referUser.UserName,
                real_name     = isAuth ? daIdentity.User_Name : null,
                identity_no   = isAuth ? daIdentity.Identity_No : null,
                auth_time     = isAuth ? daIdentity.Create_Time : null,
                gender        = isAuth ? daIdentity.Gender : null,
                birthday      = isAuth ? daIdentity.Birthday : null
            };

            return(SuccessResult(data));
        }