|
@@ -1,5 +1,6 @@
|
|
|
<?php
|
|
|
|
|
|
+use Carbon\Carbon;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Arr;
|
|
|
use Illuminate\Support\Facades\Session;
|
|
@@ -344,11 +345,17 @@ if (!function_exists('toStoragePath')) {
|
|
|
|
|
|
/*
|
|
|
* 将UTC时间转换为当前浏览器时区时间
|
|
|
+ * 空,返回当前浏览器时间
|
|
|
*/
|
|
|
if (!function_exists('utcToLocalTime')) {
|
|
|
- function utcToLocalTime($utcTime) {
|
|
|
+ function utcToLocalTime($utcTime = '') {
|
|
|
$timeZoneName = Session::get('timeZoneName') ?? 'UTC';
|
|
|
|
|
|
+ if (empty($utcTime)) {
|
|
|
+ return Carbon::now($timeZoneName)->format('Y-m-d H:i:s');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 创建 UTC 时区对象
|
|
|
$utcTimezone = new DateTimeZone('UTC');
|
|
|
|
|
@@ -369,9 +376,15 @@ if (!function_exists('utcToLocalTime')) {
|
|
|
|
|
|
/*
|
|
|
* 将当前浏览器时区时间转换为UTC时间
|
|
|
+ * 空返回当前的UTC时间
|
|
|
*/
|
|
|
if (!function_exists('localTimeToUtc')) {
|
|
|
- function localTimeToUtc($inputTime) {
|
|
|
+ function localTimeToUtc($inputTime = '') {
|
|
|
+
|
|
|
+ if (empty($inputTime)) {
|
|
|
+ return Carbon::now('UTC')->format('Y-m-d H:i:s');
|
|
|
+ }
|
|
|
+
|
|
|
$timeZoneName = Session::get('timeZoneName') ?? 'UTC';
|
|
|
|
|
|
// 创建分销商时区对象
|