|
|
@@ -199,7 +199,7 @@ class UploadController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //上传excel文件 ssh 20241126
|
|
|
+ //导入开单 ssh 20241126
|
|
|
public function actionImportKd()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
@@ -212,7 +212,35 @@ class UploadController extends BaseController
|
|
|
$shopId = $this->shopId;
|
|
|
$month = date("Ym");
|
|
|
$date = date("d");
|
|
|
- $path = dirUtil::getImgUploadDir() . "/{$mainId}/excel/{$shopId}/{$month}/{$date}/";
|
|
|
+ $path = dirUtil::getImgUploadDir() . "/{$mainId}/kd/{$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 . ' id:' . $id);
|
|
|
+ } else {
|
|
|
+ util::fail('fail');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //导入采购 ssh 20241126
|
|
|
+ public function actionImportCg()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['id'] ?? '';
|
|
|
+ $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}/cg/{$shopId}/{$month}/{$date}/";
|
|
|
if (!file_exists($path)) {
|
|
|
//检查是否有该文件夹,如果没有就创建,并给予最高权限
|
|
|
mkdir($path, 0700, true);
|