no message

This commit is contained in:
hellcat 2025-12-19 17:38:00 +08:00
parent 9ad13bfdde
commit 5b079de70b
16 changed files with 1193 additions and 368 deletions

View File

@ -94,9 +94,44 @@ class FreenodeController extends Controller
TeleSlave::log()->enableSlaveQueue(false)->send("新fn文章".$sHtmlUrl);
self::_delLast();
return $sHtmlUrl;
}
private function _delLast()
{
$iLastTime = strtotime("+365 day"); // 这边保存1年
// $sLastDate = date("Y-m-d", $iLastTime);
$sLastDateCode = date("Ymd", $iLastTime);
// 删除file
foreach (self::$sEnding as $sClient => $sEnding) {
$sFilePath = "sub/".$sLastDateCode."-".$sClient.$sEnding;
if (file_exists($sFilePath)) {
if (unlink($sFilePath)) {
// echo " - 文件删除成功".$sFilePath."\n";
} else {
$sMsg = " - 文件删除失败 -> ".$sFilePath."\n";
TeleSlave::warn()->send($sMsg);
}
}
}
// 删除html
$sHtmlPath = "fn/".$sLastDateCode.".html";
if (file_exists($sHtmlPath)) {
if (unlink($sHtmlPath)) {
// echo " - 文件删除成功".$sHtmlPath."\n";
} else {
$sMsg = " - 文件删除失败 -> ".$sHtmlPath."\n";
TeleSlave::warn()->send($sMsg);
}
}
}
private function _saveHtml($sDateCode)
{
$sFreenodeNewUrl = env("APP_URL")."/fn/single/".$sDateCode;

View File

@ -71,8 +71,8 @@ final class HookController
$sClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sClass;
if (method_exists($sClassPath, $sFunc)) {
$oInstans = new $sClassPath();
// if (method_exists($sClassPath, $sFunc)) {
$oInstans = new $sClassPath($aUpdate);
$r = $oInstans->$sFunc($aParams);
// 可以不返回里面直接send
@ -90,9 +90,9 @@ final class HookController
Http::response(200);
}
} else {
throw new \Exception("没有这个方法:".$sClass.'#'.$sFunc);
}
// } else {
// throw new \Exception("没有这个方法:".$sClass.'#'.$sFunc);
// }
} catch (\Throwable $e) {
$sMessage = "错误line:".$e->getLine().": " . $e->getMessage();

51
app/Models/DogOption.php Executable file
View File

@ -0,0 +1,51 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DogOption extends Model
{
protected $table = 'dog_option';
public $timestamps = false;
public static function _hit($sDogName, $k)
{
$v = self::where("dog_name", $sDogName)->where("k", $k)->first()?->v;
// tomd($sDogName);
return $v;
}
public static function _list($sDogName)
{
$oSelf = self::where("dog_name", $sDogName)->get();
return self::_filterList($oSelf);
}
// public static function _limit($sDogName, $iSkip, $iTake)
// {
// $oSelf = self::where("dog_name", $sDogName)->skip($iSkip)->take($iTake)->get();
//
// return self::__filterList($oSelf);
// }
public static function _filter($oOption)
{
$arr = [];
$arr[$oOption->dog_name."#".$oOption->k] = $oOption->v;
return $arr;
}
public static function _filterList($oOption)
{
$arr = [];
foreach ($oOption as $oOptionRow) {
$arr[] = self::_filter($oOptionRow);
}
return $arr;
}
}

1049
app/Services/Tg/Hook/Dog.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
<?php
namespace App\Services\Tg\Hook\Mod;
use App\Models\ArticleList as ModelArticleList;
//use App\Models\ArticleSchema as ModelArticleSchema;
use App\Services\Tg\Hook\Dog;
////use App\Services\Article\CacheTg as ServiceArticleCacheTg;
//use App\Services\Article\Schema as ServiceArticleSchema;
//use App\Services\Article\Cmd as ServiceArticleCmd;
//use App\Services\TomTool\Flow;
//use App\Services\TomTool\ThrowableHandler;
class Article extends Base {
public function __construct($aUpdate)
{
$this->oDog = new Dog(new ModelArticleList());
$this->oDog->_setDogName("ArticleList");
// $this->oDog->_setStrField(["schema"]);
$this->aUpdate = $aUpdate;
}
public function __call($sName, $aArg)
{
return $this->oDog->$sName($aArg[0]);
}
public function todayDel($aParam)
{
$sArticleCode = $aParam["aArg"][1] ?? date("Ymd");
$r = ModelArticleList::where("code", $sArticleCode)->delete();
if (!$r) {
return "删除失败";
}
return "删除成功";
}
}

View File

@ -1,10 +1,10 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
//use App\Services\TomTool\Http;
//use App\Models\Article as ModelArticle;
use App\Services\TomTool\Http;
use App\Services\TG\Http as TGHttp;
use App\Services\Tg\Http as TGHttp;
class Base {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
use App\Models\Article as ModelArticle;
class Cmd extends Base {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
use Illuminate\Support\Facades\DB;
class DataBase extends Base {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
use App\Models\Jichang as ModelJichang;
class Jichang extends Base {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
use App\Models\Option as ModelOption;
class Option extends Base {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
//use App\Services\TomTool\Http;
use App\Models\Option as ModelOption;
use App\Models\ArticleList;

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
//use App\Services\TomTool\Http;
//use App\Models\Option as ModelOption;
//use App\Models\ArticleList;

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
use Illuminate\Support\Facades\DB;
class Tool extends Base {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Services\TG\Hook\Mod;
namespace App\Services\Tg\Hook\Mod;
//use App\Services\TomTool\Http;
class ToolOld extends Base {

File diff suppressed because one or more lines are too long