LifeCinemaScheduling.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace app\admin\model;
  3. use support\Model;
  4. /**
  5. * 悦活万悦影院排期模型
  6. * Class Users
  7. * @package app\admin\model
  8. */
  9. class LifeCinemaScheduling extends Model
  10. {
  11. const ROLE_STATUS = 1;
  12. const IS_DEL_YES = 1;
  13. const IS_DEL_NO = 0;
  14. const Scheduling_IS_SHOW = [
  15. self::IS_DEL_YES => '已删除',
  16. self::IS_DEL_NO => '未删除'
  17. ];
  18. /**
  19. * The table associated with the model.
  20. *
  21. * @var string
  22. */
  23. protected $table = 'life_cinema_scheduling';
  24. public $timestamps = false;
  25. /**
  26. * Notes:获取排期列表
  27. * @param string $keywords
  28. * @param int $page
  29. * @param int $limit
  30. * @return array
  31. * User: ZQ
  32. * Date: 2022/9/13
  33. */
  34. public static function getSchedulingList(int $page, int $limit, string $keywords)
  35. {
  36. $list = static::select('*')
  37. ->where(['scheduling_is_del'=>static::IS_DEL_NO])
  38. ->when($keywords != '', function ($query) use ($keywords){
  39. $query->where('scheduling_name', 'like', '%' . $keywords . '%');
  40. })
  41. ->orderBy('scheduling_create_time','DESC')
  42. ->forPage($page, $limit)
  43. ->get();
  44. $count = static::where(['scheduling_is_del'=>static::IS_DEL_NO])
  45. ->when($keywords != '', function ($query) use ($keywords){
  46. $query->where('scheduling_name', 'like', '%' . $keywords . '%');
  47. })
  48. ->count();
  49. return [$list, $count];
  50. }
  51. /**
  52. * Notes:获取所有排期
  53. * @return array
  54. * User: ZQ
  55. * Date: 2022/9/19`
  56. */
  57. public static function getSchedulingAll()
  58. {
  59. $list = static::select(['scheduling_id','scheduling_start_time','scheduling_end_time','scheduling_cinema_id'])
  60. ->where(['scheduling_is_del'=>static::IS_DEL_NO])
  61. ->orderBy('scheduling_create_time','DESC')
  62. ->get();
  63. return $list;
  64. }
  65. /**
  66. * Notes:获取名称
  67. * @param string $account
  68. * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
  69. * User: ZQ
  70. * Date: 2022/9/19
  71. */
  72. public static function schedulingMation($admin_scheduling)
  73. {
  74. $where = [];
  75. $where['scheduling_is_del'] = static::IS_DEL_NO;
  76. $mation = static::where($where)
  77. ->when($admin_scheduling != '', function ($query) use ($admin_scheduling){
  78. $query->whereIn('scheduling_id', $admin_scheduling);
  79. })
  80. ->get('scheduling_name');
  81. return $mation;
  82. }
  83. }