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

topic_bank
杨树明 5 years ago
commit f07a627cf0

1
.gitignore vendored

@ -37,6 +37,7 @@
/public/react/node_modules/ /public/react/node_modules/
/public/react/config/stats.json /public/react/config/stats.json
/public/react/stats.json /public/react/stats.json
/public/react/.idea/*
/public/npm-debug.log /public/npm-debug.log

@ -303,7 +303,7 @@ class CoursesController < ApplicationController
def destroy def destroy
if @course.is_delete == 0 if @course.is_delete == 0
@course.delete! @course.delete!
Tiding.create!(user_id: @course.tea_id, trigger_user_id: 1, container_id: @course.id, Tiding.create!(user_id: @course.tea_id, trigger_user_id: 0, container_id: @course.id,
container_type: 'Course', tiding_type: 'Delete', extra: @course.name) container_type: 'Course', tiding_type: 'Delete', extra: @course.name)
normal_status(0, "成功") normal_status(0, "成功")
else else

@ -82,7 +82,9 @@ class HomeworkCommonsController < ApplicationController
end end
@task_count = @homework_commons.size @task_count = @homework_commons.size
@homework_commons = @homework_commons.order("position DESC").page(page).per(15) order_str = @homework_type == 4 ? "position DESC" : "IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
homework_commons.created_at DESC"
@homework_commons = @homework_commons.order(order_str).page(page).per(15)
if @homework_type == 4 if @homework_type == 4
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns) @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns)

@ -55,7 +55,7 @@ class ProjectPackagesController < ApplicationController
package.destroy! package.destroy!
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, container_id: package.id, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0, container_id: package.id,
container_type: 'ProjectPackage', tiding_type: 'Destroyed', extra: package.title) container_type: 'ProjectPackage', tiding_type: 'Destroyed', extra: package.title)
render_ok render_ok

@ -1,6 +1,6 @@
class Wechats::JsSdkSignaturesController < ApplicationController class Wechats::JsSdkSignaturesController < ApplicationController
def create def create
timestamp = (Time.now.to_f * 1000).to_i timestamp = Time.now.to_i
noncestr = ('A'..'z').to_a.sample(8).join noncestr = ('A'..'z').to_a.sample(8).join
signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp) signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp)

@ -7,7 +7,8 @@ module Util::Wechat
attr_accessor :appid, :secret attr_accessor :appid, :secret
def js_sdk_signature(url, noncestr, timestamp) def js_sdk_signature(url, noncestr, timestamp)
str = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }.to_query data = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }
str = data.map { |k, v| "#{k}=#{v}" }.join('&')
Digest::SHA1.hexdigest(str) Digest::SHA1.hexdigest(str)
end end

@ -337,7 +337,7 @@ class Course < ApplicationRecord
#创建课程后,给该用户发送消息 #创建课程后,给该用户发送消息
def send_tiding def send_tiding
self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: 1, belong_container_id: id, self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: 0, belong_container_id: id,
belong_container_type: 'Course', tiding_type: 'System') belong_container_type: 'Course', tiding_type: 'System')
end end

@ -28,7 +28,7 @@ class CourseMessage < ApplicationRecord
def send_deal_tiding deal_status def send_deal_tiding deal_status
# 发送申请处理结果消息 # 发送申请处理结果消息
Tiding.create!( Tiding.create!(
user_id: course_message_id, trigger_user_id: 1, container_id: course_id, container_type: 'DealCourse', user_id: course_message_id, trigger_user_id: 0, container_id: course_id, container_type: 'DealCourse',
belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status
) )
# 将申请消息置为已处理 # 将申请消息置为已处理

@ -25,7 +25,7 @@ class Libraries::AgreeApplyService < ApplicationService
private private
def notify_library_author! def notify_library_author!
Tiding.create!(user_id: library.user_id, trigger_user_id: 1, Tiding.create!(user_id: library.user_id, trigger_user_id: 0,
container_id: library.id, container_type: 'Library', container_id: library.id, container_type: 'Library',
tiding_type: 'System', status: 1) tiding_type: 'System', status: 1)
end end

@ -32,7 +32,7 @@ class Libraries::RefuseApplyService < ApplicationService
private private
def notify_library_author! def notify_library_author!
Tiding.create!(user_id: library.user_id, trigger_user_id: 1, Tiding.create!(user_id: library.user_id, trigger_user_id: 0,
container_id: library.id, container_type: 'Library', container_id: library.id, container_type: 'Library',
tiding_type: 'System', status: 2, extra: library_apply.reason) tiding_type: 'System', status: 2, extra: library_apply.reason)
end end

@ -29,7 +29,7 @@ class ProjectPackages::AgreeApplyService < ApplicationService
Tiding.where(container_id: package.id, container_type: 'ProjectPackage', Tiding.where(container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'Apply', status: 0).update_all(status: 1) tiding_type: 'Apply', status: 0).update_all(status: 1)
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'System', status: 1) tiding_type: 'System', status: 1)
end end

@ -16,7 +16,7 @@ class ProjectPackages::EndBiddingService < ApplicationService
private private
def send_bidding_end_notify! def send_bidding_end_notify!
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'BiddingEnd') container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'BiddingEnd')
end end

@ -31,7 +31,7 @@ class ProjectPackages::RefuseApplyService < ApplicationService
Tiding.where(container_id: package.id, container_type: 'ProjectPackage', Tiding.where(container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'Apply', status: 0).update_all(status: 1) tiding_type: 'Apply', status: 0).update_all(status: 1)
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'System', status: 2, extra: apply.reason) tiding_type: 'System', status: 2, extra: apply.reason)
end end

@ -71,7 +71,7 @@ class ProjectPackages::SaveService < ApplicationService
end end
def send_create_notify! def send_create_notify!
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'Created') container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'Created')
end end

@ -28,7 +28,7 @@ class Videos::AgreeApplyService < ApplicationService
private private
def notify_video_author! def notify_video_author!
Tiding.create!(user_id: video.user_id, trigger_user_id: 1, Tiding.create!(user_id: video.user_id, trigger_user_id: 0,
container_id: video.id, container_type: 'Video', container_id: video.id, container_type: 'Video',
tiding_type: 'System', status: 1) tiding_type: 'System', status: 1)
end end

@ -31,7 +31,7 @@ class Videos::RefuseApplyService < ApplicationService
private private
def notify_video_author! def notify_video_author!
Tiding.create!(user_id: video.user_id, trigger_user_id: 1, Tiding.create!(user_id: video.user_id, trigger_user_id: 0,
container_id: video.id, container_type: 'Video', container_id: video.id, container_type: 'Video',
tiding_type: 'System', status: 2, extra: video_apply.reason) tiding_type: 'System', status: 2, extra: video_apply.reason)
end end

@ -18,7 +18,7 @@ json.time tiding.how_long_time
json.new_tiding tiding.unread?(@onclick_time) json.new_tiding tiding.unread?(@onclick_time)
json.trigger_user do json.trigger_user do
if tiding.trigger_user_id.zero? if tiding.trigger_user_id.zero? || (tiding.trigger_user_id == 1 && tiding.tiding_type == 'System')
json.id 0 json.id 0
json.name "系统" json.name "系统"
json.login "" json.login ""

Loading…
Cancel
Save