no message

This commit is contained in:
hellcat 2025-05-10 13:33:39 +08:00
parent 07ea286527
commit fee656d40a
4 changed files with 134 additions and 16 deletions

View File

@ -68,7 +68,12 @@ class SakaiController
// $s = "/note#memo__1 股您吗的";
// $s = "/note#icon";
$s = "/note#add__now 脱裤子 112";
$s = "/note_option#add__ttt zzz";
// $s = "/note_option#add__ttt1 zzz";
// $s = "/note_option#del ttt";
$s = "/note_option#list";
$s = "/note_option#find icon_type1";
$s = "/note_option#set__icon_type 2";
$s = "/note#main";
$oHttp = new Http();
$oHttp->sMethod = "post";

View File

@ -8,4 +8,31 @@ class NoteOption extends Model
{
protected $table = 'note_option';
public $timestamps = false;
public static function _find($sKey)
{
$aData = self::where("key", $sKey)->first()->toArray();
if ($aData["value"]) {
$r = $aData["value"];
} else {
$r = false;
}
return $r;
}
public static function _all()
{
$aData = self::all()->toArray();
$aDataNew = [];
foreach ($aData as $row) {
$aDataNew[$row["key"]] = $row["value"];
}
return $aDataNew;
}
}

View File

@ -3,9 +3,17 @@
namespace App\Services\TG\Hook\Mod;
use App\Models\Note as ModelNote;
use App\Models\NoteOption as ModelNoteOption;
class Note extends Base {
private $sIconType;
function __construct()
{
$this->sIconType = ModelNoteOption::_find("icon_type");
}
public function Score($aParam)
{
@ -185,7 +193,9 @@ class Note extends Base {
private function arrTypeIcon()
{
$aMap = [
$aMap = [];
$aMap[1] = [
"warning" => "🟥",
"now" => "🟩",
"wait" => "🟧",
@ -198,23 +208,37 @@ class Note extends Base {
"tip" => "💡",
];
return $aMap;
$aMap[2] = [
"warning" => "🔴",
"now" => "🟢",
"wait" => "🟠",
"under" => "⚪️",
"keep" => "⚫️",
"del" => "",
"track" => "🟤",
"mark" => "🟣",
"done" => "",
"tip" => "💡",
];
$aMap[3] = [
"warning" => "⚠️",
"now" => "🎸",
"wait" => "🚦",
"under" => "⚪️",
"keep" => "📌",
"del" => "",
"track" => "🌀",
"mark" => "⭐️",
"done" => "",
"tip" => "💡",
];
return $aMap[$this->sIconType];
}
private function mapTypeIcon($sType)
{
// $aMap = [
// "warning" => "⚠️",
// "now" => "🎸",
// "wait" => "🚦",
// "under" => "⚪️",
// "keep" => "📌",
// "del" => "❌",
// "track" => "🌀",
// "mark" => "⭐️",
// "done" => "✅",
// "tip" => "💡",
// ];
$aMap = $this->arrTypeIcon();

View File

@ -5,7 +5,26 @@ namespace App\Services\TG\Hook\Mod;
use App\Models\Note as ModelNote;
use App\Models\NoteOption as ModelNoteOption;
class Note_option extends Base {
class note_option extends Base {
public function set($aParam)
{
$sKey = $aParam["aOption"][1];
$sValue = $aParam["aArg"][1];
$oNoteOption = ModelNoteOption::where("key", $sKey)->first();
if (!$oNoteOption) {
return "没有";
}
$oNoteOption->value = $sValue;
$r = $oNoteOption->save();
return $r;
}
public function add($aParam)
{
@ -20,4 +39,47 @@ class Note_option extends Base {
return $r;
}
public function del($aParam)
{
$sKey = $aParam["aArg"][1];
$oModelNoteOption = ModelNoteOption::where("key", $sKey)->first();
$r = $oModelNoteOption->delete();
return $r;
}
public function list($aParam)
{
$oNoteOptionList = ModelNoteOption::all();
return $this->noteOptionToStr($oNoteOptionList);
}
public function find($aParam)
{
$sKey = $aParam["aArg"][1];
$oNoteOption = ModelNoteOption::where("key", $sKey)->first();
if (!$oNoteOption) {
return "没有";
}
return $this->noteOptionToStr([$oNoteOption]);
}
private function noteOptionToStr($oNoteOption)
{
$sStr = "";
foreach ($oNoteOption as $row) {
$sStr .= "\n";
$sStr .= $row->key."::".$row->value;
}
return $sStr;
}
}