UserMoney.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. * 用户余额变动
  17. */
  18. class UserMoney extends BaseModel
  19. {
  20. use ModelTrait;
  21. /**
  22. * 数据表主键
  23. * @var string
  24. */
  25. protected $pk = 'id';
  26. /**
  27. * 模型名称
  28. * @var string
  29. */
  30. protected $name = 'user_money';
  31. /**
  32. * @param Model $query
  33. * @param $value
  34. */
  35. public function searchTypeAttr($query, $value)
  36. {
  37. if ($value != '') $query->where('type', $value);
  38. }
  39. /**
  40. * @param Model $query
  41. * @param $value
  42. */
  43. public function searchNotTypeAttr($query, $value)
  44. {
  45. if (is_array($value) && count($value)) $query->whereNotIn('type', $value);
  46. }
  47. /**
  48. * @param Model $query
  49. * @param $value
  50. */
  51. public function searchPmAttr($query, $value)
  52. {
  53. if ($value !== '') $query->where('pm', $value);
  54. }
  55. /**
  56. * @param Model $query
  57. * @param $value
  58. */
  59. public function searchUidAttr($query, $value)
  60. {
  61. if ($value !== '') $query->where('uid', $value);
  62. }
  63. }