Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 protected function getValue($event)
 {
     return Utils::userHash(\Yii::$app->request->userIP);
 }