public void FaceSave() { User user = ctx.owner.obj as User; Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id); if (result.HasErrors) { errors.Join(result); run(Face); return; } if (user.Pic != UserFactory.Guest.Pic) { AvatarUploader.Delete(user.Pic); } userService.UpdateAvatar(user, result.Info.ToString()); if (ctx.utils.isFrame()) { echoToParent(lang("uploadThanks")); } else { echoRedirectPart(lang("uploadThanks"), to(Face), 0); } }
public void SaveUserPic() { User user = ctx.owner.obj as User; Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id); if (result.HasErrors) { echoError(result); return; } if (user.Pic != UserFactory.Guest.Pic) { AvatarUploader.Delete(user.Pic); } userService.UpdateAvatar(user, result.Info.ToString()); // 页面跳转 String redirectUrl = ctx.Post("redirectUrl"); String msg = "感谢上传!"; if (strUtil.HasText(redirectUrl)) { echoRedirect(msg, redirectUrl); } else { echoRedirect(msg, sys.Url.SiteUrl); } }
private void saveWaitingApprove() { User user = ctx.owner.obj as User; Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id); if (result.HasErrors) { echoError(result); return; } if (user.Pic != UserFactory.Guest.Pic) { AvatarUploader.Delete(user.Pic); } // 更新最后一个日志 errorPicService.UpdateLastUpload(user, ctx.Ip); // 2) 仅仅保存图像、不会增加积分、不会发送邮件鼓励、不给管理员发通知 userService.UpdateAvatarOnly(user, result.Info.ToString()); String msg = "感谢上传!"; echoRedirect(msg); }
private void deleteUserPic(User user) { if (user.Pic != UserFactory.Guest.Pic) { AvatarUploader.Delete(user.Pic); } user.Pic = ""; user.update(); }
private void saveFirstUpload() { User user = ctx.owner.obj as User; Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id); if (result.HasErrors) { echoError(result); return; } if (user.Pic != UserFactory.Guest.Pic) { AvatarUploader.Delete(user.Pic); } userService.UpdateAvatar(user, result.Info.ToString()); String msg = "感谢上传!"; echoRedirect(msg, sys.Url.SiteUrl); }
private void saveWaitingUpload() { User user = ctx.owner.obj as User; Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id); if (result.HasErrors) { echoError(result); return; } if (user.Pic != UserFactory.Guest.Pic) { AvatarUploader.Delete(user.Pic); } // 增加日志 UserErrorPic lastLog = errorPicService.GetLastLog(user); if (lastLog.IsNextAutoPass == 1) { errorPicService.AddLogAndPass(user, ctx.Ip); } else { errorPicService.AddLog(user, ctx.Ip); } // 2) 保存图像、不会增加积分、不会发送邮件鼓励;给管理员发通知 userService.UpdateAvatarWhenError(user, result.Info.ToString()); String msg = "感谢上传!"; echoRedirect(msg); }