fuc/src/Services/Tg/Hook/Mod/Buchang.php
2025-06-29 16:58:33 +08:00

63 lines
1.4 KiB
PHP

<?php
//declare(strict_types=1);
namespace App\Services\Tg\Hook\Mod;
use App\Models\User;
use App\Utils\Tools;
final class Buchang
{
public function buchang($aParam)
{
$sType = $aParam["aOption"][1] ?? 1;
$sValue = $aParam["aArg"][1] ?? false;
if (!$sValue) {
return "需要value";
}
$sValue = Tools::toGB($sValue);
// $oUser = User::where("class", ">=", $sType)->get();
$oUser = User::where("email", "yuejiqi@tuta.io")->get();
$i = 0;
foreach ($oUser as $oUserRow) {
$oUserRow->transfer_enable = $oUserRow->transfer_enable + $sValue;
$oUserRow->save();
$i++;
}
return "影响".$i."个用户";
}
public function Find($aParam)
{
// list($sCmd, $sCode) = explode(" ", $sText, 2);
$sCode = $aParam['aArg'][1];
$aData = ModelDuck::where('code', $sCode)->first()->toArray();
$aData['use_width'] = Tools::flowToGB($aData['use_width']).'GB';
$aData['max_width'] = Tools::flowToGB($aData['max_width']).'GB';
$aData['today_width'] = Tools::flowToGB($aData['today_width']).'GB';
$sMsg = json_encode($aData, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
return $sMsg;
}
}