Jelajahi Sumber

更新命令

王大坤 1 tahun lalu
induk
melakukan
b77622f554

+ 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);
     }
 
     /**

+ 85 - 0
env

xqd
@@ -0,0 +1,85 @@
+APP_NAME=Laravel
+APP_ENV=local
+APP_KEY=base64:JCvirjK+4zF8Z6X9vkk2xFvMFT0cK2r1D159ycsThiw=
+APP_DEBUG=true
+APP_URL=http://localhost
+APP_LOCALE=zh_CN
+APP_TIMEZONE=PRC
+
+# ADMIN
+ADMIN_NAME="短腿鹤伴读"
+ADMIN_TITLE="短腿鹤伴读管理后台"
+ADMIN_HTTPS=true
+ADMIN_HELPERS=true
+JWT_TTL=43200
+LOG_CHANNEL=daily
+LOG_LEVEL=debug
+
+DB_CONNECTION=mysql
+DB_HOST=localhost
+DB_PORT=3306
+DB_DATABASE=hb
+DB_USERNAME=root
+DB_PASSWORD=BrZbOn6OGg3yUsLg
+DB_PREFIX=hb_
+
+BROADCAST_DRIVER=log
+CACHE_DRIVER=file
+FILESYSTEM_DRIVER=local
+QUEUE_CONNECTION=sync
+SESSION_DRIVER=file
+SESSION_LIFETIME=120
+
+#Dingo API
+API_STANDARDS_TREE=prs
+API_SUBTYPE=api
+API_PREFIX=api
+API_VERSION=v1
+API_DEBUG=true
+
+
+MEMCACHED_HOST=127.0.0.1
+
+REDIS_HOST=127.0.0.1
+REDIS_PASSWORD=null
+REDIS_PORT=6379
+
+MAIL_MAILER=smtp
+MAIL_HOST=mailhog
+MAIL_PORT=1025
+MAIL_USERNAME=null
+MAIL_PASSWORD=null
+MAIL_ENCRYPTION=null
+MAIL_FROM_ADDRESS=null
+MAIL_FROM_NAME="${APP_NAME}"
+
+AWS_ACCESS_KEY_ID=
+AWS_SECRET_ACCESS_KEY=
+AWS_DEFAULT_REGION=us-east-1
+AWS_BUCKET=
+AWS_USE_PATH_STYLE_ENDPOINT=false
+
+PUSHER_APP_ID=
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=
+PUSHER_APP_CLUSTER=mt1
+
+MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+
+JWT_SECRET=vIdNecn1HtbC5fmQ5I4V8R0GWMK7KQPEwnJBgJgKpIqDvsYDSLYycUrfPXdFqppk
+
+ALI_OSS_ACCESS_ID=LTAI5t7TEGLhrLpwDf5Xgf9d
+ALI_OSS_ACCESS_SECRET=RSetSbuLAVpPO67klE0WpOPAU5YCW2
+ALI_OSS_ENDPOINT=oss-cn-chengdu.aliyuncs.com
+ALI_OSS_URL=https://zhengda.oss-cn-chengdu.aliyuncs.com/hb
+ALI_OSS_BUCKET=zhengda
+# 阿里云 OSS
+
+# 首页推荐栏目展示短剧个数
+HOME_RECOMMEND_NUMBER=6
+BAIDU_ERNIE_BOT40_URL=https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro
+BAIDU_ERNIE_SD_URL=https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/text2image/sd_xl
+BAIDU_GRANT_TYPE=client_credentials
+BAIDU_CLIENT_ID=Rmh75pjNHSZ4IAAPlKme8iOG
+BAIDU_CLIENT_SECRET=X9HmS1WsWuTI6NQOQEfxlweWy36MG7rr