diff --git a/application/plugins/view/weixinwebauthorization/admin/admin/index.html b/application/plugins/view/weixinwebauthorization/admin/admin/index.html index 64fa0cc158dc7d6a3b99581e4d78f1e672c28c2b..7c498a3b6f0bf1a240d5079e6e6a589ca4f99850 100755 --- a/application/plugins/view/weixinwebauthorization/admin/admin/index.html +++ b/application/plugins/view/weixinwebauthorization/admin/admin/index.html @@ -19,6 +19,16 @@ {{/if}} +
'; print_r($params); echo __MY_VIEW_URL__; } + /** + * 获取access_token + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-05-24 + * @desc description + * @param array $params [description] + */ + private function AccessToken($params = []) + { + + + } + + /** + * 远程获取access_token + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-05-24 + * @desc description + * @param array $params [description] + */ + private function RemoteAccessToken($params = []) + { + $ret = PluginsService::PluginsData('weixinwebauthorization'); + if($ret['code'] == 0) + { + // 参数校验 + if(empty($ret['data']['appid'])) + { + return DataReturn('appid未配置', -1); + } + if(empty($ret['data']['secret'])) + { + return DataReturn('secret未配置', -1); + } + if(empty($params['code'])) + { + return DataReturn('code授权码为空', -1); + } + + // 获取access_token + $url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$ret['data']['appid'].'&secret='.$ret['data']['secret'].'&code='.$params['code'].'&grant_type=authorization_code'; + $data = json_decode(file_get_contents($url), true); + + echo ''; + print_r($data);die; + + } else { + return DataReturn($ret['msg'], -1); + } + } + } ?> \ No newline at end of file