UserSpread.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 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\user;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. use think\model;
  15. /**
  16. * Class UserSpread
  17. * @package app\model\user
  18. */
  19. class UserSpread extends BaseModel
  20. {
  21. use ModelTrait;
  22. /**
  23. * 数据表主键
  24. * @var string
  25. */
  26. protected $pk = 'id';
  27. /**
  28. * 模型名称
  29. * @var string
  30. */
  31. protected $name = 'user_spread';
  32. /**
  33. * 用户uid
  34. * @param Model $query
  35. * @param $value
  36. */
  37. public function searchUidAttr($query, $value)
  38. {
  39. if (is_array($value))
  40. $query->whereIn('uid', $value);
  41. else
  42. $query->where('uid', $value);
  43. }
  44. /**
  45. * 推广人uid
  46. * @param Model $query
  47. * @param $value
  48. */
  49. public function searchSpreadUidAttr($query, $value)
  50. {
  51. if (is_array($value))
  52. $query->whereIn('spread_uid', $value);
  53. else
  54. $query->where('spread_uid', $value);
  55. }
  56. }