diff --git a/backend/application/common/service/VirtualPayService.php b/backend/application/common/service/VirtualPayService.php index b3df495..e080730 100644 --- a/backend/application/common/service/VirtualPayService.php +++ b/backend/application/common/service/VirtualPayService.php @@ -45,6 +45,7 @@ class VirtualPayService { $offerId = (string)config('common.virtual_pay.offer_id'); if ($offerId === '') { + self::logMissingOfferId(); throw new \Exception('未配置虚拟支付 OfferID'); } $buyQuantity = self::coinQuantity($amountYuan); @@ -377,6 +378,48 @@ class VirtualPayService return (string)$sessionKey; } + /** + * OfferID 为空时记下 .env 有没有被读到,不记录密钥内容 + */ + private static function logMissingOfferId() + { + $envFile = (defined('ROOT_PATH') ? ROOT_PATH : '') . '.env'; + $exists = $envFile !== '.env' && is_file($envFile); + $section = ''; + $found = null; + if ($exists) { + $lines = file($envFile, FILE_IGNORE_NEW_LINES); + if (is_array($lines)) { + foreach ($lines as $line) { + $trim = trim($line); + if ($trim === '' || $trim[0] === ';' || $trim[0] === '#') { + continue; + } + if (preg_match('/^\[(.+)\]$/', $trim, $sectionMatch)) { + $section = $sectionMatch[1]; + continue; + } + if (preg_match('/^vp_offer_id\s*=\s*(.*)$/', $trim, $valueMatch)) { + $value = trim($valueMatch[1], " \t\"'"); + $found = [ + 'section' => $section, + 'len' => strlen($value), + ]; + } + } + } + } + $fromEnv = getenv('PHP_WECHAT_VP_OFFER_ID'); + $virtualPay = config('common.virtual_pay'); + Log::error('虚拟支付 OfferID 为空 ' . json_encode([ + 'env_file' => $envFile, + 'env_exists' => $exists, + 'file_item' => $found ?: 'missing', + 'getenv' => $fromEnv === false ? 'false' : ('len:' . strlen(trim((string)$fromEnv))), + 'config_keys' => is_array($virtualPay) ? array_keys($virtualPay) : gettype($virtualPay), + ], JSON_UNESCAPED_UNICODE)); + } + /** * @param float|string $amountYuan * @return int diff --git a/frontend/miniapp/pages/goods/details/index.wxml b/frontend/miniapp/pages/goods/details/index.wxml index e6f4568..b844e00 100644 --- a/frontend/miniapp/pages/goods/details/index.wxml +++ b/frontend/miniapp/pages/goods/details/index.wxml @@ -1,4 +1,4 @@ - + @@ -97,7 +97,7 @@ - + diff --git a/frontend/miniapp/pages/goods/details/index.wxss b/frontend/miniapp/pages/goods/details/index.wxss index 30a845b..aae4479 100644 --- a/frontend/miniapp/pages/goods/details/index.wxss +++ b/frontend/miniapp/pages/goods/details/index.wxss @@ -11,10 +11,6 @@ page { background-color: var(--bg-page); } -.goods-detail-page--case { - padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx); -} - .goods-head { --td-swiper-radius: 0; } diff --git a/frontend/miniapp/pages/goods/list/index.js b/frontend/miniapp/pages/goods/list/index.js index 0d2bfc9..fe8956f 100644 --- a/frontend/miniapp/pages/goods/list/index.js +++ b/frontend/miniapp/pages/goods/list/index.js @@ -28,7 +28,7 @@ Page({ loadMoreStatus: 0, loading: true, tabList: [], - caseView: wx.getStorageSync('goodsCaseView') === true, // 案例展示:标题改为软件案例,不显示价格和购物车 + caseView: wx.getStorageSync('goodsCaseView') === true, // 案例展示:标题改为软件案例,不显示购物车 }, handleFilterChange(e) { diff --git a/frontend/miniapp/pages/goods/list/index.wxml b/frontend/miniapp/pages/goods/list/index.wxml index ed9f3de..c83c331 100644 --- a/frontend/miniapp/pages/goods/list/index.wxml +++ b/frontend/miniapp/pages/goods/list/index.wxml @@ -29,7 +29,7 @@ - +