Skip to content

Commit

Permalink
add commit
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaofan committed Jan 1, 2021
1 parent 99ed4e6 commit 6857819
Show file tree
Hide file tree
Showing 29 changed files with 218 additions and 218 deletions.
88 changes: 44 additions & 44 deletions NewCrmCore.Application.Services/AppServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task<List<AppTypeDto>> GetAppTypesAsync()

public async Task<TodayRecommendAppDto> GetTodayRecommendAsync(Int32 userId)
{
Parameter.IfNullOrZero(userId);
Check.IfNullOrZero(userId);

var result = await _appContext.GetTodayRecommendAsync(userId);
result.AppIcon = result.IsIconByUpload ? $@"{ Appsetting.FileUrl}{ result.AppIcon}" : result.AppIcon;
Expand All @@ -52,16 +52,16 @@ public async Task<TodayRecommendAppDto> GetTodayRecommendAsync(Int32 userId)

public async Task<(Int32 allCount, Int32 notReleaseCount)> GetDevelopAndNotReleaseCountAsync(Int32 userId)
{
Parameter.IfNullOrZero(userId);
Check.IfNullOrZero(userId);
return await _appContext.GetDevelopAndNotReleaseCountAsync(userId);
}

public async Task<PageList<AppDto>> GetAppsAsync(Int32 userId, Int32 appTypeId, Int32 orderId, String searchText, Int32 pageIndex, Int32 pageSize)
{
Parameter.IfNullOrZero(userId, true);
Parameter.IfNullOrZero(orderId);
Parameter.IfNullOrZero(pageIndex, true);
Parameter.IfNullOrZero(pageSize);
Check.IfNullOrZero(userId, true);
Check.IfNullOrZero(orderId);
Check.IfNullOrZero(pageIndex, true);
Check.IfNullOrZero(pageSize);

return await Task.Run(() =>
{
Expand Down Expand Up @@ -89,11 +89,11 @@ public async Task<PageList<AppDto>> GetAppsAsync(Int32 userId, Int32 appTypeId,

public async Task<PageList<AppDto>> GetUserAppsAsync(Int32 userId, String searchText, Int32 appTypeId, Int32 appStyleId, String appState, Int32 pageIndex, Int32 pageSize)
{
Parameter.IfNullOrZero(userId, true);
Parameter.IfNullOrZero(appTypeId, true);
Parameter.IfNullOrZero(appStyleId, true);
Parameter.IfNullOrZero(pageIndex);
Parameter.IfNullOrZero(pageSize);
Check.IfNullOrZero(userId, true);
Check.IfNullOrZero(appTypeId, true);
Check.IfNullOrZero(appStyleId, true);
Check.IfNullOrZero(pageIndex);
Check.IfNullOrZero(pageSize);

return await Task.Run(async () =>
{
Expand Down Expand Up @@ -121,7 +121,7 @@ public async Task<PageList<AppDto>> GetUserAppsAsync(Int32 userId, String search

public async Task<AppDto> GetAppAsync(Int32 appId, Int32 userId)
{
Parameter.IfNullOrZero(appId);
Check.IfNullOrZero(appId);

var result = await _appContext.GetAppAsync(appId);
var appTypes = await CacheHelper.GetOrSetCacheAsync(new AppTypeCacheKey(), () => GetAppTypesAsync());
Expand Down Expand Up @@ -154,8 +154,8 @@ public async Task<AppDto> GetAppAsync(Int32 appId, Int32 userId)

public async Task<Boolean> IsInstallAppAsync(Int32 userId, Int32 appId)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(appId);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(appId);

var result = await _appContext.IsInstallAppAsync(userId, appId);
return result;
Expand Down Expand Up @@ -205,14 +205,14 @@ public async Task<List<AppDto>> GetSystemAppAsync(IEnumerable<Int32> appIds = de

public async Task<Boolean> CheckAppTypeNameAsync(String appTypeName)
{
Parameter.IfNullOrZero(appTypeName);
Check.IfNullOrZero(appTypeName);
return await _appContext.CheckAppTypeNameAsync(appTypeName);
}

public async Task ModifyAppDirectionAsync(Int32 userId, String direction)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(direction);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(direction);

if (direction.ToLower() == "x")
{
Expand All @@ -231,33 +231,33 @@ public async Task ModifyAppDirectionAsync(Int32 userId, String direction)

public async Task ModifyAppIconSizeAsync(Int32 userId, Int32 newSize)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(newSize);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(newSize);
await _deskContext.ModifyMemberDisplayIconSizeAsync(userId, newSize);
await CacheHelper.RemoveKeyWhenModify(new ConfigCacheKey(userId));
}

public async Task ModifyAppVerticalSpacingAsync(Int32 userId, Int32 newSize)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(newSize);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(newSize);
await _deskContext.ModifyMemberHorizontalSpacingAsync(userId, newSize);
await CacheHelper.RemoveKeyWhenModify(new ConfigCacheKey(userId));
}

public async Task ModifyAppHorizontalSpacingAsync(Int32 userId, Int32 newSize)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(newSize);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(newSize);
await _deskContext.ModifyMemberVerticalSpacingAsync(userId, newSize);
await CacheHelper.RemoveKeyWhenModify(new ConfigCacheKey(userId));
}

public async Task ModifyAppStarAsync(Int32 userId, Int32 appId, Int32 starCount)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(appId);
Parameter.IfNullOrZero(starCount, true);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(appId);
Check.IfNullOrZero(starCount, true);

var isInstall = await _appContext.IsInstallAppAsync(userId, appId);
if (!isInstall)
Expand All @@ -269,24 +269,24 @@ public async Task ModifyAppStarAsync(Int32 userId, Int32 appId, Int32 starCount)

public async Task InstallAppAsync(Int32 userId, Int32 appId, Int32 deskNum)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(appId);
Parameter.IfNullOrZero(deskNum);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(appId);
Check.IfNullOrZero(deskNum);
var app = await _appContext.InstallAsync(userId, appId, deskNum);
await CacheHelper.RemoveKeyWhenModify(new DesktopCacheKey(userId));
await _commonNotify.SendNotify(userId, new Notify("应用安装提醒", $@"您选择的 {app.Name} 已安装成功", 0, userId));
}

public async Task ModifyUserAppInfoAsync(Int32 userId, AppDto appDto)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(appDto);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(appDto);
await _appContext.ModifyUserAppInfoAsync(userId, appDto.ConvertToModel<AppDto, App>());
}

public async Task CreateNewAppAsync(AppDto appDto)
{
Parameter.IfNullOrZero(appDto);
Check.IfNullOrZero(appDto);
var app = appDto.ConvertToModel<AppDto, App>();
var internalApp = new App(app.Name, app.IconUrl, app.AppUrl, app.Width, app.Height, app.AppTypeId, app.AppAuditState, AppReleaseState.UnRelease, app.AppStyle, app.UserId, app.Remark, appDto.IsIconByUpload);

Expand All @@ -295,63 +295,63 @@ public async Task CreateNewAppAsync(AppDto appDto)

public async Task RemoveAppTypeAsync(Int32 appTypeId)
{
Parameter.IfNullOrZero(appTypeId);
Check.IfNullOrZero(appTypeId);
await _appContext.DeleteAppTypeAsync(appTypeId);
await CacheHelper.RemoveKeyWhenModify(new AppTypeCacheKey());
}

public async Task CreateNewAppTypeAsync(AppTypeDto appTypeDto)
{
Parameter.IfNullOrZero(appTypeDto);
Check.IfNullOrZero(appTypeDto);
var appType = appTypeDto.ConvertToModel<AppTypeDto, AppType>();
await _appContext.CreateNewAppTypeAsync(appType);
}

public async Task ModifyAppTypeAsync(AppTypeDto appTypeDto, Int32 appTypeId)
{
Parameter.IfNullOrZero(appTypeDto);
Parameter.IfNullOrZero(appTypeId);
Check.IfNullOrZero(appTypeDto);
Check.IfNullOrZero(appTypeId);
await _appContext.ModifyAppTypeAsync(appTypeDto.Name, appTypeDto.IsSystem, appTypeId);
}

public async Task PassAsync(Int32 appId)
{
Parameter.IfNullOrZero(appId);
Check.IfNullOrZero(appId);
var app = await _appContext.PassAsync(appId);
await _commonNotify.SendNotify(app.UserId, new Notify("应用审核提醒", $@"您提交的应用 {app.Name} 已审核通过", 0, app.UserId));
}

public async Task DenyAsync(Int32 appId)
{
Parameter.IfNullOrZero(appId);
Check.IfNullOrZero(appId);
var app = await _appContext.DenyAsync(appId);
await _commonNotify.SendNotify(app.UserId, new Notify("应用审核提醒", $@"您提交的应用 {app.Name} 未审核通过", 0, app.UserId));
}

public async Task SetTodayRecommandAppAsync(Int32 appId)
{
Parameter.IfNullOrZero(appId);
Check.IfNullOrZero(appId);
await _appContext.SetTodayRecommandAppAsync(appId);
}

public async Task RemoveAppAsync(Int32 appId)
{
Parameter.IfNullOrZero(appId);
Check.IfNullOrZero(appId);
await _appContext.RemoveAppAsync(appId);
}

public async Task ReleaseAppAsync(Int32 appId)
{
Parameter.IfNullOrZero(appId);
Check.IfNullOrZero(appId);
var result = await _appContext.ReleaseAppAsync(appId);
await _commonNotify.SendNotify(result.UserId, new Notify("应用发布提醒", $@"您的应用 {result.Name} 已发布到应用市场中 ", 0, result.UserId));
}

public async Task ModifyAppIconAsync(Int32 userId, Int32 appId, String newIcon)
{
Parameter.IfNullOrZero(userId);
Parameter.IfNullOrZero(appId);
Parameter.IfNullOrZero(newIcon);
Check.IfNullOrZero(userId);
Check.IfNullOrZero(appId);
Check.IfNullOrZero(newIcon);
await _appContext.ModifyAppIconAsync(userId, appId, newIcon);
}

Expand Down
Loading

0 comments on commit 6857819

Please sign in to comment.