69 lines
1.7 KiB
PHP
Executable File
69 lines
1.7 KiB
PHP
Executable File
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Services\TomTool;
|
||
|
||
use App\Utils\Tools;
|
||
|
||
final class TgSendFormat
|
||
{
|
||
|
||
public $sTitleEmoji;
|
||
public $sTitle;
|
||
public $aContent;
|
||
|
||
public function typeA ()
|
||
{
|
||
$sStr = '';
|
||
|
||
$sStr .= "\n\n".$this->sTitleEmoji;
|
||
|
||
$sStr .= "\n\n".$this->sTitle;
|
||
|
||
foreach ($this->aContent as $v) {
|
||
// echo "失联客机";
|
||
$sStr .= "\n\n".$v[0].":".$v[1]."。";
|
||
}
|
||
|
||
return $sStr;
|
||
|
||
}
|
||
|
||
public function rowAdd($sName, $iFlowToday, $iUseWidth, $iMaxWidth, $iLimitDay = false) {
|
||
|
||
$iUseWidth = Tools::flowToGB($iUseWidth);
|
||
$iMaxWidth = Tools::flowToGB($iMaxWidth);
|
||
$iFlowToday = Tools::flowToGB($iFlowToday);
|
||
|
||
if ($iMaxWidth <= 0) {
|
||
$sFlowRate = 0;
|
||
} else {
|
||
$sFlowRate = number_format($iUseWidth / $iMaxWidth * 100, 0, '.', '');
|
||
}
|
||
|
||
if ($sFlowRate > 70) {
|
||
$sFlowEmoji = '🪫';
|
||
} else {
|
||
$sFlowEmoji = '🔋';
|
||
}
|
||
|
||
// $sFlowMix = $sFlowEmoji.' '.(100 - $sFlowRate)."%(".$iMaxWidth."g - ".$iUseWidth."g = ".$iMaxWidth - $iUseWidth."g)【 今:".$iFlowToday."g 】";
|
||
$sFlowMix = $sFlowEmoji.' '.(100 - $sFlowRate)."%";
|
||
|
||
$sFlowMix .= "( 总:".$iMaxWidth."g";
|
||
$sFlowMix .= ", 余:".$iMaxWidth - $iUseWidth."g";
|
||
$sFlowMix .= ", 今:".$iFlowToday."g";
|
||
|
||
if ($iLimitDay > 0) {
|
||
$sFlowMix .= ", 置:".$iLimitDay."天";
|
||
}
|
||
|
||
$sFlowMix .= " )";
|
||
|
||
$this->aContent[] = [$sName, $sFlowMix];
|
||
|
||
}
|
||
|
||
}
|