| | |
| | | header("Access-Control-Allow-Origin:*"); |
| | | class Activity extends Api |
| | | { |
| | | protected $noNeedLogin = ['recordItemClick','fqb_plat_cate','run_countRecruitAct','test']; |
| | | protected $noNeedLogin = ['UpWxImg','recordItemClick','fqb_plat_cate','run_countRecruitAct','test']; |
| | | protected $noNeedRight = '*'; |
| | | /** |
| | | * 获取疯抢榜 |
| | |
| | | $this->success('成功',['success'=>true]); |
| | | } |
| | | |
| | | public function UpWxImg() |
| | | { |
| | | $token=request()->param('token'); |
| | | $picPath=request()->param('picPath'); |
| | | //上传永久素材 |
| | | $url="https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=".$token."&type=image"; |
| | | //2、同步到微信服务器 |
| | | if(class_exists('\CURLFile')){ //7.0 |
| | | $data = ['media' => new \CURLFile($picPath)]; |
| | | }else{ //5.6以及5.6以下 |
| | | $data = array('media' => '@'.$picPath); |
| | | } |
| | | |
| | | $ch = curl_init(); |
| | | curl_setopt($ch, CURLOPT_URL, $url); |
| | | curl_setopt($ch, CURLOPT_RETURNTRANSFER , true); |
| | | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false); |
| | | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , false); |
| | | curl_setopt($ch, CURLOPT_POST, 1); |
| | | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
| | | $res = curl_exec($ch); |
| | | curl_close($ch); |
| | | $wxrs_id_card=json_decode($res,true); |
| | | $id_card =$wxrs_id_card['media_id']; //得到media_id |
| | | } |
| | | |
| | | |
| | | } |