1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace app\admin\model;
- use support\Model;
- /**
- * 悦活万悦影院排期模型
- * Class Users
- * @package app\admin\model
- */
- class LifeCinemaScheduling extends Model
- {
- const ROLE_STATUS = 1;
- const IS_DEL_YES = 1;
- const IS_DEL_NO = 0;
- const Scheduling_IS_SHOW = [
- self::IS_DEL_YES => '已删除',
- self::IS_DEL_NO => '未删除'
- ];
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'life_cinema_scheduling';
- public $timestamps = false;
- /**
- * Notes:获取排期列表
- * @param string $keywords
- * @param int $page
- * @param int $limit
- * @return array
- * User: ZQ
- * Date: 2022/9/13
- */
- public static function getSchedulingList(int $page, int $limit, string $keywords)
- {
- $list = static::select('*')
- ->where(['scheduling_is_del'=>static::IS_DEL_NO])
- ->when($keywords != '', function ($query) use ($keywords){
- $query->where('scheduling_name', 'like', '%' . $keywords . '%');
- })
- ->orderBy('scheduling_create_time','DESC')
- ->forPage($page, $limit)
- ->get();
- $count = static::where(['scheduling_is_del'=>static::IS_DEL_NO])
- ->when($keywords != '', function ($query) use ($keywords){
- $query->where('scheduling_name', 'like', '%' . $keywords . '%');
- })
- ->count();
- return [$list, $count];
- }
- /**
- * Notes:获取所有排期
- * @return array
- * User: ZQ
- * Date: 2022/9/19`
- */
- public static function getSchedulingAll()
- {
- $list = static::select(['scheduling_id','scheduling_start_time','scheduling_end_time','scheduling_cinema_id'])
- ->where(['scheduling_is_del'=>static::IS_DEL_NO])
- ->orderBy('scheduling_create_time','DESC')
- ->get();
- return $list;
- }
- /**
- * Notes:获取名称
- * @param string $account
- * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
- * User: ZQ
- * Date: 2022/9/19
- */
- public static function schedulingMation($admin_scheduling)
- {
- $where = [];
- $where['scheduling_is_del'] = static::IS_DEL_NO;
- $mation = static::where($where)
- ->when($admin_scheduling != '', function ($query) use ($admin_scheduling){
- $query->whereIn('scheduling_id', $admin_scheduling);
- })
- ->get('scheduling_name');
- return $mation;
- }
- }
|