2 Commits 31dbc67808 ... 7b2d26d5ef

Auteur SHA1 Bericht Datum
  王大坤 7b2d26d5ef 更新命令 1 jaar geleden
  王大坤 b77622f554 更新命令 1 jaar geleden

+ 44 - 0
app/Console/Commands/buildKeyword.php

xqd
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Http\Controllers\V1\Ai\AiController;
+use Illuminate\Console\Command;
+
+class buildKeyword extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'buildKeyword';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        (new AiController())->buildKeyword();
+        return 0;
+    }
+}

+ 44 - 0
app/Console/Commands/buildPinyin.php

xqd
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Http\Controllers\V1\Ai\AiController;
+use Illuminate\Console\Command;
+
+class buildPinyin extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'buildPinyin';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        (new AiController())->buildPinyin();
+        return 0;
+    }
+}

+ 44 - 0
app/Console/Commands/buildSd.php

xqd
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Http\Controllers\V1\Ai\AiController;
+use Illuminate\Console\Command;
+
+class buildSd extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'buildSd';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        (new AiController())->buildSd();
+        return 0;
+    }
+}

+ 44 - 0
app/Console/Commands/buildStory.php

xqd
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Http\Controllers\V1\Ai\AiController;
+use Illuminate\Console\Command;
+
+class buildStory extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'buildStory';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        (new AiController())->buildStory();
+        return 0;
+    }
+}

+ 44 - 0
app/Console/Commands/buildTitle.php

xqd
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Http\Controllers\V1\Ai\AiController;
+use Illuminate\Console\Command;
+
+class buildTitle extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'buildTitle';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        (new AiController())->buildTitle();
+        return 0;
+    }
+}

+ 44 - 0
app/Console/Commands/getOpensdDetail.php

xqd
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Http\Controllers\V1\Ai\AiController;
+use Illuminate\Console\Command;
+
+class getOpensdDetail extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'getOpensdDetail';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        (new AiController())->getOpensdDetail();
+        return 0;
+    }
+}

+ 6 - 6
app/Http/Controllers/V1/Ai/AiController.php

xqd xqd xqd xqd xqd xqd
@@ -165,7 +165,7 @@ class AiController extends Controller
     /**
      * 生成故事.
      */
-    public function buildStory(Request $request): \Illuminate\Http\JsonResponse
+    public function buildStory(): \Illuminate\Http\JsonResponse
     {
         try {
             $task = TaskList::query()->with('role')->where('state', 0)->inRandomOrder()->first();
@@ -259,7 +259,7 @@ class AiController extends Controller
      *
      * @return \Illuminate\Http\JsonResponse
      */
-    public function buildTitle(Request $request)
+    public function buildTitle()
     {
         try {
             $task = TaskList::query()->with('role')->where('state', 1)->inRandomOrder()->first();
@@ -292,7 +292,7 @@ class AiController extends Controller
      *
      * @return \Illuminate\Http\JsonResponse
      */
-    public function buildKeyword(Request $request)
+    public function buildKeyword()
     {
         try {
             $task = TaskList::query()->with('role')->where('state', 2)->inRandomOrder()->first();
@@ -344,7 +344,7 @@ class AiController extends Controller
      *
      * @return \Illuminate\Http\JsonResponse
      */
-    public function buildSd(Request $request)
+    public function buildSd()
     {
         try {
             $task = TaskList::query()->with('role')->where('state', 3)->inRandomOrder()->first();
@@ -392,7 +392,7 @@ class AiController extends Controller
      *
      * @return \Illuminate\Http\JsonResponse
      */
-    public function getOpensdDetail(Request $request)
+    public function getOpensdDetail()
     {
         $task = TaskList::query()->where('state', 4)->inRandomOrder()->first();
         if (!$task) {
@@ -423,7 +423,7 @@ class AiController extends Controller
      *
      * @return \Illuminate\Http\JsonResponse
      */
-    public function buildPinyin(Request $request)
+    public function buildPinyin()
     {
         try {
             $task = TaskList::query()->where('state', 5)->inRandomOrder()->first();

+ 19 - 18
app/libs/helpers/LogHelper.php

xqd
@@ -15,25 +15,26 @@ class LogHelper
      */
     public static function exceptionLog($exception, $errCode): void
     {
+        var_dump($exception->getMessage());
         $names = explode('@', request()->route()->getAction()['controller']);
-        $data  = [
-            'token'      => request()->header('token', null),
-            'uid'        => Auth::$userId ? Auth::$userId : Auth::$adminId,
-            'code'       => $errCode,
-            'controller' => $names[0],
-            'func'       => $names[1],
-            'method'     => request()->method(),
-            'ip'         => request()->ip(),
-            'params'     => json_encode([
-                'message' => $exception->getMessage(),
-                'code'    => $exception->getCode(),
-                'line'    => $exception->getLine(),
-                'file'    => $exception->getFile(),
-            ], JSON_UNESCAPED_UNICODE),
-            'day'        => strtotime('today'),
-            'created_at' => time(),
-        ];
-        Db::table('exception_logs')->insert($data);
+            $data = [
+                'token' => request()->header('token', null),
+                'uid' => Auth::$userId ? Auth::$userId : Auth::$adminId,
+                'code' => $errCode,
+                'controller' => $names[0],
+                'func' => $names[1],
+                'method' => request()->method(),
+                'ip' => request()->ip(),
+                'params' => json_encode([
+                    'message' => $exception->getMessage(),
+                    'code' => $exception->getCode(),
+                    'line' => $exception->getLine(),
+                    'file' => $exception->getFile(),
+                ], JSON_UNESCAPED_UNICODE),
+                'day' => strtotime('today'),
+                'created_at' => time(),
+            ];
+            Db::table('exception_logs')->insert($data);
     }
 
     /**