Blame view

app-wx/models/User.php 1.13 KB
62d73041   xu   app-wx
1
2
3
4
5
<?php

namespace app\wx\models;

use Yii;
32926e46   xu   app-wx(v0.1.0 bui...
6
use yii\base\NotSupportedException;
3a892ee0   xu   app-wx(v0.1.0 bui...
7
use yii\web\IdentityInterface;
d4851694   曹明   1. 用户登录集成
8
use domain\user\models\User as UserModel;
62d73041   xu   app-wx
9
10
11
12
13

/**
 * Class User
 * @package app\wx\models
 */
3a892ee0   xu   app-wx(v0.1.0 bui...
14
class User extends UserModel implements IdentityInterface
62d73041   xu   app-wx
15
{
32926e46   xu   app-wx(v0.1.0 bui...
16
17
18
19
20
    /**
     * @param mixed $condition
     * @return static
     */
    static function findOne($condition)
62d73041   xu   app-wx
21
    {
32926e46   xu   app-wx(v0.1.0 bui...
22
        return parent::findOne($condition); // TODO: Change the autogenerated stub
62d73041   xu   app-wx
23
24
    }

32926e46   xu   app-wx(v0.1.0 bui...
25
    /** @inheritdoc */
3a892ee0   xu   app-wx(v0.1.0 bui...
26
27
28
29
30
    public static function findIdentity($id)
    {
        return static::findOne($id);
    }

32926e46   xu   app-wx(v0.1.0 bui...
31
    /** @inheritdoc */
3a892ee0   xu   app-wx(v0.1.0 bui...
32
33
    public static function findIdentityByAccessToken($token, $type = null)
    {
32926e46   xu   app-wx(v0.1.0 bui...
34
        throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
3a892ee0   xu   app-wx(v0.1.0 bui...
35
36
    }

32926e46   xu   app-wx(v0.1.0 bui...
37
    /** @inheritdoc */
3a892ee0   xu   app-wx(v0.1.0 bui...
38
39
    public function getId()
    {
32926e46   xu   app-wx(v0.1.0 bui...
40
        return $this->getAttribute('id');
3a892ee0   xu   app-wx(v0.1.0 bui...
41
42
    }

32926e46   xu   app-wx(v0.1.0 bui...
43
    /** @inheritdoc */
3a892ee0   xu   app-wx(v0.1.0 bui...
44
45
    public function getAuthKey()
    {
32926e46   xu   app-wx(v0.1.0 bui...
46
        return $this->getAttribute('auth_key');
3a892ee0   xu   app-wx(v0.1.0 bui...
47
48
    }

32926e46   xu   app-wx(v0.1.0 bui...
49
    /** @inheritdoc */
3a892ee0   xu   app-wx(v0.1.0 bui...
50
51
    public function validateAuthKey($authKey)
    {
32926e46   xu   app-wx(v0.1.0 bui...
52
        return $this->getAttribute('auth_key') == $authKey;
3a892ee0   xu   app-wx(v0.1.0 bui...
53
    }
62d73041   xu   app-wx
54
}