共需要修改 4 个文件
1️⃣ 文件:zibll/inc/options/admin-options.php
修改位置 :约第 8113-8135 行
修改内容 :取消积分抵扣设置的注释
修改前 :
/** //暂未启用
array(
'title' => '积分抵扣',
'subtitle' => __('允许使用积分抵扣现金', 'zib_language'),
),
...
*/
修改后 :
array(
'title' => '积分抵扣',
'subtitle' => __('允许使用积分抵扣现金', 'zib_language'),
),
2️⃣ 文件:zibll/zibpay/functions/zibpay-func.php
修改位置 A:第 538-539 行
修改内容 :移除积分抵扣UI显示的条件
修改前 :
if (!$is_initiate_pay && zibpay_is_allow_points_deduction($pay_type)) {
$points_deduction_rate = _pz('points_deduction_rate', 30);
修改后 :
if (!$is_initiate_pay) {
$points_deduction_rate = _pz('points_deduction_rate', 30);
修改位置 B:第 580-594 行
修改内容 :删除 return false; ,启用积分抵扣函数
修改前 :
function zibpay_is_allow_points_deduction($pay_type)
{
//暂未启用
return false;
if (!_pz('points_s') || !_pz('points_deduction_s')) {
return false;
}
...
}
修改后 :
function zibpay_is_allow_points_deduction($pay_type)
{
if (!_pz('points_s') || !_pz('points_deduction_s')) {
return false;
}
}
3️⃣ 文件:zibll/zibpay/functions/zibpay-order.php
修改位置 :第 478-479 行
修改内容 :移除条件 + 汇率改回读取后台设置
修改前 :
if ($user_id && !empty($post_data['points_deduction']) && zibpay_is_allow_points_deduction($order_type)) {
$points_deduction_rate = 30;
修改后 :
if ($user_id && !empty($post_data['points_deduction'])) {
$points_deduction_rate = _pz('points_deduction_rate', 30);
4️⃣ 文件:zibll/zibpay/functions/zibpay-points.php
修改位置 : zibpay_payment_order_points 函数末尾(最后一个 } 之前)
修改内容 :新增积分抵扣扣除逻辑
在函数末尾添加 :
// ============ 新增:积分抵扣扣除逻辑 ============
$order_meta = ZibPay::get_meta($pay_order->id, 'order_data');
if (!empty($order_meta['prices']['points_deduction'])) {
$deduct_amount = (float) $order_meta['prices']['points_deduction'];
$rate = _pz('points_deduction_rate', 30);
$points_used = (int) round($deduct_amount * $rate);
$data = array(
'order_num' => $pay_order->order_num,
'value' => -$points_used,
'type' => '积分抵扣',
'desc' => "购买抵扣 {$deduct_amount} 元",
);
zibpay_update_user_points($pay_order->user_id, $data);
}
// ============ 新增结束 ============
后台设置
修改完成后,
子比主题设置 → 付费设置 → 积分抵扣
子比主题设置 → 付费设置 → 积分抵扣汇率(默认30)
⚠️ 重要提醒
修改了核心文件,主题升级后会被覆盖,请备份
修改完成后,清除浏览器缓存(Ctrl+Shift+R 强制刷新)
这样就完整了!🎉





没有评论内容