|
|
@@ -166,7 +166,28 @@ class UploadController extends BaseController
|
|
|
//批量导入客户 ssh 2024426
|
|
|
public function actionCustom()
|
|
|
{
|
|
|
- util::complete();
|
|
|
+ $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 . ".jpg";
|
|
|
+ $fullPathFile = $path . $newFile;
|
|
|
+ if (move_uploaded_file($file['tmp_name'], $fullPathFile)) {
|
|
|
+ $fileUrl = "uploads/{$mainId}/{$shopId}/{$month}/{$date}/" . $newFile;
|
|
|
+ util::success(['url' => $fileUrl,]);
|
|
|
+ } else {
|
|
|
+ util::fail('fail');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|