作者 王晓刚
1 个管道 的构建 通过 耗费 0 秒

合并分支 'wangxiaogang' 到 'master'

上传图片



查看合并请求 !134
@@ -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);