QueueAuxiliary.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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\other\queue;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. /**
  15. * 队列辅助表
  16. * Class QueueAuxiliary
  17. * @package app\model\other\queue
  18. */
  19. class QueueAuxiliary extends BaseModel
  20. {
  21. use ModelTrait;
  22. /**
  23. * 表明
  24. * @var string
  25. */
  26. protected $name = 'queue_auxiliary';
  27. protected $insert = ['add_time'];
  28. protected $autoWriteTimestamp = false;
  29. /**
  30. * 主键
  31. * @var string
  32. */
  33. protected $pk = 'id';
  34. /**
  35. * 类型搜索器
  36. * @param $query
  37. * @param $value
  38. */
  39. public function searchTypeAttr($query, $value)
  40. {
  41. $query->where('type', $value);
  42. }
  43. /**
  44. * 类型绑定id搜索器
  45. * @param $query
  46. * @param $value
  47. */
  48. public function searchBindingIdAttr($query, $value)
  49. {
  50. $query->where('binding_id', $value);
  51. }
  52. /**
  53. * 类型状态搜索器
  54. * @param $query
  55. * @param $value
  56. */
  57. public function searchStatusAttr($query, $value)
  58. {
  59. if ($value) {
  60. if (is_array($value)) {
  61. $query->whereIn('status', $value);
  62. } else {
  63. $query->where('status', $value);
  64. }
  65. }
  66. }
  67. /**
  68. * 类型关联id搜索器
  69. * @param $query
  70. * @param $value
  71. */
  72. public function searchRelationIdAttr($query, $value)
  73. {
  74. $query->where('relation_id', $value);
  75. }
  76. }