|
|
@@ -199,4 +199,30 @@ class UploadController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //上传excel文件 ssh 20241126
|
|
|
+ public function actionExcel()
|
|
|
+ {
|
|
|
+ $file = $_FILES['file'];
|
|
|
+ if (!is_uploaded_file($file['tmp_name'])) {
|
|
|
+ util::fail('please upload img');
|
|
|
+ }
|
|
|
+ $mainId = $this->sjId;
|
|
|
+ $shopId = $this->shopId;
|
|
|
+ $month = date("Ym");
|
|
|
+ $date = date("d");
|
|
|
+ $path = dirUtil::getImgUploadDir() . "/{$mainId}/{$shopId}/{$month}/{$date}/";
|
|
|
+ if (!file_exists($path)) {
|
|
|
+ //检查是否有该文件夹,如果没有就创建,并给予最高权限
|
|
|
+ mkdir($path, 0700, true);
|
|
|
+ }
|
|
|
+ $preFileName = stringUtil::uniqueFileName();
|
|
|
+ $newFile = $preFileName . ".xls";
|
|
|
+ $fullPathFile = $path . $newFile;
|
|
|
+ if (move_uploaded_file($file['tmp_name'], $fullPathFile)) {
|
|
|
+ util::complete($fullPathFile);
|
|
|
+ } else {
|
|
|
+ util::fail('fail');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|