lishi
This commit is contained in:
parent
e741591d79
commit
2095581969
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user