From 44253a7fc988eb61c0ad8bb26ffc317ca67ea5c1 Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 25 May 2017 10:55:37 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6md5=E5=90=8D=E7=A7=B0=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/controller/Review.php | 2 +- extend/service/PayService.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/application/wechat/controller/Review.php b/application/wechat/controller/Review.php index e0714ce7f..3c85a5ecc 100644 --- a/application/wechat/controller/Review.php +++ b/application/wechat/controller/Review.php @@ -51,7 +51,7 @@ class Review extends Controller { */ public function img() { $url = $this->request->get('url', ''); - $filename = 'wechat/tmp/' . join('/', str_split(md5($url), 16)) . '.jpg'; + $filename = FileService::getFileName($url, 'jpg', 'tmp/'); if (false === ($img = FileService::getFileUrl($filename))) { $info = FileService::save($filename, file_get_contents($url)); $img = (is_array($info) && isset($info['url'])) ? $info['url'] : $url; diff --git a/extend/service/PayService.php b/extend/service/PayService.php index ba1356d96..8491505fc 100644 --- a/extend/service/PayService.php +++ b/extend/service/PayService.php @@ -52,10 +52,9 @@ class PayService { if ($prepayid === false) { return false; } - $filename = 'wechat/qrc/' . join('/', str_split(md5($prepayid), 16)) . '.png'; + $filename = FileService::getFileName($prepayid, 'png', 'qrc/'); if (!FileService::hasFile($filename, 'local')) { - $qrCode = new QrCode(); - $qrCode->setText($prepayid); + $qrCode = new QrCode($prepayid); if (null === FileService::save($filename, $qrCode->get(), 'local')) { return false; }