no message
This commit is contained in:
parent
9ad13bfdde
commit
5b079de70b
@ -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;
|
||||
|
||||
@ -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
51
app/Models/DogOption.php
Executable 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
1049
app/Services/Tg/Hook/Dog.php
Normal file
File diff suppressed because it is too large
Load Diff
43
app/Services/Tg/Hook/Mod/Article.php
Normal file
43
app/Services/Tg/Hook/Mod/Article.php
Normal 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 "删除成功";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
@ -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 {
|
||||
@ -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 {
|
||||
@ -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 {
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -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 {
|
||||
@ -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
Loading…
Reference in New Issue
Block a user