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; }