public async Task <bool> NewUserAsync(AppUser appUser, DateTimeOffset?dateTime = null) { // 验证用户是否存在 if (!await appUserService.ExistsAsync(appUser)) { //获取序号Id long sequentialId = await numbersFactory.CreateUserSequentailId(appUser.AppId); if (sequentialId > 0 && await appUserService.AddUserAsync(appUser, sequentialId)) { // 获取记录时间 DateTimeOffset now = dateTime ?? DateTimeOffset.Now.ToChinaStandardTime(); // 按小时 await UpdateCounter(appUser.GetNewUserCountKey(), OneHour, now); // 按天 await UpdateCounter(appUser.GetNewUserCountKey(), OneDay, now); // 按天 + 渠道 await UpdateCounter(appUser.GetNewUserCountKeyByChannel(), OneDay, now); return(true); } } return(false); }
public async Task AddAsync(AppUser user) { await _service.AddUserAsync(user); }
public async Task <ActionResult> AddAsync(AppUser user) { await _service.AddUserAsync(user); return(Created("", null)); }