WechatQrcodeRecord.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\wechat;
  12. use app\model\user\User;
  13. use crmeb\basic\BaseModel;
  14. use crmeb\traits\ModelTrait;
  15. /**
  16. * 关键词
  17. * Class WechatReply
  18. * @package app\model\wechat
  19. */
  20. class WechatQrcodeRecord extends BaseModel
  21. {
  22. use ModelTrait;
  23. /**
  24. * 数据表主键
  25. * @var string
  26. */
  27. protected $pk = 'id';
  28. /**
  29. * 模型名称
  30. * @var string
  31. */
  32. protected $name = 'wechat_qrcode_record';
  33. /**
  34. * 关联user
  35. * @return \think\model\relation\HasOne
  36. */
  37. public function user()
  38. {
  39. return $this->hasOne(User::class, 'uid', 'uid');
  40. }
  41. public function searchQidAttr($query, $value)
  42. {
  43. if ($value) $query->where('qid', $value);
  44. }
  45. public function searchIsFollowAttr($query, $value)
  46. {
  47. if ($value !== '') $query->where('is_follow', $value);
  48. }
  49. }