WechatQrcodeRecord.php 792 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\model\wechat;
  3. use app\model\user\User;
  4. use crmeb\basic\BaseModel;
  5. use crmeb\traits\ModelTrait;
  6. class WechatQrcodeRecord extends BaseModel
  7. {
  8. use ModelTrait;
  9. /**
  10. * 数据表主键
  11. * @var string
  12. */
  13. protected $pk = 'id';
  14. /**
  15. * 模型名称
  16. * @var string
  17. */
  18. protected $name = 'wechat_qrcode_record';
  19. /**
  20. * 关联user
  21. * @return \think\model\relation\HasOne
  22. */
  23. public function user()
  24. {
  25. return $this->hasOne(User::class, 'uid', 'uid');
  26. }
  27. public function searchQidAttr($query, $value)
  28. {
  29. if ($value) $query->where('qid', $value);
  30. }
  31. public function searchIsFollowAttr($query, $value)
  32. {
  33. if ($value !== '') $query->where('is_follow', $value);
  34. }
  35. }