🔧Fixed Type declare issue

This commit is contained in:
BrettonYe
2023-10-12 23:21:17 +08:00
committed by BrettonYe
parent bca9be70a3
commit 0eaddeac55
6 changed files with 15 additions and 15 deletions

View File

@@ -59,7 +59,7 @@ class TaskHourly extends Command
// 用户流量异常警告
if ($data_anomaly_notification && $overall['total'] >= $traffic_ban_value) {
Notification::send(User::find(1), new DataAnomaly($user->username, formatBytes($overall['u']), formatBytes($overall['d']), formatBytes($overall['total'])));
Notification::send(User::find(1), new DataAnomaly($user->id, formatBytes($overall['u']), formatBytes($overall['d']), formatBytes($overall['total'])));
}
}
});

View File

@@ -15,7 +15,7 @@ class DataExhaust extends Notification implements ShouldQueue
public function __construct(float|int $percent)
{
$this->percent = $percent;
$this->percent = round($percent, 2);
}
public function via($notifiable)

View File

@@ -15,7 +15,7 @@ class PaymentService
$payment->trade_no = Str::random(8);
$payment->user_id = $uid;
$payment->order_id = $oid;
$payment->amount = $amount;
$payment->amount = round($amount, 2);
$payment->save();
return $payment;
@@ -31,7 +31,7 @@ class PaymentService
$log = new PaymentCallback();
$log->trade_no = $trade_no;
$log->out_trade_no = $out_trade_no;
$log->amount = $amount;
$log->amount = round($amount, 2);
return $log->save();
}

View File

@@ -155,7 +155,7 @@ class ProxyService
return $config;
}
public function failedProxyReturn(string $text, int $type = 1): string
public function failedProxyReturn(string $text, ?int $type = 1): string
{
$url = sysConfig('website_url');

View File

@@ -182,9 +182,9 @@ class Helpers
$log = new UserCreditLog();
$log->user_id = $userId;
$log->order_id = $orderId;
$log->before = $before;
$log->after = $after;
$log->amount = $amount;
$log->before = round($before, 2);
$log->after = round($after, 2);
$log->amount = round($amount, 2);
$log->description = $description;
$log->created_at = date('Y-m-d H:i:s');

View File

@@ -17,7 +17,7 @@ class AlipayF2F
private array $config;
public function __construct(array $rawConfig = [])
public function __construct(array $rawConfig)
{
$config = [
'app_id' => $rawConfig['app_id'],
@@ -70,7 +70,7 @@ class AlipayF2F
return $beginStr.wordwrap($keyStr, 64, "\n", true).$endStr;
}
public function tradeQuery($content)
public function tradeQuery(array $content): array
{
$this->setMethod('alipay.trade.query');
$this->setContent($content);
@@ -78,12 +78,12 @@ class AlipayF2F
return $this->send();
}
private function setMethod($method): void
private function setMethod(string $method): void
{
$this->config['method'] = $method;
}
private function setContent($content): void
private function setContent(array $content): void
{
$content = array_filter($content);
ksort($content);
@@ -92,7 +92,7 @@ class AlipayF2F
private function send(): array
{
$response = Http::timeout(15)->get(self::$gatewayUrl, $this->buildParams())->json();
$response = Http::timeout(15)->retry(2)->get(self::$gatewayUrl, $this->buildParams())->json();
$resKey = str_replace('.', '_', $this->config['method']).'_response';
if (! isset($response[$resKey])) {
throw new RuntimeException('请求错误-看起来是请求失败');
@@ -161,7 +161,7 @@ class AlipayF2F
*
* @throws RuntimeException
*/
public function rsaVerify(array $data, $sign): bool
public function rsaVerify(array $data, string $sign): bool
{
unset($data['sign'], $data['sign_type']);
$publicKey = openssl_pkey_get_public($this->config['public_key']);
@@ -172,7 +172,7 @@ class AlipayF2F
return (bool) openssl_verify(json_encode($data), base64_decode($sign), $publicKey, OPENSSL_ALGO_SHA256);
}
public function qrCharge($content)
public function qrCharge(array $content): array
{
$this->setMethod('alipay.trade.precreate');
$this->setContent($content);