no message
This commit is contained in:
parent
7020f2f834
commit
44b3978ad4
@ -6,6 +6,15 @@ use App\Models\Ann as ModelAnn;
|
||||
use App\Services\Tg\Hook\Dog;
|
||||
use App\Services\IM\TelegramV2;
|
||||
|
||||
/**
|
||||
|
||||
none = 蓝色喇叭,常规日常
|
||||
warning = 黄色I,重要日常,网络波动之类
|
||||
danger = 红色I,重要通知,换域名之类
|
||||
success = 绿色标签,优惠活动
|
||||
|
||||
*/
|
||||
|
||||
class Ann extends Base {
|
||||
|
||||
private $oDog;
|
||||
@ -27,6 +36,78 @@ class Ann extends Base {
|
||||
|
||||
}
|
||||
|
||||
public function newNone($aParam)
|
||||
{
|
||||
$aParam["custom"]["rank"] = "none";
|
||||
$aParam["custom"]["title"] = "运维通知";
|
||||
|
||||
return $this->newXX($aParam);
|
||||
}
|
||||
|
||||
public function newWarn($aParam)
|
||||
{
|
||||
$aParam["custom"]["rank"] = "warning";
|
||||
$aParam["custom"]["title"] = "运维通知";
|
||||
|
||||
return $this->newXX($aParam);
|
||||
}
|
||||
|
||||
public function newFail($aParam)
|
||||
{
|
||||
$aParam["custom"]["rank"] = "danger";
|
||||
$aParam["custom"]["title"] = "重要通知";
|
||||
|
||||
return $this->newXX($aParam);
|
||||
}
|
||||
|
||||
public function newDone($aParam)
|
||||
{
|
||||
$aParam["custom"]["rank"] = "success";
|
||||
$aParam["custom"]["title"] = "活动通知";
|
||||
|
||||
return $this->newXX($aParam);
|
||||
}
|
||||
|
||||
public function newXX($aParam)
|
||||
{
|
||||
$aContent = $aParam["aArg"] ?? [];
|
||||
$sContent = implode(" ", $aContent);
|
||||
$sTitle = $aParam["custom"]["title"];
|
||||
$sRank = $aParam["custom"]["rank"];
|
||||
|
||||
if (!$sContent) {
|
||||
return "需要content";
|
||||
}
|
||||
|
||||
if ($sContent == "?") {
|
||||
return "#newXXX [content]";
|
||||
}
|
||||
|
||||
$oAnn = new ModelAnn();
|
||||
$oAnn->content = $sContent;
|
||||
$oAnn->status = 1;
|
||||
$oAnn->sort = 0;
|
||||
$oAnn->date = date("Y-m-d H:i:s");
|
||||
$oAnn->title = $sTitle;
|
||||
$oAnn->rank = $sRank;
|
||||
$oAnn->post = 0;
|
||||
$oAnn->save();
|
||||
|
||||
$aParam = [];
|
||||
$aParam["aArg"][1] = $oAnn->id;
|
||||
return $this->find($aParam);
|
||||
}
|
||||
|
||||
public function findPin()
|
||||
{
|
||||
$iPinId = ModelAnn::where("sort", ">", 0)->where("status", 1)->orderBy("sort", "desc")->first()?->id;
|
||||
|
||||
$aParam = [];
|
||||
$aParam["aArg"][1] = $iPinId;
|
||||
|
||||
return $this->find($aParam);
|
||||
}
|
||||
|
||||
public function post($aParam)
|
||||
{
|
||||
$iId = $aParam["aArg"][1] ?? false;
|
||||
|
||||
@ -61,17 +61,6 @@ class User extends Base {
|
||||
return $this->oDog->find($aParam);
|
||||
}
|
||||
|
||||
public function moneyAdd($aParam)
|
||||
{
|
||||
$aParam["_sUpDown"] = "up";
|
||||
|
||||
if ($aParam["aArg"][1] == "?") {
|
||||
return "/user#moneyAdd__[key]__[where]__确认[y/n:default] [money]";
|
||||
}
|
||||
|
||||
return $this->_moneyUpDown($aParam);
|
||||
}
|
||||
|
||||
public function toFree($aParam)
|
||||
{
|
||||
// $iId = $aParam["aArg"][1] ?? false;
|
||||
@ -109,6 +98,17 @@ class User extends Base {
|
||||
|
||||
}
|
||||
|
||||
public function moneyAdd($aParam)
|
||||
{
|
||||
$aParam["_sUpDown"] = "up";
|
||||
|
||||
if ($aParam["aArg"][1] == "?") {
|
||||
return "/user#moneyAdd__[key]__[where]__确认[y/n:default] [money]";
|
||||
}
|
||||
|
||||
return $this->_moneyUpDown($aParam);
|
||||
}
|
||||
|
||||
private function _moneyUpDown($aParam)
|
||||
{
|
||||
$sKey = $aParam["aOption"][1] ?? false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user