fuc-new/src/Services/Tg/Hook/Mod/Buchang.php
hellcat 1fe8673f62 1
2025-10-01 13:34:29 +08:00

67 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//declare(strict_types=1);
namespace App\Services\Tg\Hook\Mod;
use App\Models\User;
use App\Utils\Tools;
final class Buchang
{
public function gb($aParam)
{
$sType = $aParam["aOption"][1] ?? 2; // 1是试用套餐付费是>=2
$sValue = $aParam["aArg"][1] ?? false;
if ($sValue == "?") {
return "/buchang#gb <gb> | 默认补偿有套餐用户class>2,可设为1。单位gb";
}
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;
//
// }
}