| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace mobile\controllers;
- use biz\user\services\UserService;
- use common\components\jwt;
- use common\components\token;
- use common\components\tree;
- use Yii;
- use yii\db\Exception;
- use yii\web\Controller;
- class MainController extends PublicController
- {
-
- public $enableCsrfValidation = false;
- public function actionIndex()
- {
- $host = Yii::$app->request->getHostInfo();
- $fullUrl = Yii::$app->request->url;
- $token = '';
- if(strpos($fullUrl, 'token')){
- $parse = parse_url($fullUrl);
- if (isset($parse['query'])) {
- parse_str($parse['query'], $queryArray);
- if (isset($queryArray['token']) && !empty($queryArray['token'])) {
- $token = $queryArray['token'];
- }
- }
- }
- $host = 'http://mobile.huaml.com';
- return $this->renderPartial('index', ['host' => $host, 'token' => $token]);
- }
- public function actionJwt()
- {
- $arr = array(
- 1 => array('id'=>'1','parentid'=>0,'name'=>'一级栏目一'),
- 2 => array('id'=>'2','parentid'=>0,'name'=>'一级栏目二'),
- 3 => array('id'=>'3','parentid'=>1,'name'=>'二级栏目一'),
- 4 => array('id'=>'4','parentid'=>1,'name'=>'二级栏目二'),
- 5 => array('id'=>'5','parentid'=>2,'name'=>'二级栏目三'),
- 6 => array('id'=>'6','parentid'=>3,'name'=>'三级栏目一'),
- 7 => array('id'=>'7','parentid'=>3,'name'=>'三级栏目二')
- );
-
-
-
- $data = array(
- array(
- 'id'=>1,
- 'name'=>'book',
- 'parent_id'=>0
- ),
- array(
- 'id'=>2,
- 'name'=>'music',
- 'parent_id'=>0
- ),
- array(
- 'id'=>3,
- 'name'=>'book1',
- 'parent_id'=>1
- ),
- array(
- 'id'=>4,
- 'name'=>'book2',
- 'parent_id'=>3
- )
- );
-
- $r = tree::makeTree($data);
- echo '<pre>';
- print_r($r);die;
- // echo jwt::create(1,12536630);
- }
-
- }
|