diff --git a/app/Http/Controllers/Api/Images/GetController.php b/app/Http/Controllers/Api/Images/GetController.php index 4988e90..b18e1b8 100644 --- a/app/Http/Controllers/Api/Images/GetController.php +++ b/app/Http/Controllers/Api/Images/GetController.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Storage; use App\Services\TomTool\Telegram\Slave as TeleSlave; use App\Services\TomTool\Flow; +use App\Models\ArticleKeyAuthorMap; class GetController extends Controller { @@ -41,9 +42,14 @@ public function urlbySubKey(Request $oRequest) private function findValidUrlBySubKey($sSubKey, $iNum, $oFlow) { try { + $sAuthors = ArticleKeyAuthorMap::where("key", $sSubKey)->first()?->authors; + $aAuthors = json_decode($sAuthors, true); + + $oQuery = ModelArticles::whereIn("sAuthorCode", $aAuthors)->->orderBy("id", "asc"); +// $oQuery = ArticleKeyAuthorMap::where("key", $sSubKey)->first()?->authors; // $oQuery = ModelArticles::where("sAuthorCode", $sAuthorCode)->orderBy("id", "asc"); // $oQuery = ModelArticles::where("aOpt", "like", $sSubKey)->orderBy("id", "asc"); - $oQuery = ModelArticles::where("aOpt", "like", '%'.$sSubKey.'%')->orderBy("id", "asc"); // 要这样吗 +// $oQuery = ModelArticles::where("aOpt", "like", '%'.$sSubKey.'%')->orderBy("id", "asc"); // 要这样吗 $iTotal = $oQuery->count(); if ($iTotal === 0) throw new \Exception("subkey:{$sSubKey} 旗下无任何记录"); diff --git a/app/Models/ArticleKeyAthorMap.php b/app/Models/ArticleKeyAthorMap.php new file mode 100755 index 0000000..bd95dbf --- /dev/null +++ b/app/Models/ArticleKeyAthorMap.php @@ -0,0 +1,43 @@ + 'array', +// 'aSchemaPro' => 'array', +// ]; +// }// 我希望查询的时候忽略这个设置 + +// protected static function booted(): void +// { +// static::deleting(function ($oArticle) { +// $oArticle->oImages()->get()->each(function ($oImage) { +// $oImage->delete(); +// }); +// }); +// } +// +// public function oSubject(): MorphTo +// { +// return $this->morphTo('oSubject'); +// } +// +// public function oImages(): MorphMany +// { +// return $this->morphMany(UploadImages::class, 'oImageable'); +// } + +}