no message

This commit is contained in:
hellcat 2025-07-18 19:38:27 +08:00
parent c70f29ad2d
commit fdf9d82de8

View File

@ -6,9 +6,28 @@ namespace App\Services\TG\Hook\Mod;
use App\Models\DoveSite as ModelDoveSite;
use App\Services\TomTool\Http;
use App\Services\TG\Http as TGHttp;
use App\Services\TG\Hook\Dog;
class Dove extends Base {
private $oDog;
public function __construct($aUpdate)
{
$this->oDog = new Dog(new ModelDoveSite());
$this->oDog->_setDogName("dove"); // 必须me用正常就是类名只不过后期没准改名所以就这里写死
$this->oDog->_setPrimaryKey("code"); // 可选默认id
// $this->oDog->_setStrField(["content"]); // 可选,指定长文本字段
}
public function __call($sName, $aArg)
{
return $this->oDog->$sName($aArg[0]);
}
public function go($aParam, $aData)
{
$oDoveSiteCheckedList = ModelDoveSite::where("dove_checked", 1)->get();
@ -42,113 +61,113 @@ class Dove extends Base {
Http::response(200);
}
public function del($aParam)
{
$sCode = $aParam["aArg"][1] ?? false;
if (!$sCode) {
return "要code";
}
$oDove = ModelDoveSite::where("code", $sCode)->first();
if (!$oDove) {
return "没有";
}
$oDove->delete();
return $this->list();
}
// public function del($aParam)
// {
// $sCode = $aParam["aArg"][1] ?? false;
//
// if (!$sCode) {
// return "要code";
// }
//
// $oDove = ModelDoveSite::where("code", $sCode)->first();
//
// if (!$oDove) {
// return "没有";
// }
//
// $oDove->delete();
//
// return $this->list();
// }
public function add($aParam)
{
$sCode = $aParam["aArg"][1];
$oDove = new ModelDoveSite();
$oDove->code = $sCode;
$oDove->save();
return $this->list();
}
// public function add($aParam)
// {
// $sCode = $aParam["aArg"][1];
//
// $oDove = new ModelDoveSite();
//
// $oDove->code = $sCode;
//
// $oDove->save();
//
// return $this->list();
// }
public function set($aParam)
{
$sCode = $aParam["aOption"][1] ?? false;
$k = $aParam["aOption"][2] ?? false;
$v = $aParam["aArg"][1] ?? false;
if (!$sCode) {
return "需要code";
}
$oDove = ModelDoveSite::where("code", $sCode)->first();
if (!$oDove) {
return "没有";
}
$oDove->$k = $v;
$oDove->save();
return $this->toJson($oDove);
}
// public function set($aParam)
// {
// $sCode = $aParam["aOption"][1] ?? false;
// $k = $aParam["aOption"][2] ?? false;
// $v = $aParam["aArg"][1] ?? false;
//
// if (!$sCode) {
// return "需要code";
// }
//
// $oDove = ModelDoveSite::where("code", $sCode)->first();
//
// if (!$oDove) {
// return "没有";
// }
//
// $oDove->$k = $v;
//
// $oDove->save();
//
// return $this->toJson($oDove);
// }
public function list()
{
$oDove = ModelDoveSite::all();
$r = $this->toJson($oDove);
return $r;
}
// public function list()
// {
// $oDove = ModelDoveSite::all();
//
// $r = $this->toJson($oDove);
//
// return $r;
// }
public function class($aParam)
{
$sClass = $aParam["aArg"][1] ?? false;
if ($sClass == "?") {
return "/dove#class <class>";
}
if (!$sClass) {
return "需要class";
}
$aParam["aOption"][1] = "class";
$aParam["aArg"][1] = $sClass;
return $this->where($aParam);
}
// public function class($aParam)
// {
// $sClass = $aParam["aArg"][1] ?? false;
//
// if ($sClass == "?") {
// return "/dove#class <class>";
// }
//
// if (!$sClass) {
// return "需要class";
// }
//
// $aParam["aOption"][1] = "class";
// $aParam["aArg"][1] = $sClass;
//
// return $this->where($aParam);
// }
public function where($aParam)
{
$sField = $aParam["aOption"][1] ?? false;
$sValue = $aParam["aArg"][1] ?? false;
if ($sValue == "?") {
return "/dove#where__<firld> <value>";
}
if (!$sField) {
return "需要field";
}
if (!$sValue) {
return "需要value";
}
$oDoveSite = ModelDoveSite::where($sField, $sValue)->get();
if ($oDove->isEmpty()) {
return "没找到这个";
}
return $this->toJson($oDoveSite);
}
// public function where($aParam)
// {
// $sField = $aParam["aOption"][1] ?? false;
// $sValue = $aParam["aArg"][1] ?? false;
//
// if ($sValue == "?") {
// return "/dove#where__<firld> <value>";
// }
//
// if (!$sField) {
// return "需要field";
// }
//
// if (!$sValue) {
// return "需要value";
// }
//
// $oDoveSite = ModelDoveSite::where($sField, $sValue)->get();
//
// if ($oDove->isEmpty()) {
// return "没找到这个";
// }
//
// return $this->toJson($oDoveSite);
// }
public function check($aParam)
{