public static string GetWelcomeInfo() { // 统一通过 OpenService 获取用户名 String userName = new OpenService().UserName( HttpContext.Current ); if (userName == null) { return "用户不存在"; } else { return string.Format( "欢迎你,{0}!", userName ); } }
private void importUserSingle( ImportUser u, List<string> picList ) { OpenService os = new OpenService(); // String pwd = getRandomPwd(); String email = pwd + "@xxx.com"; String apps = " home,blog,photo,microblog,friend,visitor,forumpost,about"; // 注册 Result result; if (strUtil.HasText( u.FriendlyUrl )) { result = os.UserRegister( u.Name, pwd, email, u.FriendlyUrl, apps ); } else { String uFriendlyUrl = getFriendlyUrl(); result = os.UserRegister( u.Name, pwd, email, uFriendlyUrl, apps ); } if (result.HasErrors) return; User user = result.Info as User; if (picList.Count > 0) { String randomPic = picList[0]; // 上传头像 Result saved = AvatarUploader.Save( randomPic, user.Id ); // 更新头像信息 user.Pic = saved.Info.ToString(); user.update(); picList.RemoveAt( 0 ); } }