王大坤 пре 1 година
родитељ
комит
5997410f39
1 измењених фајлова са 9 додато и 1 уклоњено
  1. 9 1
      app/Http/Controllers/V1/Ai/AiController.php

+ 9 - 1
app/Http/Controllers/V1/Ai/AiController.php

xqd xqd xqd
@@ -433,6 +433,10 @@ class AiController extends Controller
             }
             $date = date('Ymd');
             $path  = public_path() . '/file/images/'.$date.'/' . $file_name;
+            $imageDir     = public_path() . '/file/images/'.$date.'/';
+            if (!is_dir($imageDir)) {
+                mkdir($imageDir, 0755, true);
+            }
             $shell = 'wkhtmltoimage --quality 50 https://hb.swdz.com/api/ai/Pinyin?id=' . $task->id . ' ' . $path;
             exec($shell, $result, $status);
             if ($status) {
@@ -445,7 +449,6 @@ class AiController extends Controller
             $task->pinyin_content = $result;
             $task->state          = 6;
             $task->save();
-
             return Response::success($result);
         } catch (\Exception $exception) {
             LogHelper::exceptionLog($exception, $this->code);
@@ -474,6 +477,11 @@ class AiController extends Controller
                 $file_name = md5(time()) . '.pdf';
             }
             $path  = public_path() . '/file/pdf/' . $file_name;
+            $date = date('Ymd');
+            $imageDir     = public_path() . '/file/pdf/'.$date.'/';
+            if (!is_dir($imageDir)) {
+                mkdir($imageDir, 0755, true);
+            }
             $shell = 'wkhtmltopdf https://hb.swdz.com/api/ai/Pinyin?id=' . $task->id . ' ' . $path;
             exec($shell, $result, $status);
             if ($status) {