添加虚拟支付日志
This commit is contained in:
@@ -45,6 +45,7 @@ class VirtualPayService
|
|||||||
{
|
{
|
||||||
$offerId = (string)config('common.virtual_pay.offer_id');
|
$offerId = (string)config('common.virtual_pay.offer_id');
|
||||||
if ($offerId === '') {
|
if ($offerId === '') {
|
||||||
|
self::logMissingOfferId();
|
||||||
throw new \Exception('未配置虚拟支付 OfferID');
|
throw new \Exception('未配置虚拟支付 OfferID');
|
||||||
}
|
}
|
||||||
$buyQuantity = self::coinQuantity($amountYuan);
|
$buyQuantity = self::coinQuantity($amountYuan);
|
||||||
@@ -377,6 +378,48 @@ class VirtualPayService
|
|||||||
return (string)$sessionKey;
|
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
|
* @param float|string $amountYuan
|
||||||
* @return int
|
* @return int
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<view class="goods-detail-page {{caseView ? 'goods-detail-page--case' : ''}}">
|
<view class="goods-detail-page">
|
||||||
<view class="goods-head">
|
<view class="goods-head">
|
||||||
<view class="goods-gallery">
|
<view class="goods-gallery">
|
||||||
<t-swiper wx:if="{{details.images.length > 0}}" height="750rpx" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" list="{{details.images}}"></t-swiper>
|
<t-swiper wx:if="{{details.images.length > 0}}" height="750rpx" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" list="{{details.images}}"></t-swiper>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="goods-bottom-operation" wx:if="{{!caseView}}">
|
<view class="goods-bottom-operation">
|
||||||
<buy-bar soldout="{{soldout}}" isStock="{{isStock}}" buttonType="{{buttonType}}" bind:toBuyNow="buyItNow" />
|
<buy-bar soldout="{{soldout}}" isStock="{{isStock}}" buttonType="{{buttonType}}" bind:toBuyNow="buyItNow" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ page {
|
|||||||
background-color: var(--bg-page);
|
background-color: var(--bg-page);
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-detail-page--case {
|
|
||||||
padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-head {
|
.goods-head {
|
||||||
--td-swiper-radius: 0;
|
--td-swiper-radius: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Page({
|
|||||||
loadMoreStatus: 0,
|
loadMoreStatus: 0,
|
||||||
loading: true,
|
loading: true,
|
||||||
tabList: [],
|
tabList: [],
|
||||||
caseView: wx.getStorageSync('goodsCaseView') === true, // 案例展示:标题改为软件案例,不显示价格和购物车
|
caseView: wx.getStorageSync('goodsCaseView') === true, // 案例展示:标题改为软件案例,不显示购物车
|
||||||
},
|
},
|
||||||
|
|
||||||
handleFilterChange(e) {
|
handleFilterChange(e) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="category-goods-list" wx:if="{{goodsList.length}}">
|
<view class="category-goods-list" wx:if="{{goodsList.length}}">
|
||||||
<goods-list wr-class="wr-goods-list" goodsList="{{goodsList}}" show-buy="{{!caseView}}" show-price="{{!caseView}}" bind:click="gotoGoodsDetail" />
|
<goods-list wr-class="wr-goods-list" goodsList="{{goodsList}}" show-buy="{{!caseView}}" show-price="{{true}}" bind:click="gotoGoodsDetail" />
|
||||||
</view>
|
</view>
|
||||||
<view class="empty-wrap" wx:if="{{goodsList.length === 0 && hasLoaded}}">
|
<view class="empty-wrap" wx:if="{{goodsList.length === 0 && hasLoaded}}">
|
||||||
<t-empty t-class="empty-tips" size="240rpx" description="暂无相关产品" />
|
<t-empty t-class="empty-tips" size="240rpx" description="暂无相关产品" />
|
||||||
|
|||||||
Reference in New Issue
Block a user