Date: Thu, 1 Aug 2019 15:57:48 +0800
Subject: [PATCH 03/11] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../20190801075337_add_praises_count_to_memos.rb | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 db/migrate/20190801075337_add_praises_count_to_memos.rb
diff --git a/db/migrate/20190801075337_add_praises_count_to_memos.rb b/db/migrate/20190801075337_add_praises_count_to_memos.rb
new file mode 100644
index 000000000..0cc2259e2
--- /dev/null
+++ b/db/migrate/20190801075337_add_praises_count_to_memos.rb
@@ -0,0 +1,12 @@
+class AddPraisesCountToMemos < ActiveRecord::Migration[5.2]
+ def change
+ add_column :memos, :praises_count, :integer, :default => 0
+
+ memos = Memo.includes(:praise_treads).all
+ memos.find_each do |m|
+ puts("####{m.id}")
+ praises_count = m.praise_treads.select{|pt| pt.praise_or_tread == 1}.count
+ m.update_column(:praises_count, praises_count)
+ end
+ end
+end
From a317a857bc4260398528cd7d3d347c7acda07a1d Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 1 Aug 2019 16:04:35 +0800
Subject: [PATCH 04/11] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E9=99=84=E4=BB=B6?=
=?UTF-8?q?=E8=B7=AF=E7=94=B1=E8=BD=AC=E5=8F=91=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/routes.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/routes.rb b/config/routes.rb
index 79542817f..b8db3afa6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -5,6 +5,7 @@ Rails.application.routes.draw do
mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new
get 'attachments/download/:id', to: 'attachments#show'
+ get 'attachments/download/:id/:filename', to: 'attachments#show'
resources :edu_settings
scope '/api' do
From 041b5217d00182b2c940da4e371c5adf9847a285 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 1 Aug 2019 16:08:32 +0800
Subject: [PATCH 05/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/memos_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb
index d950fe1c8..0475eb0da 100644
--- a/app/controllers/memos_controller.rb
+++ b/app/controllers/memos_controller.rb
@@ -85,7 +85,7 @@ class MemosController < ApplicationController
params[:tags].each do |tag|
MemoTagRepertoire.create!(memo_id: @memo.id, tag_repertoire_id: tag)
end
- normal_status("帖子创建成功")
+ render :json => {memo_id: @memo.id, status: 0, message: "帖子创建成功"}
rescue Exception => e
tip_exception("帖子创建失败,原因:#{e}")
raise ActiveRecord::Rollback
From 4549535f0f93f48af03903354bbbff291761e44e Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 1 Aug 2019 16:13:15 +0800
Subject: [PATCH 06/11] =?UTF-8?q?=E8=B7=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/memos/_memo.json.jbuilder | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/memos/_memo.json.jbuilder b/app/views/memos/_memo.json.jbuilder
index bc3744d1f..a33de2492 100644
--- a/app/views/memos/_memo.json.jbuilder
+++ b/app/views/memos/_memo.json.jbuilder
@@ -9,6 +9,6 @@ json.memo do
json.tag memo.tag_repertoires.map(&:name)
json.time memo.created_at
json.replies_count memo.all_replies_count
- json.user_praise memo.praise_treads.user_liker(@user.try(:id)) ? true : false
+ json.user_praise memo.praise_treads.user_liker(@user.try(:id)).count > 1 ? true : false
json.memo_praise_count memo.praise_treads.liker.count
end
From 25a627df2f2b017c894f6c65c8d269d2fcf8280b Mon Sep 17 00:00:00 2001
From: p31729568
Date: Thu, 1 Aug 2019 16:48:16 +0800
Subject: [PATCH 07/11] add praises count to library
---
app/models/library.rb | 2 ++
.../20190801084533_add_praises_count_to_libraries.rb | 10 ++++++++++
2 files changed, 12 insertions(+)
create mode 100644 db/migrate/20190801084533_add_praises_count_to_libraries.rb
diff --git a/app/models/library.rb b/app/models/library.rb
index 894dcdac0..13a5c3243 100644
--- a/app/models/library.rb
+++ b/app/models/library.rb
@@ -10,6 +10,8 @@ class Library < ApplicationRecord
has_many :attachments, as: :container
has_one :praise_tread_cache, foreign_key: :object_id
+ has_many :praise_treads, as: :praise_tread_object, dependent: :destroy
+
validates :uuid, presence: true, uniqueness: true
diff --git a/db/migrate/20190801084533_add_praises_count_to_libraries.rb b/db/migrate/20190801084533_add_praises_count_to_libraries.rb
new file mode 100644
index 000000000..6a619104d
--- /dev/null
+++ b/db/migrate/20190801084533_add_praises_count_to_libraries.rb
@@ -0,0 +1,10 @@
+class AddPraisesCountToLibraries < ActiveRecord::Migration[5.2]
+ def change
+ add_column :libraries, :praises_count, :integer, :default => 0
+
+ Library.find_each do |library|
+ praises_count = library.praise_treads.count
+ library.update_column(:praises_count, praises_count)
+ end
+ end
+end
From 51214b085145bc141dd9e8561575b1d0f3352362 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 1 Aug 2019 16:53:32 +0800
Subject: [PATCH 08/11] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=8B=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/games/picture_display.json.jbuilder | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder
index 8b5271ec5..2bc88fdf4 100644
--- a/app/views/games/picture_display.json.jbuilder
+++ b/app/views/games/picture_display.json.jbuilder
@@ -26,13 +26,13 @@ elsif @type =="qrcode"
json.qrcode_str @qrcode_str
elsif @type == "mp3" || @type == "mp4"
if @type == "mp4"
- json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171"}]
- json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172"}]
- json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173"}]
+ json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171/123.mp4"}]
+ json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172/456.mp4"}]
+ json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173/789.mp4"}]
else
- json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174"}]
- json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175"}]
- json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175"}]
+ json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174/58099.mp3"}]
+ json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}]
+ json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}]
end
# json.orignal_file do
# json.array! @orignal_picture do |file|
From 7d206418c770902a20da4acb9d20d0dc67965eca Mon Sep 17 00:00:00 2001
From: p31729568
Date: Thu, 1 Aug 2019 16:55:56 +0800
Subject: [PATCH 09/11] modify library praises count
---
app/controllers/libraries_controller.rb | 2 +-
app/views/libraries/index.json.jbuilder | 2 +-
app/views/libraries/show.json.jbuilder | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb
index 55894aaa6..c7c6029da 100644
--- a/app/controllers/libraries_controller.rb
+++ b/app/controllers/libraries_controller.rb
@@ -22,7 +22,7 @@ class LibrariesController < ApplicationController
end
@count = libraries.count
- @libraries = paginate libraries.includes(:library_tags, :praise_tread_cache, user: :user_extension)
+ @libraries = paginate libraries.includes(:library_tags, user: :user_extension)
ids = @libraries.map(&:id)
@download_count_map = Attachment.where(container_type: 'Library', container_id: ids)
diff --git a/app/views/libraries/index.json.jbuilder b/app/views/libraries/index.json.jbuilder
index c58d390b0..13ab8d77b 100644
--- a/app/views/libraries/index.json.jbuilder
+++ b/app/views/libraries/index.json.jbuilder
@@ -5,7 +5,7 @@ json.libraries do
json.cover_url library.cover_id.present? ? download_url(library.cover) : nil
- json.praise_count library.praise_tread_cache&.praise_num || 0
+ json.praise_count library.praises_count
json.download_count @download_count_map.fetch(library.id, 0)
json.published_at library.display_published_at
diff --git a/app/views/libraries/show.json.jbuilder b/app/views/libraries/show.json.jbuilder
index 0f4b6ea17..e1fc7d781 100644
--- a/app/views/libraries/show.json.jbuilder
+++ b/app/views/libraries/show.json.jbuilder
@@ -2,7 +2,7 @@ library = current_library
json.extract! library, :id, :uuid, :title, :content, :author_name, :author_school_name, :status, :visited_count
-json.praise_count library.praise_tread_cache&.praise_num || 0
+json.praise_count library.praises_count
json.published_at library.display_published_at
json.created_at library.display_created_at
From 6a91a4ecb751403beb55a2b21baa70c24f3bba61 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 1 Aug 2019 16:56:24 +0800
Subject: [PATCH 10/11] b
---
.../PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js | 2 +-
public/react/src/modules/user/common.css | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 493152def..51cd8c8f6 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -189,7 +189,7 @@ class PackageIndexNEIBannerConcent extends Component {
//短信验证
SMSverification = () => {
let {contact_phone,code}=this.state;
- var url = `/account/get_verification_code.json`;
+ var url = `/accounts/get_verification_code.json`;
axios.get((url), {
params: {
value: contact_phone,
diff --git a/public/react/src/modules/user/common.css b/public/react/src/modules/user/common.css
index d23412d07..6d696a676 100644
--- a/public/react/src/modules/user/common.css
+++ b/public/react/src/modules/user/common.css
@@ -264,5 +264,5 @@
margin: 0 auto;
}
.ant-input-affix-wrapper .ant-input-prefix, .ant-input-affix-wrapper .ant-input-suffix {
- background: #ffffff!important;
+ background: transparent !important;
}
\ No newline at end of file
From 987a935faee035c578a56b4f7a2a8b71a28358ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 1 Aug 2019 17:01:34 +0800
Subject: [PATCH 11/11] =?UTF-8?q?=20=E4=BC=97=E5=8C=85=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
index 51cd8c8f6..ae4983b33 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js
@@ -192,7 +192,7 @@ class PackageIndexNEIBannerConcent extends Component {
var url = `/accounts/get_verification_code.json`;
axios.get((url), {
params: {
- value: contact_phone,
+ login: contact_phone,
type: 5,
}
}).then((result) => {