shish 6 tahun lalu
induk
melakukan
3563380fba

+ 3 - 1
app/mobile/controllers/MainController.php

@@ -21,7 +21,9 @@ class MainController extends PublicController
 	public function actionIndex()
 	{
 		$host = Yii::$app->request->getHostInfo();
-		return $this->renderPartial('index', ['host' => $host]);
+		$fullUrl = Yii::$app->request->url;
+		$token = strpos($fullUrl,'token') === false ? '' : 'hasToken';
+		return $this->renderPartial('index', ['host' => $host,'token'=>$token]);
 	}
 	
 	public function actionJwt()

+ 2 - 1
app/mobile/views/main/index.php

@@ -8,8 +8,9 @@ http://m.huaml.com/#main/index?account=12358&shopId=15680
 其中 #main/index 可以自行定义 ,其它为固定格式,不能改变。
 <script>
     var code = encodeURIComponent('#main/index?account=12358&shopId=15680');
+    <?php if(empty($token)){ ?>
     window.location='<?= $host ?>/auth/prepare?suffixUrl='+code+'&authScope=snsapi_base&account=12358';
-
+    <?php } ?>
     /*
     function StandardPost(url,args){
         var form = $("<form method='post'></form>"),