From eb3bb08ccff441c9887974d4ad778e2f7e86a0e0 Mon Sep 17 00:00:00 2001 From: Anyon Date: Sat, 24 Mar 2018 14:04:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E8=B0=83=E6=95=B4=E5=85=AC?= =?UTF-8?q?=E4=BC=97=E5=8F=B7=E6=B6=88=E6=81=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/service/MediaService.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/wechat/service/MediaService.php b/application/wechat/service/MediaService.php index bdf8b3734..2a8a452da 100644 --- a/application/wechat/service/MediaService.php +++ b/application/wechat/service/MediaService.php @@ -14,6 +14,7 @@ namespace app\wechat\service; +use service\DataService; use service\FileService; use service\WechatService; use think\Db; @@ -71,7 +72,7 @@ class MediaService WechatService::wechat()->rmFile($local_url); } $data = ['local_url' => $local_url, 'media_url' => $info['url'], 'md5' => $map['md5']]; - Db::name('WechatNewsImage')->insert($data); + DataService::save('WechatNewsImage', $data, 'md5', ['type' => 'image']); return $info['url']; } @@ -98,7 +99,7 @@ class MediaService } $data = ['md5' => $map['md5'], 'type' => $type, 'appid' => $map['appid'], 'media_id' => $result['media_id'], 'local_url' => $local_url]; isset($result['url']) && $data['media_url'] = $result['url']; - Db::name('WechatNewsMedia')->insert($data); + DataService::save('WechatNewsMedia', $data, 'md5', ['appid' => $map['appid'], 'type' => $type]); return $data['media_id']; }