|
|
@@ -17,18 +17,18 @@ use common\components\weixinUtil;
|
|
|
*/
|
|
|
class AuthController extends PublicController
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
public $enableCsrfValidation = false;
|
|
|
-
|
|
|
+
|
|
|
//准备授权 shish 2019.11.19
|
|
|
public function actionPrepare()
|
|
|
{
|
|
|
- $post = Yii::$app->request->post();print_r($post);die;
|
|
|
- $suffixUrl = isset($post['suffixUrl']) && !empty($post['suffixUrl']) ? $post['suffixUrl'] : '';
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $suffixUrl = isset($get['suffixUrl']) && !empty($get['suffixUrl']) ? $get['suffixUrl'] : '';
|
|
|
if (empty($suffixUrl)) {
|
|
|
util::fail('没有网址');
|
|
|
}
|
|
|
- $account = isset($post['account']) ? $post['account'] : 0;
|
|
|
+ $account = isset($get['account']) ? $get['account'] : 0;
|
|
|
$merchant = MerchantService::getById($account);
|
|
|
if (empty($merchant)) {
|
|
|
util::fail('商家无效');
|
|
|
@@ -40,7 +40,7 @@ class AuthController extends PublicController
|
|
|
* 3.其它情况需要获取用户完整信息的,使用snsapi_userinfo让用户授权获取信息即可
|
|
|
* 4.snsapi_base静默方式使用的场景更多,所以参数authScope默认使用snsapi_base
|
|
|
*/
|
|
|
- $authScope = isset($post['authScope']) ? $post['authScope'] : 'snsapi_base';
|
|
|
+ $authScope = isset($get['authScope']) ? $get['authScope'] : 'snsapi_base';
|
|
|
$host = Yii::$app->request->getHostInfo();
|
|
|
$url = $host . '/auth/get-user-info?suffixUrl=' . $suffixUrl . '&authScope=' . $authScope;
|
|
|
weixinUtil::getToken($url, $merchant, $authScope);
|
|
|
@@ -58,8 +58,10 @@ class AuthController extends PublicController
|
|
|
if (isset($get['state']) && $get['state'] == 'authdeny') {
|
|
|
util::fail('auth fail');
|
|
|
}
|
|
|
+ print_r($get);die;
|
|
|
$account = '';
|
|
|
$suffixUrlEncode = $get['suffixUrl'];
|
|
|
+ //这里要换成根据前端的数据来转!!!! todo
|
|
|
$suffixUrl = stringUtil::urlSafeBase64Decode($suffixUrlEncode);
|
|
|
$parse = parse_url($suffixUrl);
|
|
|
if (isset($parse['query'])) {
|