where('factory_id', -1); return; } $query->where(function ($q) use ($factoryId) { $q->where('factory_id', $factoryId) ->whereOr(function ($q2) { $q2->where('factory_id', 0)->where('is_system', 1); }); }); } /** * 可套打:排除已锁定的单次购买副本 * @param \think\db\Query $query * @return \think\db\Query */ public function scopePrintable($query) { return $query->where('status', 'normal')->where(function ($q) { $q->where('license_type', '<>', 'market_single') ->whereOr('locked', 0); }); } }