80], [['client_id'], 'string', 'max' => 64], [['member_id'], 'string', 'max' => 100], [['grant_type'], 'string', 'max' => 30], [['auth_key'], 'string', 'max' => 32], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'access_token' => '授权Token', 'merchant_id' => '商户id', 'auth_key' => '授权令牌', 'client_id' => '授权ID', 'member_id' => '用户ID', 'expires' => '有效期', 'scope' => '授权权限', 'grant_type' => '组别', 'status' => '状态', 'created_at' => '创建时间', 'updated_at' => '修改时间', ]; } /** * @return \yii\db\ActiveQuery */ public function getClient() { return $this->hasOne(Client::class, ['client_id' => 'client_id']); } /** * @return array */ public function behaviors() { $merchant_id = Yii::$app->services->merchant->getNotNullId(); return [ [ 'class' => TimestampBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], ], ], [ 'class' => BlameableBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['merchant_id'], ], 'value' => $merchant_id, ] ]; } }