diff --git a/app/Http/Controllers/Api/Tg/HookController.php b/app/Http/Controllers/Api/Tg/HookController.php index 43b1bd42..c6f7532d 100755 --- a/app/Http/Controllers/Api/Tg/HookController.php +++ b/app/Http/Controllers/Api/Tg/HookController.php @@ -49,7 +49,7 @@ final class HookController public function cache_tg_new() { - $sCacheTgHook = Option::where("k", "cache_tg::hook")->first()?->v; // 做了一半 + $sCacheTgHook = Option::where("k", "cache_tg_new::hook")->first()?->v; // 做了一半 if (!$sCacheTgHook) { echo "$sCacheTgHook 未设置"; diff --git a/app/Models/Option.php b/app/Models/Option.php index 12f753ec..aa6a066e 100755 --- a/app/Models/Option.php +++ b/app/Models/Option.php @@ -8,7 +8,7 @@ class Option extends Model { protected $table = 'option'; public $timestamps = false; - protected $primaryKey = 'k'; +// protected $primaryKey = 'k'; public $incrementing = false; protected $keyType = 'string'; diff --git a/app/Services/CacheTg.php b/app/Services/CacheTg.php index 004eba32..17790f4d 100755 --- a/app/Services/CacheTg.php +++ b/app/Services/CacheTg.php @@ -14,6 +14,7 @@ use Illuminate\Support\Facades\File; use App\Models\TelegramKey as ModelTelegramKey; use Illuminate\Support\Str; use App\Services\Article\Cmd as ServiceArticleCmd; +use App\Models\Option; final class CacheTg { @@ -186,8 +187,20 @@ final class CacheTg $oModelArticleSchema->group_code = $sGroupCode; $oModelArticleSchema->save(); + $jDefaultThumbUse = Option::where("k", "cache_tg_new::default_thumb_use::{$sGroupCode}")->first()?->k; + + if (!$aDefaultThumbUse) { + $jDefaultThumbUse = Option::where("k", "cache_tg_new::default_thumb_use")->first()?->k; + } + + $aDefaultThumbUse = json_decode($jDefaultThumbUse, true); + + if (!$aDefaultThumbUse) { + $aDefaultThumbUse = ["c"]; + } + $oModelArticleSchema->_opt([ - "thumb_use" => ['c'] + "thumb_use" => $aDefaultThumbUse ]); ServiceArticleCmd::startWithO($oModelArticleSchema)->syncOpen()->save("new");