CapitalFlow.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\system\statistics;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. class CapitalFlow extends BaseModel
  15. {
  16. use ModelTrait;
  17. /**
  18. * 数据表主键
  19. * @var string
  20. */
  21. protected $pk = 'id';
  22. /**
  23. * 模型名称
  24. * @var string
  25. */
  26. protected $name = 'capital_flow';
  27. /**
  28. * 交易类型搜索器
  29. * @param $query
  30. * @param $value
  31. */
  32. public function searchTradingTypeAttr($query, $value)
  33. {
  34. if ($value) $query->where('trading_type', $value);
  35. }
  36. /**
  37. * 关键字搜索器
  38. * @param $query
  39. * @param $value
  40. */
  41. public function searchKeywordsAttr($query, $value)
  42. {
  43. if ($value !== '') $query->where('order_id|uid|nickname|phone', 'like', '%' . $value . '%');
  44. }
  45. /**
  46. * 批量id搜索器
  47. * @param $query
  48. * @param $value
  49. */
  50. public function searchIdsAttr($query, $value)
  51. {
  52. if ($value != '') $query->whereIn('id', $value);
  53. }
  54. }