From aaf5d749521fa9cedb17e9bdf40a3b4f46aae8f0 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Fri, 13 May 2022 09:36:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Model/CoinPayOrderModel.class.php | 2 +- Application/Common/Common/function.php | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Model/CoinPayOrderModel.class.php b/Application/Admin/Model/CoinPayOrderModel.class.php index b5bd300cb..ecfdbfcab 100644 --- a/Application/Admin/Model/CoinPayOrderModel.class.php +++ b/Application/Admin/Model/CoinPayOrderModel.class.php @@ -64,7 +64,7 @@ class CoinPayOrderModel extends Model{ ->where("id = '".$id."'") ->find(); if(!empty($info['voucher_img'])){ - $info['voucher_img'] = get_cover($info['voucher_img'])['path']; + $info['voucher_img'] = get_local_cover($info['voucher_img'])['path']; } return $info; diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index 2567e25e8..b97ca1f90 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -1053,6 +1053,36 @@ function get_cover($cover_id, $field = null, $root = 1, $flag = true) } +function get_local_cover($cover_id, $field = null, $root = 1, $flag = true) +{ + if (empty($cover_id)) { + return ""; + } + $picture = M('Picture')->where(array('status' => 1))->getById($cover_id); + if ($field == 'path') { + if (!empty($picture['url']) && get_tool_status('qiniu_storage') == 1) { + $picture['path'] = $picture['url']; + } else { + if ($picture['water'] && MODULE_NAME != 'Admin' && $flag && (C('watermark.status') == 1)) { + + $rp = realpath(dirname(__FILE__) . '/../../../'); + + if (is_file($rp . $picture['water'])) { + $field = 'water'; + } + } else { + if ($root == 1) { + $picture['path'] = __ROOT__ . $picture['path']; + } + + } + + } + + } + return empty($field) ? $picture : $picture[$field]; + +} function get_file($cover_id, $field = null) {