Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hjm
cxt 6 years ago
commit 8b992ae36b

@ -53,6 +53,6 @@ class Users::VideosController < Users::BaseController
end end
def batch_publish_params def batch_publish_params
params.permit(videos: []) params.permit(videos: %i[video_id title])
end end
end end

@ -11,7 +11,7 @@ class ApplyTeacherRoleJoinCourseNotifyJob < ApplicationJob
belong_container_type tiding_type extra created_at updated_at] belong_container_type tiding_type extra created_at updated_at]
same_attrs = { same_attrs = {
trigger_user_id: user.id, container_id: course.id, container_type: 'JoinCourse', trigger_user_id: user.id, container_id: course.id, container_type: 'JoinCourse', status: 0,
belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'Apply', extra: role belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'Apply', extra: role
} }
Tiding.bulk_insert(*attrs) do |worker| Tiding.bulk_insert(*attrs) do |worker|

@ -1,5 +1,5 @@
module AliyunVod module AliyunVod
class << self class << self
attr_accessor :access_key_id, :access_key_secret, :base_url, :callback_url, :signature_key attr_accessor :access_key_id, :access_key_secret, :base_url, :cate_id, :callback_url, :signature_key
end end
end end

@ -8,6 +8,10 @@ module AliyunVod::Service::VideoUpload
FileName: filename FileName: filename
}.merge(base_params) }.merge(base_params)
# 分类
cate_id = AliyunVod.cate_id
params[:CateId] = cate_id if cate_id.present?
params = opts.merge(params) params = opts.merge(params)
result = request(:post, params) result = request(:post, params)

@ -327,7 +327,7 @@ class Course < ApplicationRecord
#创建课程后,给该用户发送消息 #创建课程后,给该用户发送消息
def send_tiding def send_tiding
self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: tea_id, belong_container_id: id, self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: 1, 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: User.current, container_id: course_id, container_type: 'DealCourse', user_id: course_message_id, trigger_user: 1, 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
) )
# 将申请消息置为已处理 # 将申请消息置为已处理

@ -60,8 +60,8 @@ class User < ApplicationRecord
has_many :games, :dependent => :destroy has_many :games, :dependent => :destroy
has_many :created_subjects, foreign_key: :user_id, class_name: 'Subject' has_many :created_subjects, foreign_key: :user_id, class_name: 'Subject'
has_many :subjects, :through => :subject_members
has_many :subject_members, :dependent => :destroy has_many :subject_members, :dependent => :destroy
has_many :subjects, :through => :subject_members
has_many :grades, :dependent => :destroy has_many :grades, :dependent => :destroy
has_many :experiences, :dependent => :destroy has_many :experiences, :dependent => :destroy
has_many :student_works, :dependent => :destroy has_many :student_works, :dependent => :destroy

@ -11,7 +11,7 @@ class Users::VideoQuery < ApplicationQuery
end end
def call def call
videos = user.videos.published videos = user.videos
videos = videos =
case params[:status] case params[:status]

@ -11,12 +11,14 @@ class Videos::DispatchCallbackService < ApplicationService
# TODO:: 拆分事件分发 # TODO:: 拆分事件分发
case params['EventType'] case params['EventType']
when 'FileUploadComplete' then when 'FileUploadComplete' then # 视频上传完成
video.file_url = params['FileUrl'] video.file_url = params['FileUrl']
video.upload_success video.upload_success
video.save! video.save!
when 'SnapshotComplete' then # 封面截图完成
return if video.cover_url.present?
GetAliyunVideoInfoJob.perform_later(video.uuid) video.update!(cover_url: params['CoverUrl'])
end end
rescue => ex rescue => ex

@ -1,6 +1,6 @@
json.count @count json.count @count
json.videos do json.videos do
json.array! @video.each do |video| json.array! @videos.each do |video|
json.partial! 'video', video: video json.partial! 'video', video: video
json.file_url nil json.file_url nil
end end

@ -2,6 +2,7 @@ defaults: &defaults
access_key_id: 'test' access_key_id: 'test'
access_key_secret: 'test' access_key_secret: 'test'
base_url: 'http://vod.cn-shanghai.aliyuncs.com' base_url: 'http://vod.cn-shanghai.aliyuncs.com'
cate_id: '-1'
callback_url: 'http://47.96.87.25:48080/api/callbacks/aliyun_vod.json' callback_url: 'http://47.96.87.25:48080/api/callbacks/aliyun_vod.json'
signature_key: 'test12345678' signature_key: 'test12345678'

@ -2,5 +2,6 @@ config = Rails.application.config_for(:aliyun_vod)
AliyunVod.access_key_id = config['access_key_id'] AliyunVod.access_key_id = config['access_key_id']
AliyunVod.access_key_secret = config['access_key_secret'] AliyunVod.access_key_secret = config['access_key_secret']
AliyunVod.base_url = config['base_url'] || 'http://vod.cn-shanghai.aliyuncs.com'.freeze AliyunVod.base_url = config['base_url'] || 'http://vod.cn-shanghai.aliyuncs.com'.freeze
AliyunVod.cate_id = config['cate_id']
AliyunVod.callback_url = config['callback_url'] AliyunVod.callback_url = config['callback_url']
AliyunVod.signature_key = config['signature_key'] AliyunVod.signature_key = config['signature_key']

@ -104,17 +104,17 @@ class ListPageIndex extends Component{
{/*头部banner*/} {/*头部banner*/}
<CoursesBanner {...this.props}></CoursesBanner> <CoursesBanner {...this.props}></CoursesBanner>
{/*{yslGuideone===null||yslGuideone===undefined||yslGuideone===false?*/} {yslGuideone===null||yslGuideone===undefined||yslGuideone===false?
{/* (*/} (
{/* this.props.isAdmin()===true?*/} this.props.isAdmin()===true?
{/* <Guide*/} <Guide
{/* setwindowlocal={(b)=>this.setwindowlocal(b)}*/} setwindowlocal={(b)=>this.setwindowlocal(b)}
{/* >*/} >
{/* </Guide>*/} </Guide>
{/* :""*/} :""
{/* )*/} )
{/* :""*/} :""
{/*}*/} }
<div className="educontent clearfix" style={{flex: "1 0 auto"}}> <div className="educontent clearfix" style={{flex: "1 0 auto"}}>

@ -596,7 +596,7 @@ class Poll extends Component{
courseType={course_types} courseType={course_types}
item={item} item={item}
key={key} key={key}
checkBox={<Checkbox value={item.id} onClick={() => this.onItemClick(item)}></Checkbox>} checkBox={<Checkbox value={item.id} key={item.id} onClick={() => this.onItemClick(item)}></Checkbox>}
></PollListItem> ></PollListItem>
) )
}) })

@ -166,8 +166,13 @@ class AccountBasic extends Component {
}).then((result)=>{ }).then((result)=>{
if(result){ if(result){
this.props.showNotification('保存成功') this.props.showNotification('保存成功')
// 如果是第一次完善资料,重新拉头部接口更新
if (!this.props.basicInfo.base_info_completed) {
this.props.fetchUser()
}
this.props.getBasicInfo(); this.props.getBasicInfo();
this.props.history.push('/account/profile') this.props.history.push('/account/profile')
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);

Loading…
Cancel
Save