Exemplo n.º 1
0
        public Dictionary <string, object> GetUserInfo(string userCode)
        {
            IUser user = xUtils.GetUserByCode(userCode);

            if (user == null)
            {
                return(null);
            }
            var dic = new Dictionary <string, object>();

            dic.Add("UserCode", user.UserCode);            //账号
            dic.Add("UserName", user.UserName);            //姓名
            dic.Add("Register_Time", user.Register_Time);  //注册时间
            dic.Add("Avatar", user.Avatar);                //头像
            dic.Add("User_Level", user.Grade.Level);       //会员等级
            dic.Add("Auth_Status", (int)user.Auth_Status); //认证状态
            dic.Add("UserStatus", (int)user.Status);       //账户状态
            dic.Add("HasPayPwd", user.HasPayPassword());   //是否已设置支付密码
            FillIdentityInfo(user.UserId, dic);            //填充认证信息
            FillShareInfo(user.UserId, dic);               //填充分享链接
            FillInviterInfo(user.Refer_ID, dic);           //填充推荐人信息
            var         list  = ProviderContainer.GetProviders <IUserProfile>();
            List <Task> tasks = new List <Task>();

            foreach (var item in list)
            {
                //多线程获取用户资料
                tasks.Add(
                    Task.Factory.StartNew(() =>
                {
                    if (!dic.ContainsKey(item.PropertyName))
                    {
                        object value = item.GetProfile(user);
                        dic.Add(item.PropertyName, value);
                    }
                }));
            }
            //同步线程
            Task.WaitAll(tasks.ToArray());
            return(dic);
        }
Exemplo n.º 2
0
 public MainViewModel(string configuration)
 {
     m_providers = ProviderContainer.GetProviders(configuration);
 }