diff --git a/app/Admin/Controllers/AppVersionController.php b/app/Admin/Controllers/AppVersionController.php index 54a81a53..cea59efd 100644 --- a/app/Admin/Controllers/AppVersionController.php +++ b/app/Admin/Controllers/AppVersionController.php @@ -107,6 +107,7 @@ class AppVersionController extends AdminController $form->text('apk_link1')->rules('required_if:cate,1', ['required_if'=>'苹果平台需要填写苹果商店地址']); }) ->when([2, 3], function (Form $form) { + $form->text('apk_link_text', '链接地址'); $form->file('apk_link2')->chunked() ->accept('apk', 'apk/*') ->move('app-vesrion/apk/'.Carbon::now()->toDateString()) @@ -114,7 +115,7 @@ class AppVersionController extends AdminController ->saveFullUrl() ->removable(false) ->autoSave(false) - ->autoUpload()->rules('required_if:cate,2,3', ['required_if'=>'安卓平台需要上传应用包'])->customFormat(function ($v) { + ->autoUpload()->customFormat(function ($v) { if (in_array($this->model()->cate, [2, 3])) { $v = $this->model()->apk_link; } @@ -140,9 +141,16 @@ class AppVersionController extends AdminController $form->hidden('apk_link'); $form->saving(function (Form $form) { - $apk_link = 'apk_link'.($form->cate != 3 ? $form->cate : 2); - $form->apk_link = $form->$apk_link; + if (in_array($form->cate, [2, 3])) { + $form->apk_link = $form->apk_link_text; + } + $apk_link = 'apk_link'.($form->cate != 3 ? $form->cate : 2); + if ($form->$apk_link) { + $form->apk_link = $form->$apk_link; + } + + $form->deleteInput('apk_link_text'); $form->deleteInput('apk_link1'); $form->deleteInput('apk_link2'); }); diff --git a/app/Admin/Imports/Import.php b/app/Admin/Imports/Import.php index eaf81714..1e59d001 100644 --- a/app/Admin/Imports/Import.php +++ b/app/Admin/Imports/Import.php @@ -16,7 +16,7 @@ class Import $path = DIRECTORY_SEPARATOR.'import'.DIRECTORY_SEPARATOR.date('Y-m-d').DIRECTORY_SEPARATOR.'import'.$file_name; // dd(str_replace(config('filesystems.disks.aliyun.domain'), config('filesystems.disks.aliyun.bucket').'.'.config('filesystems.disks.aliyun.endpoint'), $url)); - Storage::put($path, file_get_contents(str_replace(config('filesystems.disks.aliyun.domain'), config('filesystems.disks.aliyun.bucket').'.'.config('filesystems.disks.aliyun.endpoint'), $url))); + Storage::disk('local')->put($path, file_get_contents(str_replace(config('filesystems.disks.aliyun.domain'), config('filesystems.disks.aliyun.bucket').'.'.config('filesystems.disks.aliyun.endpoint'), $url))); $file = new File(storage_path('app'.$path)); return $this->readFile($file); }