12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- $params = array_merge(
- require __DIR__ . '/../../common/config/params.php',
- require __DIR__ . '/../../common/config/params-local.php',
- require __DIR__ . '/params.php',
- require __DIR__ . '/params-local.php'
- );
- return [
- 'id' => 'app-api',
- 'basePath' => dirname(__DIR__),
- 'bootstrap' => ['log'],
- 'modules' => [
- 'v1' => [
- 'class' => 'api\modules\v1\Module'
- ]
- ],
- 'controllerNamespace' => 'api\controllers',
- 'components' => [
- 'user' => [
- 'identityClass' => 'common\models\User',
- 'enableAutoLogin' => false, // API change to false
- 'enableSession' => false, // API ++
- 'loginUrl' => null // API ++
- ],
- 'log' => [
- 'traceLevel' => YII_DEBUG ? 3 : 0,
- 'targets' => [
- [
- 'class' => 'yii\log\FileTarget',
- 'levels' => ['error', 'warning'],
- ],
- ],
- ],
- 'request' => [
- 'class' => '\yii\web\Request',
- 'enableCookieValidation' => false,
- 'parsers' => [
- 'application/json' => 'yii\web\JsonParser',
- ],
- 'cookieValidationKey' => 'O1d232trde1xww-M97_7QvwPo-5QGdkLMp#@#@',
- ],
- 'errorHandler' => [
- 'errorAction' => 'site/error',
- ],
- 'urlManager' => [
- 'class' => 'yii\web\UrlManager',
- 'enablePrettyUrl' => true,
- 'enableStrictParsing' => true,
- 'showScriptName' => false,
- 'rules' => [
- '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
- '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
- '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
- // '' => 'site/index',
- // ['class' => 'yii\rest\UrlRule', 'controller' => 'customer/api',
- // 'pluralize' => false,
- // ],
- // # 定义方法: public function actionSearch($id); <id> 就是search方法传入的参数
- // # http://10.10.10.252:599/v1/wishorder/2015-08-11+12:12:12/2015-09-11+12:12:12?access-token=pBJi3hyFsLsTuvUM9paFpWjYRatn3qwS
- // # 分页:http://10.10.10.252:599/v1/wishorder/2015-08-11+12:12:12/2015-09-11+12:12:12?page=2&access-token=pBJi3hyFsLsTuvUM9paFpWjYRatn3qwS
- // 'GET v1/wishorder/<begin_datetime>/<end_datetime>' => 'v1/wishorder/viewbydate',
- // 'GET v1/ebayorder/<begin_datetime>/<end_datetime>' => 'v1/ebayorder/viewbydate',
- ]
- ],
- 'db' => require __DIR__ . '/../../common/config/db.php',
- 'redis' => require __DIR__ . '/../../common/config/redis.php',
- ],
- 'params' => $params,
- ];
|