HouseClickrecord.php 881 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/3/4
  6. * Time: 上午9:25
  7. */
  8. namespace common\models;
  9. use yii\behaviors\TimestampBehavior;
  10. use yii\db\ActiveRecord;
  11. class HouseClickrecord extends ActiveRecord
  12. {
  13. public function behaviors()
  14. {
  15. return [
  16. [
  17. 'class' => TimestampBehavior::className(),
  18. 'attributes' => [
  19. # 创建之前
  20. ActiveRecord::EVENT_BEFORE_INSERT => ['create_at'],
  21. # 修改之前
  22. //ActiveRecord::EVENT_BEFORE_UPDATE => ['update_at']
  23. ],
  24. #设置默认值
  25. 'value' => $_SERVER['REQUEST_TIME']
  26. ]
  27. ];
  28. }
  29. public function FingByIp($ip,$hid)
  30. {
  31. return self::find()->andWhere(['ip'=>$ip])->andWhere(['hid'=>$hid])->exists();
  32. }
  33. }