正在显示
1 个修改的文件
包含
6 行增加
和
3 行删除
@@ -234,12 +234,15 @@ class SalesmangoodsController extends WeChatBaseController{ | @@ -234,12 +234,15 @@ class SalesmangoodsController extends WeChatBaseController{ | ||
234 | * 上传图片 | 234 | * 上传图片 |
235 | */ | 235 | */ |
236 | public function savePicture(){ | 236 | public function savePicture(){ |
237 | - | ||
238 | - $access_token=$this->getAccessToken(); | 237 | + $options = config('wechat_config'); |
238 | + $app = new Application($options); | ||
239 | + $accessToken = $app->access_token; | ||
240 | + $access_token = $accessToken->getToken(); | ||
241 | +// $access_token=$this->getAccessToken(); | ||
239 | $filepath = $_POST['mediaId']; | 242 | $filepath = $_POST['mediaId']; |
240 | $str = 'uploads/'.date('YmdHis').time().rand('1000000','99999999').'.png'; | 243 | $str = 'uploads/'.date('YmdHis').time().rand('1000000','99999999').'.png'; |
241 | $targetName = $str; | 244 | $targetName = $str; |
242 | - $access_token = $access_token['accessToken']; | 245 | +// $access_token = $access_token['accessToken']; |
243 | $url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath"; | 246 | $url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath"; |
244 | // $file = file_get_contents("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath"); | 247 | // $file = file_get_contents("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath"); |
245 | $file = $this->httpGet($url); | 248 | $file = $this->httpGet($url); |
-
请 注册 或 登录 后发表评论