正在显示
1 个修改的文件
包含
2 行增加
和
1 行删除
| @@ -43,13 +43,14 @@ class Wechat extends Api | @@ -43,13 +43,14 @@ class Wechat extends Api | ||
| 43 | */ | 43 | */ |
| 44 | public function test_code(){ | 44 | public function test_code(){ |
| 45 | $code = request()->param('code'); | 45 | $code = request()->param('code'); |
| 46 | + | ||
| 46 | if(empty($code)){ | 47 | if(empty($code)){ |
| 47 | //跳转官方 | 48 | //跳转官方 |
| 48 | $APPID = config('site.appid'); | 49 | $APPID = config('site.appid'); |
| 49 | $REDIRECT_URI = 'https://coupon.xp.yn.cn/index.php/api/v1/Wechat/test_code'; | 50 | $REDIRECT_URI = 'https://coupon.xp.yn.cn/index.php/api/v1/Wechat/test_code'; |
| 50 | $SCOPE = 'snsapi_base'; | 51 | $SCOPE = 'snsapi_base'; |
| 51 | $redirect = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$APPID&redirect_uri=$REDIRECT_URI&response_type=code&scope=$SCOPE&state=STATE#wechat_redirect"; | 52 | $redirect = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$APPID&redirect_uri=$REDIRECT_URI&response_type=code&scope=$SCOPE&state=STATE#wechat_redirect"; |
| 52 | - header("url:".$redirect); | 53 | + header("Location:".$redirect); |
| 53 | }else{ | 54 | }else{ |
| 54 | //解析code | 55 | //解析code |
| 55 | $app = WehcatModule::getInstance()->initWechat(); | 56 | $app = WehcatModule::getInstance()->initWechat(); |
-
请 注册 或 登录 后发表评论