Merge branch 'standalone_develop' into pm_project_develop

# Conflicts:
#	app/controllers/attachments_controller.rb
#	app/services/api/v1/issues/concerns/checkable.rb
#	app/services/api/v1/issues/concerns/loadable.rb
This commit is contained in:
2023-12-15 10:43:54 +08:00
26 changed files with 130 additions and 40 deletions

View File

@@ -69,6 +69,7 @@ class Attachment < ApplicationRecord
scope :simple_columns, -> { select(:id, :filename, :filesize, :created_on, :cloud_url, :author_id, :content_type, :container_type, :container_id) }
scope :search_by_container, -> (ids) {where(container_id: ids)}
scope :unified_setting, -> {where("unified_setting = ? ", 1)}
scope :where_id_or_uuid, -> (id) { (Float(id) rescue nil).present? ? where(id: id) : where(uuid: id) }
validates_length_of :description, maximum: 100, message: "不能超过100个字符"

View File

@@ -6,10 +6,10 @@
# user_id :integer not null
# number :string(255) not null
# name :string(255) not null
# card_front :integer
# card_back :integer
# hold_card_front :integer
# hold_card_back :integer
# card_front :string(255)
# card_back :string(255)
# hold_card_front :string(255)
# hold_card_back :string(255)
# state :integer default("0")
# description :string(255)
# created_at :datetime not null
@@ -24,7 +24,7 @@ class IdentityVerification < ApplicationRecord
belongs_to :user
enum state: { "待审核": 0, "已通过": 1, "已拒绝": 2}
after_create do
Attachment.where(id:[card_front,card_back,hold_card_front,hold_card_back]).update_all(is_public:0)
Attachment.where(uuid:[card_front,card_back,hold_card_front,hold_card_back]).update_all(is_public:0)
end
after_save do
@@ -34,18 +34,18 @@ class IdentityVerification < ApplicationRecord
end
def card_front_attachment
Attachment.find_by_id card_front
Attachment.where_id_or_uuid(card_front).first
end
def card_back_attachment
Attachment.find_by_id card_back
Attachment.where_id_or_uuid(card_back).first
end
def hold_card_front_attachment
Attachment.find_by_id hold_card_front
Attachment.where_id_or_uuid(hold_card_front).first
end
def hold_card_back_attachment
Attachment.find_by_id hold_card_back
Attachment.where_id_or_uuid(hold_card_back).first
end
end

View File

@@ -88,9 +88,9 @@ class Journal < ApplicationRecord
when 'issue'
return "创建了<b>疑修</b>"
when 'attachment'
old_value = Attachment.where(id: detail.old_value.split(",")).pluck(:filename).join("")
new_value = Attachment.where(id: detail.value.split(",")).pluck(:filename).join("")
if old_value.nil? || old_value.blank?
old_value = Attachment.where("id in (?) or uuid in (?)", detail.old_value.to_s.split(","), detail.old_value.to_s.split(",")).pluck(:filename).join("")
new_value = Attachment.where("id in (?) or uuid in (?)", detail.value.to_s.split(","), detail.value.to_s.split(",")).pluck(:filename).join("")
if old_value.nil? || old_value.blank?
content += "添加了<b>#{new_value}</b>附件"
else
new_value = "" if new_value.blank?

View File

@@ -43,8 +43,9 @@ class TraceUser < ApplicationRecord
def build_token
return if username.blank? || password.blank? || unit.blank? || email.blank? || name.blank?
response = Trace::AddUserService.call(username, password, unit, telnumber, email, name)
self.token = response[1]['token']
response1 = Trace::AddUserService.call(username, password, unit, telnumber, email, name)
response2 = Trace::LoginService.call(username, password)
self.token = response2[1]['token']
self.expired_at = Time.now + 1.hours
end