/** * @param $recordId * @param $type * @return bool */ private function _checkVote($recordId, $type) { $where = ['record_id' => $recordId, 'type' => $type]; if (\Yii::$app->user->isGuest) { $where['user_hash'] = Utils::userHash(\Yii::$app->request->userIP); } else { $where['user_id'] = \Yii::$app->user->id; } if (Complaint::find()->where($where)->count()) { return true; } return false; }
/** * @inheritdoc */ protected function getValue($event) { return Utils::userHash(\Yii::$app->request->userIP); }