2018-10-26 14:11:03 2082次浏览 2条回答 0 悬赏 15 金钱

登录成功后的用户信息是存在的,但是做点击菜单或任何操作identity为null

补充于 2018-10-26 14:13

这个问题本地没发生,只发生在测试和生产环境,backend没问题,frontend有问题,

  • 回答于 2018-10-26 16:21 举报

    你得把common和frontend的mian.php配置贴出来才好排查,还有backend和frontend一般不同域名,backend登录在frontend是无效的

    2 条回复
    回复于 2018-10-26 17:38 回复

    'vendorPath' => dirname(dirname(DIR)) . '/vendor',

    'timeZone' => 'Asia/Shanghai',
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=localhost;dbname=kf_cem',
            'username' => 'cem',
            'password' => 'cem!@SY2018',
            'charset' => 'utf8'
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'image' => [
            'class' => 'yii\image\ImageDriver',
            'driver' => 'GD',  //GD or Imagick
        ],
        'session' => [
            'timeout' => 3600,
        ],
    	'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error','warning','info'],
                ],
            ],
        ],
    

    没什么特别的阿,backend和frontend登录是分开的

    回复于 2018-10-26 17:40 回复
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'frontend\controllers',
    'defaultRoute' => 'site',
    'modules' => [
        'wap'=>[
            'class'=>'app\modules\wap\WapModule',
        ],
        'agent'=>[
            'class'=>'app\modules\agent\AgentModule',
        ],
        'salesClerk'=>[
            'class'=>'app\modules\salesClerk\SalesClerkModule'
        ]
    ],
    'components' => [
        'user' => [
            'identityClass' => 'common\models\PayUser',
            'enableAutoLogin' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error','warning','info'],
                    'categories' => ['pay'],
                    'logFile' => '@app/runtime/logs/pay.log',
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],
        'request' => [
            'cookieValidationKey' => 'fill in a secret key here',
        ],
    ],
    
  • 回答于 2018-10-30 16:49 举报

    瞅瞅 测试环境 登录成功后的操作 请求request是否携带了 _identity cookie

您需要登录后才可以回答。登录 | 立即注册
一粒坏汤屎
试用期

一粒坏汤屎

注册时间:2018-10-24
最后登录:2019-01-25
在线时长:2小时37分
  • 粉丝0
  • 金钱5
  • 威望0
  • 积分25

热门问题