<?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-frontend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'frontend\controllers',
    'language' => 'zh-CN',
    'modules' => [
        'cp' => [
            'class' => 'frontend\modules\cp\Module',
        ],
    ],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
        ],
        'user' => [
            'identityClass' => 'frontend\models\AdminIdentity',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
            'loginUrl' => ['account/login'], // 不加模块名
        ],
        'session' => [
            // this is the name of the session cookie used for login on the frontend
            'name' => 'advanced-frontend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning', 'info'],
                ],
            ],
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                'index.html' => '/',
                'cp/login' => 'cp/account/login',
                'api/lottoRecord/saveLottoRecord' => 'api/save-lotto-record',
                'api/lottoSms/smsCode' => 'api/lotto-send-sms-code',
                'api/lottoSms/verifyCode' => 'api/lotto-verify-sms-code',
                'api/lottoSms/saveLottery' => 'api/lotto-save-lottery',
            ],
        ],
    ],
    'params' => $params,
];
