Merge branches 'dev_Ysl' and 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl

dev_cs_new
杨树明 6 years ago
commit cc5fce7ce0

@ -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)

@ -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

@ -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

@ -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|

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -189,10 +189,10 @@ 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,
login: contact_phone,
type: 5,
}
}).then((result) => {

@ -981,7 +981,7 @@ export default class TPMevaluation extends Component {
{pathoptionvalue===1||pathoptionvalue===5||pathoptionvalue===6?<div className="edu-back-white mb10 clearfix">
<div className="padding40-20">
<p className="color-grey-6 font-16 mb20">待处理图片路径</p>
<p className="color-grey-6 font-16 mb20">待处理文件路径</p>
<div className="df">
<div className="flex1 mr20">
<input type="text" className="input-100-45" autoComplete="off"
@ -1003,7 +1003,7 @@ export default class TPMevaluation extends Component {
{pathoptionvalue===1||pathoptionvalue===5||pathoptionvalue===6? <div className="edu-back-white mb10 clearfix">
<div className="padding40-20">
<p className="color-grey-6 font-16 mb20">标准答案图片路径</p>
<p className="color-grey-6 font-16 mb20">标准答案文件路径</p>
<div className="df">
<div className="flex1 mr20">
<input type="text" className="input-100-45" autoComplete="off"

@ -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;
}
Loading…
Cancel
Save