hyperf复杂orwhere查询,时间戳转换时间

 $data = Sub::query()
            ->where(function ($q) use ($begin, $end) {

                $q->whereBetween('time', [$begin, $end])
                    ->where('status', 'WAIT');

            })->orWhere(function ($q1) use ($time_end, $end,$w) {

                  $q1->where([
                ['frequency','=',1],
                ['time','<=',$end],
                ['status','!=','cancel'],
            ])->whereRaw('JSON_CONTAINS(days->"$[*]", ?)',[$w])
                ->whereRaw("date_format(from_unixtime(time),'%H%i') BETWEEN date_format(now(),'%H%i') AND date_format(?,'%H%i')", [$time_end]);


            })
            ->orderBy('id', 'asc')
            ->offset($offset)
            ->limit($limit)
            ->get();

你可能感兴趣的:(hyperf)