public List<AppWebView> SearchApp(string searchKey, string type, out int totalCount, int startNum = 0, int num = 20) { var appList = new List<AppWebView>(); totalCount = 20; var searchResult = AppStoresWapUIServices.SearchAndroidAppListByName("", startNum, num, out totalCount, searchKey); foreach (var item in searchResult.TagAppList) { var tempAppWebViewItem = new AppWebView() { ApkName = item.ApkName, // AppNo = item.AppId, DownLoadUrl = item.DownLoadUrl, FileSize = item.FizeSize, LogoUrl = item.LogoUrl, Name = item.Name, Price = item.Price, Rate = item.Rate, ReviewCount = item.ReviewCount, VersionName = item.VerNo, Id = item.AppId }; var app = RedisService.Get<App>(item.AppId); tempAppWebViewItem.Summary = app.Summary; tempAppWebViewItem.DownloadTimes = app.DownloadTimes; appList.Add(tempAppWebViewItem); } return appList; }
protected List<AppWebView> ConvertAppsToAppListView(List<App> apps) { var appList = new List<AppWebView>(); foreach (var app in apps) { var appProject = RedisService.Get<AppProject>(app.AppProjectId); var appCurrentVer = AppStoreUIService.GetCurrentVersionForApp(app.Id); var appListItem = new AppWebView(); appListItem.Id = app.Id; appListItem.FileSize = appCurrentVer.FileSize.GetSize(); appListItem.LogoFileName = AppStoreService.GetSingleAppImageUrl(app.Logo.Id); appListItem.LogoUrl = this.GetAppLogoUrl(app); appListItem.DownLoadUrl = GetAppDownloadUrlInternal(app); appListItem.Name = appProject.Name; appListItem.Price = (float)app.Price; appListItem.Rate = appProject.Rate; appListItem.ReviewCount = app.ReviewCount; appListItem.Version = app.CurrentVer; appListItem.ApkName = appProject.PackageName; appListItem.DownloadTimes = app.DownloadTimes; appListItem.Summary = app.Summary; var appVersion = default(AppVersion); appVersion = AppStoreUIService.GetCurrentVersionForApp(app.Id); if (appVersion != null) { appListItem.Version = appVersion.Id; appListItem.VersionName = appVersion.VersionName; } else { appListItem.Version = "1.0"; appListItem.VersionName = "1.0"; } appList.Add(appListItem); } return appList; }
public AppWebView AppDetailInternal(App app, AppProject appProject) { var appWebView = default(AppWebView); if (appProject != null && app != null && !app.Id.IsNullOrEmpty() && !appProject.Id.IsNullOrEmpty()) { appWebView = AppDetailInternalWithOutRecommend(appWebView, app, appProject); var recommends = RedisService.GetAllSubModelsByType<App, AppRecommend>(app.Id); List<AppWebView> Apps = new List<AppWebView>(); appWebView.RecommendApps = Apps; appWebView.TagCategory = "应用"; var tagList = AppStoreUIService.GetTagsByTagCategory(ConfigKeys.TAGGROUPID_GAME.ConfigValue()); foreach (var tag in tagList) { var appids = AppStoreUIService.GetAppIdsByTag(tag.Id); if (appids.Contains("App:" + app.Id)) { appWebView.TagCategory = "游戏"; break; } } var num = 1;// 单行最多取7个 foreach (var item in recommends) { var recommendApp = RedisService.Get<App>(item.Id); if (recommendApp!=null) { var appproject = RedisService.Get<AppProject>(recommendApp.AppProjectId); AppWebView webview = new AppWebView (); webview = AppDetailInternalWithOutRecommend(webview, recommendApp, appproject); appWebView.RecommendApps.Add(webview); } if (num>6) { break; } num += 1; } } return appWebView; }
public AppWebView AppDetailInternalWithOutRecommend(AppWebView appWebView, App app, AppProject appProject) { appWebView = EntityMapping.Auto<App, AppWebView>(app); appWebView.ApkName = appProject.PackageName; appWebView.AppNo = app.AppNo; appWebView.Company = appProject.Creator; appWebView.Rate = appProject.Rate; appWebView.ReviewCount = appProject.ReviewCount; appWebView.DownloadTimes = app.DownloadTimes; //image var imgInfos = app.ScreenShot; appWebView.ImageCount = imgInfos.Count; appWebView.ImageList = new List<string>(); imgInfos.ForEach(i => appWebView.ImageList.Add(i.Id + i.Extension)); appWebView.LogoFileName = AppStoreService.GetSingleAppImageUrl(app.Logo.Id); appWebView.ScreenShots = new List<string>(); foreach (var i in appWebView.ImageList) { appWebView.ScreenShots.Add(AppStoreService.GetSingleAppImageUrl(i)); } var appVersion = default(AppVersion); appVersion = AppStoreUIService.GetCurrentVersionForApp(app.Id); if (appVersion != null && appWebView != null) { var pkgInfo = AppStoreUIService.GetApkInfoForApp(app.Id, appVersion.Id, false); if (pkgInfo != null) { appWebView.MinSDKVersion = SingletonBase<AndroidVersionRepository>.Instance.GetVersionByAPILevel(pkgInfo.MinSDKVersion); } appWebView.Version = appVersion.Id; appWebView.VersionName = appVersion.VersionName; appWebView.PublishTime = appVersion.PublishDateTime.ToString("yyyy-MM-dd"); appWebView.FileSize = appVersion.FileSize.GetSize(); appWebView.DownLoadUrl = (FILE_PREFIX + appVersion.FileUrl).ToFileServerUrlAPP(); } return appWebView; }