This commit is contained in:
mkm 2023-12-04 15:04:01 +08:00
parent bf435ed9ca
commit 02b78c6542
2 changed files with 89 additions and 81 deletions

View File

@ -988,6 +988,7 @@ class ProductRepository extends BaseRepository
'storeCategory',
'brand',
'merchant',
'attrValue'
]);
$count = $query->count();
$data = $query->page($page, $limit)->setOption('field', [])->field($this->admin_filed)->select();

View File

@ -66,9 +66,13 @@ class SpreadsheetExcelService
]
];
private function __construct(){}
private function __construct()
{
}
private function __clone(){}
private function __clone()
{
}
public static function instance()
{
@ -371,6 +375,7 @@ class SpreadsheetExcelService
*/
public function checkImport($filePath, $check = [], $is_limit = false, $count = 1000)
{
try {
$ext = ucfirst(pathinfo($filePath, PATHINFO_EXTENSION));
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($ext);
$spreadsheet = $reader->load($filePath);
@ -388,7 +393,9 @@ class SpreadsheetExcelService
if ($_c !== $c) throw new ValidateException('表格"' . $s . '"不是"' . $c . '"不可导入');
}
}
} catch (\Exception $e) {
throw new ValidateException('表格中有无法解析的编码,请重新设置表格');
}
return true;
}
}