DivisionAgentApply.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace app\model\agent;
  3. use crmeb\basic\BaseModel;
  4. use crmeb\traits\ModelTrait;
  5. class DivisionAgentApply extends BaseModel
  6. {
  7. use ModelTrait;
  8. /**
  9. * 数据表主键
  10. * @var string
  11. */
  12. protected $pk = 'id';
  13. /**
  14. * 模型名称
  15. * @var string
  16. */
  17. protected $name = 'division_agent_apply';
  18. /**
  19. * uid
  20. * @param $query
  21. * @param $value
  22. */
  23. public function searchUidAttr($query, $value)
  24. {
  25. if ($value != '') $query->where('uid', $value);
  26. }
  27. /**
  28. * division_id
  29. * @param $query
  30. * @param $value
  31. */
  32. public function searchDivisionIdAttr($query, $value)
  33. {
  34. if ((int)$value !== 0) $query->where('division_id', $value);
  35. }
  36. /**
  37. * division_invite
  38. * @param $query
  39. * @param $value
  40. */
  41. public function searchDivisionInviteAttr($query, $value)
  42. {
  43. if ($value != '') $query->where('division_invite', $value);
  44. }
  45. /**
  46. * status
  47. * @param $query
  48. * @param $value
  49. */
  50. public function searchStatusAttr($query, $value)
  51. {
  52. if ($value !== '' && $value !== 'all') $query->where('status', $value);
  53. }
  54. /**
  55. * @param $query
  56. * @param $value
  57. */
  58. public function searchKeywordAttr($query, $value)
  59. {
  60. if ($value !== '') $query->where('uid|agent_name', 'like', '%' . $value . '%');
  61. }
  62. /**
  63. * is_del
  64. * @param $query
  65. * @param $value
  66. */
  67. public function searchIsDelAttr($query, $value)
  68. {
  69. if ($value !== '') $query->where('is_del', $value);
  70. }
  71. }