From 7fddfda35ec8d2b0ee54a0c2ebf53dc8e83bc858 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 10 Jul 2017 12:50:17 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E5=A4=8D=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=9B=BE=E6=96=87=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/WechatService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extend/service/WechatService.php b/extend/service/WechatService.php index 8878df719..3ca7e58a6 100644 --- a/extend/service/WechatService.php +++ b/extend/service/WechatService.php @@ -92,7 +92,7 @@ class WechatService # 检测文件上否已经上传过了 $wechat = &load_wechat('media'); # 检查文件URL是否已经上传为永久素材 - $map = ['md5' => ($md5 = md5($local_url)), 'appid' => $wechat->appid]; + $map = ['md5' => md5($local_url), 'appid' => $wechat->appid]; if (($img = Db::name('WechatNewsMedia')->where($map)->find()) && isset($img['media_id'])) { return $img['media_id']; } @@ -102,7 +102,7 @@ class WechatService if (!empty($upload) && isset($upload['file']) && file_exists($upload['file'])) { # 上传图片到微信服务器 if (false !== ($result = $wechat->uploadForeverMedia(['media' => "@{$upload['file']}"], $type, $is_video, $video_info))) { - $data = ['md5' => $md5, 'type' => $type, 'appid' => $wechat->appid, 'media_id' => $result['media_id'], 'local_url' => $local_url]; + $data = ['md5' => $map['md5'], 'type' => $type, 'appid' => $wechat->appid, 'media_id' => $result['media_id'], 'local_url' => $local_url]; isset($result['url']) && $data['media_url'] = $result['url']; Db::name('WechatNewsMedia')->insert($data); return $data['media_id'];