|
|
|
@ -22,10 +22,12 @@ class OptionalItemQuery < ApplicationQuery
|
|
|
|
|
items = ItemBank.where(container_id: hacks.pluck(:id), container_type: "Hack").or(ItemBank.where(id: items.pluck(:id)))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 来源
|
|
|
|
|
public = source.present? ? source.to_i : 1
|
|
|
|
|
public = public == 2 ? [0, 1] : public
|
|
|
|
|
items = items.where(public: public)
|
|
|
|
|
if public == 1
|
|
|
|
|
items = items.where(public: 1)
|
|
|
|
|
elsif public == 0
|
|
|
|
|
items = items.where(user_id: User.current.id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 难度
|
|
|
|
|
diff = difficulty ? difficulty.to_i : 1
|
|
|
|
|