This commit is contained in:
长沙炎豹 2026-05-08 19:48:10 +08:00
parent e741591d79
commit 2095581969
2 changed files with 7 additions and 5 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -194,19 +194,21 @@ extension APInAppPurchseVC {
func handelExcel(_ excelFilePath: URL) { func handelExcel(_ excelFilePath: URL) {
let iaps = IAPExcelParser.parser(excelFilePath) let iaps = IAPExcelParser.parser(excelFilePath)
var newIAPs = iaps
// //
if iapList.isNotEmpty { if iapList.isNotEmpty {
let pids = iaps.map { $0.productId } let pids = iaps.map { $0.productId }
let iaps = iapList.map { $0.vendorId } let vendorIds = Set(iapList.map { $0.vendorId })
let warns = pids.filter { iaps.contains($0) } let warns = pids.filter { vendorIds.contains($0) }
if warns.isNotEmpty { if warns.isNotEmpty {
NSAlert.show("警告已经存在相同商品id的品项请检查\(warns)\n⚠️提示:如果继续上传,将会覆盖已有品项的信息!") NSAlert.show("警告已经存在相同商品id的品项请检查\(warns)\n⚠️提示:如果继续上传,将会覆盖已有品项的信息!")
} }
newIAPs = iaps.filter { !vendorIds.contains($0.productId) }
} }
// //
let iapNames = iaps.map { $0.name } let iapNames = newIAPs.map { $0.name }
let iapUniNames = Array(Set(iapNames)) let iapUniNames = Array(Set(iapNames))
if iapNames.isNotEmpty, iapNames.count != iapUniNames.count { if iapNames.isNotEmpty, iapNames.count != iapUniNames.count {
NSAlert.show("‼️警告:存在相同参考名字的商品!请检查~\n⚠️提示:如果继续上传,同名的商品只会有一个能创建成功!") NSAlert.show("‼️警告:存在相同参考名字的商品!请检查~\n⚠️提示:如果继续上传,同名的商品只会有一个能创建成功!")
@ -216,7 +218,7 @@ extension APInAppPurchseVC {
let wc = sb.instantiateController(withIdentifier: "InputExcelList") as? NSWindowController let wc = sb.instantiateController(withIdentifier: "InputExcelList") as? NSWindowController
let vc = wc?.contentViewController as? APUploadIAPListVC let vc = wc?.contentViewController as? APUploadIAPListVC
vc?.currentApp = currentApp vc?.currentApp = currentApp
vc?.iaps = iaps vc?.iaps = newIAPs
wc?.showWindow(self) wc?.showWindow(self)
} }