浏览代码

[更新]修改文件md5名称机制

Anyon 8 年之前
父节点
当前提交
44253a7fc9
共有 2 个文件被更改,包括 3 次插入4 次删除
  1. 1 1
      application/wechat/controller/Review.php
  2. 2 3
      extend/service/PayService.php

+ 1 - 1
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;

+ 2 - 3
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;
             }