column('id'); $rightIds = self::where([ ['start_time', '>=', $endTime], ['end_time', '>=', $endTime], ])->column('id'); $allIds = array_merge($leftIds, $rightIds); $query->where('id', 'not in', $allIds); } else if (isset($data['start_time']) && !empty($data['start_time'])) { $startTime = strtotime($data['start_time']); $query->where('start_time', '<=', $startTime); } else if (isset($data['end_time']) && !empty($data['end_time'])) { $endTime = strtotime($data['end_time']); $query->where('end_time', '<=', $endTime); } } /** * @notes 商品信息搜索器 * @param $query * @param $value * @param $data * @author Tab * @date 2021/8/28 11:39 */ public function searchGoodsInfoAttr($query, $value, $data) { if (isset($data['goods_info']) && !empty($data['goods_info'])) { $activityIds = BargainGoods::alias('bg') ->leftJoin('goods g', 'g.id = bg.goods_id') ->where('g.name|g.code', 'like', '%' . $data['goods_info'] . '%') ->column('bg.activity_id'); $query->where('id', 'in', $activityIds); } } }