RefreshToken.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace common\models\oauth2;
  3. use common\behaviors\MerchantBehavior;
  4. /**
  5. * This is the model class for table "{{%oauth2_refresh_token}}".
  6. *
  7. * @property string $refresh_token
  8. * @property int|null $merchant_id 商户id
  9. * @property string $client_id 授权ID
  10. * @property string|null $member_id 用户ID
  11. * @property string $expires 有效期
  12. * @property string|null $scope 授权权限
  13. * @property string|null $grant_type 组别
  14. * @property int|null $status 状态[-1:删除;0:禁用;1启用]
  15. * @property int|null $created_at 创建时间
  16. * @property int|null $updated_at 修改时间
  17. */
  18. class RefreshToken extends \common\models\base\BaseModel
  19. {
  20. use MerchantBehavior;
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public static function tableName()
  25. {
  26. return '{{%oauth2_refresh_token}}';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function rules()
  32. {
  33. return [
  34. [['merchant_id', 'status', 'created_at', 'updated_at'], 'integer'],
  35. [['refresh_token', 'client_id', 'expires'], 'required'],
  36. [['expires', 'scope'], 'safe'],
  37. [['refresh_token'], 'string', 'max' => 80],
  38. [['client_id'], 'string', 'max' => 64],
  39. [['member_id'], 'string', 'max' => 100],
  40. [['grant_type'], 'string', 'max' => 30],
  41. ];
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'refresh_token' => 'Refresh Token',
  50. 'merchant_id' => '商户id',
  51. 'client_id' => '授权ID',
  52. 'member_id' => '用户ID',
  53. 'expires' => '有效期',
  54. 'scope' => '授权权限',
  55. 'grant_type' => '组别',
  56. 'status' => '状态',
  57. 'created_at' => '创建时间',
  58. 'updated_at' => '修改时间',
  59. ];
  60. }
  61. /**
  62. * @return \yii\db\ActiveQuery
  63. */
  64. public function getClient()
  65. {
  66. return $this->hasOne(Client::class, ['client_id' => 'client_id']);
  67. }
  68. }
粤ICP备19079148号