@@ -71,8 +51,13 @@ class LiveItem extends Component{
}
- 创建时间:{item.created_at}
-
+
+
+
+ { item.platform && 直播平台:{item.platform} }
+ { item.live_time && 开播时间:{item.live_time}}
+ { item.duration && 直播时长:{item.duration} }
+
{
item.op_auth ?
@@ -80,7 +65,7 @@ class LiveItem extends Component{
}
{
item.delete_auth ?
- this.deleteLive(item.id)}>删除
+ this.deleteLive(item.id)}>删除
:""
}
diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js
index 2cd23f049..d505f052d 100644
--- a/public/react/src/modules/courses/Video/LiveNew.js
+++ b/public/react/src/modules/courses/Video/LiveNew.js
@@ -1,20 +1,50 @@
import React,{ Component } from "react";
-import { Modal , Form , Input , Spin } from 'antd';
+import { Modal , Form , Input , Spin , Select , DatePicker , InputNumber } from 'antd';
+import locale from 'antd/lib/date-picker/locale/zh_CN';
+import moment from 'moment';
+import { handleDateString } from 'educoder';
import './video.css';
import axios from 'axios';
+
const { TextArea } = Input;
+const { Option } = Select;
+
+function range(start, end) {
+ const result = [];
+ for (let i = start; i < end; i++) {
+ result.push(i);
+ }
+ return result;
+}
+function disabledDateTime() {
+ return {
+ disabledMinutes: () => range(1, 30).concat(range(31, 60)),
+ };
+}
+function disabledDate(current) {
+ return current && current < moment().endOf('day').subtract(1, 'days');
+}
+
class LiveNew extends Component{
constructor(props){
super(props);
this.state={
- isSpining:false
+ isSpining:false,
+ beginTime:undefined,
+ beginTimeFlag:false,
}
}
+ componentDidMount=()=>{
+ console.log("1",this.props.liveId)
+ this.checkType();
+ }
+
componentDidUpdate=(prevState)=>{
+ console.log("2",prevState.liveId);
if(prevState && prevState.liveId !== this.props.liveId){
this.setState({
isSpining:true
@@ -25,7 +55,8 @@ class LiveNew extends Component{
checkType=()=>{
const { liveId } = this.props;
-
+ console.log("3",this.props.liveId);
+ this.clearAll();
if(liveId){
const url =`/live_links/${liveId}/edit.json`;
axios.get(url).then(result=>{
@@ -33,14 +64,15 @@ class LiveNew extends Component{
this.props.form.setFieldsValue({
url:result.data.url,
description:result.data.description,
+ platform:result.data.platform || "tencent",
+ duration:result.data.duration,
+ course_name:result.data.course_name
+ })
+ this.setState({
+ beginTime:result.data.live_time && moment(result.data.live_time,"YYYY-MM-DD HH:mm")
})
}
})
- }else{
- this.props.form.setFieldsValue({
- url:undefined,
- description:undefined
- })
}
this.setState({
isSpining:false
@@ -50,7 +82,13 @@ class LiveNew extends Component{
handleSubmit=()=>{
this.props.form.validateFields((err, values) => {
if(!err){
- console.log("2")
+ const { beginTime } = this.state;
+ if(!beginTime){
+ this.setState({
+ beginTimeFlag:true
+ })
+ return;
+ }
const { liveId } = this.props;
if(liveId){
// 修改
@@ -64,8 +102,10 @@ class LiveNew extends Component{
// 修改
updateFunc=(id,values)=>{
const url = `/live_links/${id}.json`;
+ const { beginTime } = this.state;
axios.put(url,{
- ...values
+ ...values,
+ live_time:beginTime
}).then(result=>{
if(result){
this.props.showNotification("修改成功!");
@@ -81,8 +121,10 @@ class LiveNew extends Component{
creatFunc=(values)=>{
const CourseId=this.props.match.params.coursesId;
const url = `/courses/${CourseId}/live_links.json`;
+ const { beginTime } = this.state;
axios.post(url,{
- ...values
+ ...values,
+ live_time:beginTime
}).then(result=>{
if(result){
this.props.showNotification("添加成功!");
@@ -107,15 +149,31 @@ class LiveNew extends Component{
cancelNew=()=>{
const { setliveVisibel } = this.props;
+ this.clearAll();
+ setliveVisibel && setliveVisibel(false);
+ }
+
+ clearAll=()=>{
this.props.form.setFieldsValue({
+ course_name:undefined,
+ platform:"tencent",
url:undefined,
- description:undefined
+ description:undefined,
+ duration:undefined
+ })
+ this.setState({
+ beginTime:undefined
+ })
+ }
+
+ onChangeTime=(data,dateString)=>{
+ this.setState({
+ beginTime:handleDateString(dateString)
})
- setliveVisibel && setliveVisibel(false);
}
render(){
- const { isSpining } = this.state;
+ const { isSpining , beginTime , beginTimeFlag } = this.state;
const {getFieldDecorator} = this.props.form;
const { visible } = this.props;
@@ -131,6 +189,24 @@ class LiveNew extends Component{
+ {getFieldDecorator('course_name', {
+ rules: [{required: true, message: "请输入课程名字"}],
+ })(
+
+ )}
+
+
+ {getFieldDecorator('platform', {
+ rules: [{required: true, message: "请选择直播平台"}],
+ })(
+
+ )}
+
{getFieldDecorator('url', {
rules: [{required: true, message: "请输入第三方直播链接"}],
@@ -138,6 +214,38 @@ class LiveNew extends Component{
)}
+
+
+
*开播时间
+
+
+ {
+ beginTimeFlag && 请选择开播时间
+ }
+
+
+
+ {getFieldDecorator('duration', {
+ rules: [],
+ })(
+
+ )}
+
+
分钟
+
{getFieldDecorator('description', {
rules: [{
@@ -147,10 +255,7 @@ class LiveNew extends Component{
)}
- {/*
- EduCoder推荐您使用腾讯课堂进行直播
- 操作指引
-
*/}
+
取消
diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js
index 070b76bbc..b1bf5efdc 100644
--- a/public/react/src/modules/courses/Video/VideoIndex.js
+++ b/public/react/src/modules/courses/Video/VideoIndex.js
@@ -28,7 +28,6 @@ class VideoIndex extends Component{
lives:undefined,
liveData:undefined,
- my_liveId:undefined,
liveId:undefined,
liveVisible:false
@@ -66,8 +65,6 @@ class VideoIndex extends Component{
liveData:result.data,
lives:result.data.lives,
isSpining:false,
- my_liveId:result.data.my_live_id,
- liveId:result.data.my_live_id
})
}
}).catch(error=>{
@@ -155,9 +152,8 @@ class VideoIndex extends Component{
// }
// 直播设置
liveSetting=()=>{
- const { my_liveId } = this.state;
this.setState({
- liveId:my_liveId
+ liveId:undefined
})
this.setliveVisibel(true);
}
@@ -166,6 +162,11 @@ class VideoIndex extends Component{
this.setState({
liveVisible:flag
})
+ if(flag === false){
+ this.setState({
+ liveId:undefined
+ })
+ }
if(changetypeFlag){
this.checkType("live",1);
}
@@ -223,7 +224,7 @@ class VideoIndex extends Component{
}
:
-
直播设置
+
添加直播
}
}
diff --git a/public/react/src/modules/courses/Video/video.css b/public/react/src/modules/courses/Video/video.css
index b44a33371..ea34ffe22 100644
--- a/public/react/src/modules/courses/Video/video.css
+++ b/public/react/src/modules/courses/Video/video.css
@@ -42,6 +42,11 @@
align-items: center;
height: 25px;
}
+.flex-bottom{
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-end;
+}
.square-main .buttonRow i {
vertical-align: top;
font-size: 16px;
@@ -68,8 +73,8 @@
align-items: center;
}
.liveAuthor{
- width: 36px;
- height: 36px;
+ width: 20px;
+ height: 20px;
border-radius: 50%;
margin-right: 20px;
}
@@ -117,6 +122,16 @@
line-clamp: 2;
-webkit-box-orient: vertical;
}
+.timeStyle{
+ transition: 0.5s;
+}
+.borderRed{
+ border:1px solid #f5222d;
+ border-radius: 4px;
+}
+.setStyle{
+ margin-bottom: 5px!important;
+}
.switchStyle.ant-switch-checked{
background-color: #25C03B;
}
@@ -128,7 +143,7 @@
}
.liveModal .ant-row.ant-form-item{
position: relative;
- margin-bottom: 20px;
+ margin-bottom: 16px;
}
.liveModal .ant-form-explain{
position: absolute;
@@ -136,8 +151,8 @@
left: 0px;
}
.liveModal .ant-col.ant-form-item-label{
- height: 30px;
- line-height: 30px;
+ height: 22px;
+ line-height: 22px;
}
.platform{
background: #fff;
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
index 19ad9d5cf..5c12fe3b9 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js
@@ -399,15 +399,15 @@ class ShixunhomeWorkItem extends Component{
:"":"":"":""
}
- { this.props.isAdmin?
this.hrefjumpskip("/courses/"+this.props.match.params.coursesId+"/"+this.state.shixuntypes+"/"+discussMessage.homework_id+"/list?tab=0")} className="btn colorblue font-16 fontweight400 mr20 fr">查看详情:""}
+ { this.props.isAdmin?
this.hrefjumpskip("/courses/"+this.props.match.params.coursesId+"/"+this.state.shixuntypes+"/"+discussMessage.homework_id+"/list?tab=0")} className="btn colorblue font-16 fontweight400 mr20 fr">作品详情:""}
{
- this.props.isStudent?
this.hrefjumpskip("/courses/"+this.props.match.params.coursesId+"/"+this.state.shixuntypes+"/"+discussMessage.homework_id+"/list?tab=0")} className="btn colorblue font-16 fontweight400 mr20 fr mt2">查看详情:""
+ this.props.isStudent?
this.hrefjumpskip("/courses/"+this.props.match.params.coursesId+"/"+this.state.shixuntypes+"/"+discussMessage.homework_id+"/list?tab=0")} className="btn colorblue font-16 fontweight400 mr20 fr mt2">作品详情:""
}
{
this.props.isNotMember===true? this.props.discussMessage.private_icon===true?""
- :
this.hrefjumpskip("/courses/"+this.props.match.params.coursesId+"/"+this.state.shixuntypes+"/"+discussMessage.homework_id+"/list?tab=0")} className="btn colorblue font-16 fontweight400 mr20 fr">查看详情:""
+ :
this.hrefjumpskip("/courses/"+this.props.match.params.coursesId+"/"+this.state.shixuntypes+"/"+discussMessage.homework_id+"/list?tab=0")} className="btn colorblue font-16 fontweight400 mr20 fr">作品详情:""
}
From 8d8c6af0af216e5588d2898606707a200f7c8bbb Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 14:14:38 +0800
Subject: [PATCH 16/78] 1
---
lib/tasks/statistic_subject_info.rake | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 3fdc46bc3..27496e719 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -24,6 +24,7 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
buffer_size += 1
puts "buffer_size: #{buffer_size}; subject_id: #{subject.id}; s: #{s.last}; subject: #{subject == s.last};"
+ puts "####str: #{str}"
if buffer_size == 1000 || subject == s.last
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str}"
puts sql
From 2c8af11374a563776bfe1cc92d74623cd7cd859c Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 14:21:18 +0800
Subject: [PATCH 17/78] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 27496e719..d188011a7 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -5,12 +5,14 @@ namespace :subjects do
puts("---------------------data_statistic_begin")
Rails.logger.info("---------------------data_statistic_begin")
subjects = Subject.where(status: 2, hidden: 0)
- str = ""
- buffer_size = 0
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
+ str = ""
+ buffer_size = 0
Parallel.each(s, in_processes: 4) do |subject|
+ buffer_size += 1
+ str += ", " unless str.empty?
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -18,11 +20,9 @@ namespace :subjects do
next if study_count == 0
course_study_count = data.course_study_count
initiative_study = study_count - course_study_count
- str += ", " unless str.empty?
str += ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
"#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- buffer_size += 1
puts "buffer_size: #{buffer_size}; subject_id: #{subject.id}; s: #{s.last}; subject: #{subject == s.last};"
puts "####str: #{str}"
if buffer_size == 1000 || subject == s.last
From 8655498b9cb5ba44ec158f24be70a0eee20fa5a3 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 14:30:19 +0800
Subject: [PATCH 18/78] 1
---
lib/tasks/statistic_subject_info.rake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index d188011a7..2c379eb26 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -10,7 +10,7 @@ namespace :subjects do
subjects.find_in_batches(batch_size: 50) do |s|
str = ""
buffer_size = 0
- Parallel.each(s, in_processes: 4) do |subject|
+ Parallel.each_with_index(s, in_processes: 4) do |subject, index|
buffer_size += 1
str += ", " unless str.empty?
puts("---------------------data_statistic: #{subject.id}")
@@ -23,7 +23,7 @@ namespace :subjects do
str += ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
"#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- puts "buffer_size: #{buffer_size}; subject_id: #{subject.id}; s: #{s.last}; subject: #{subject == s.last};"
+ puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
if buffer_size == 1000 || subject == s.last
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str}"
From cf6981c875a25269e163acabc1968599a1928d72 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 14:33:42 +0800
Subject: [PATCH 19/78] 1
---
lib/tasks/statistic_subject_info.rake | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 2c379eb26..f8784d8fe 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -8,9 +8,11 @@ namespace :subjects do
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
- str = ""
- buffer_size = 0
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
+ if subject == s.first
+ buffer_size == 0
+ str == ""
+ end
buffer_size += 1
str += ", " unless str.empty?
puts("---------------------data_statistic: #{subject.id}")
From 536b9afcf97e10605e325da64d11b736975e7459 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 14:37:23 +0800
Subject: [PATCH 20/78] 1
---
lib/tasks/statistic_subject_info.rake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index f8784d8fe..363570d18 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -9,9 +9,9 @@ namespace :subjects do
"school_used_count, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
- if subject == s.first
- buffer_size == 0
- str == ""
+ if defined?(buffer_size).nil?
+ buffer_size = 0
+ str = ""
end
buffer_size += 1
str += ", " unless str.empty?
From 9bf5cefd9039a5b1f230d930b86aaab7d6e7e65d Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 15:07:45 +0800
Subject: [PATCH 21/78] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 363570d18..05f6d6130 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -7,12 +7,10 @@ namespace :subjects do
subjects = Subject.where(status: 2, hidden: 0)
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
+ buffer_size = 0
+ str = ""
subjects.find_in_batches(batch_size: 50) do |s|
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
- if defined?(buffer_size).nil?
- buffer_size = 0
- str = ""
- end
buffer_size += 1
str += ", " unless str.empty?
puts("---------------------data_statistic: #{subject.id}")
From 48e85cb07866fd733d862b91d71293b216b12f25 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 13 Feb 2020 15:29:49 +0800
Subject: [PATCH 22/78] =?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/views/examination_banks/show.json.jbuilder | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/views/examination_banks/show.json.jbuilder b/app/views/examination_banks/show.json.jbuilder
index 2a2da9af9..187e89cc2 100644
--- a/app/views/examination_banks/show.json.jbuilder
+++ b/app/views/examination_banks/show.json.jbuilder
@@ -40,7 +40,9 @@ json.exam do
json.all_questions_count @items.size
json.discipline do
- json.(@exam.sub_discipline&.discipline, :id, :name)
+ if @exam.sub_discipline&.discipline.present?
+ json.(@exam.sub_discipline&.discipline, :id, :name)
+ end
end
json.sub_discipline do
json.(@exam.sub_discipline, :id, :name)
From 7e6bee1ec326da4f6973e3b8b9d5e2c158273c52 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 13 Feb 2020 15:34:25 +0800
Subject: [PATCH 23/78] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E5=BA=93=E7=9A=84?=
=?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/views/examination_banks/show.json.jbuilder | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/views/examination_banks/show.json.jbuilder b/app/views/examination_banks/show.json.jbuilder
index 187e89cc2..eed1b2407 100644
--- a/app/views/examination_banks/show.json.jbuilder
+++ b/app/views/examination_banks/show.json.jbuilder
@@ -45,7 +45,9 @@ json.exam do
end
end
json.sub_discipline do
- json.(@exam.sub_discipline, :id, :name)
+ if @exam.sub_discipline.present?
+ json.(@exam.sub_discipline, :id, :name)
+ end
end
json.tag_disciplines @exam.tag_disciplines do |tag|
json.(tag, :id, :name)
From 0bad948846e97e19d35db277bc7aa00201dabaa5 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 15:35:59 +0800
Subject: [PATCH 24/78] 1
---
lib/tasks/statistic_subject_info.rake | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 05f6d6130..9c96f468b 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -8,11 +8,10 @@ namespace :subjects do
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
buffer_size = 0
- str = ""
+ str = []
subjects.find_in_batches(batch_size: 50) do |s|
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
buffer_size += 1
- str += ", " unless str.empty?
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -20,13 +19,13 @@ namespace :subjects do
next if study_count == 0
course_study_count = data.course_study_count
initiative_study = study_count - course_study_count
- str += ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
+ str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
"#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
if buffer_size == 1000 || subject == s.last
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str}"
+ sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
str = ""
@@ -35,7 +34,7 @@ namespace :subjects do
end
end
if buffer_size > 0
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str}"
+ sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
end
From f6d2fc5c2f724e136fdecfb9c06595655286b9c1 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 15:36:42 +0800
Subject: [PATCH 25/78] 1
---
lib/tasks/statistic_subject_info.rake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 9c96f468b..5a7e0f9eb 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -28,7 +28,7 @@ namespace :subjects do
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
- str = ""
+ str = []
buffer_size = 0
end
end
From aa557661dc4d7bd6c6a2de37a88fa3b0137311e4 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 15:37:19 +0800
Subject: [PATCH 26/78] 1
---
lib/tasks/statistic_subject_info.rake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 5a7e0f9eb..bc32a5c8e 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -25,7 +25,7 @@ namespace :subjects do
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
if buffer_size == 1000 || subject == s.last
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.join(",")}"
+ sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
str = []
@@ -34,7 +34,7 @@ namespace :subjects do
end
end
if buffer_size > 0
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.join(",")}"
+ sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
end
From 66bca608cb9ef22df0b2d1278c8ad27640c80036 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 15:39:26 +0800
Subject: [PATCH 27/78] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=B6=E9=97=B4?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index bc32a5c8e..7e9577c1c 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -24,7 +24,7 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
- if buffer_size == 1000 || subject == s.last
+ if str.size == 100 || subject == s.last
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
From ffb5939a088cb09c5950ffcc958b3ddbbc08eda8 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 13 Feb 2020 15:45:37 +0800
Subject: [PATCH 28/78] =?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/models/live_link.rb | 15 +--------------
app/views/live_links/index.json.jbuilder | 3 +--
2 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/app/models/live_link.rb b/app/models/live_link.rb
index 27963a0bb..3cc17e6b3 100644
--- a/app/models/live_link.rb
+++ b/app/models/live_link.rb
@@ -7,23 +7,10 @@ class LiveLink < ApplicationRecord
validates :url, format: { with: CustomRegexp::URL, message: "必须为网址超链接" }
validates :description, length: { maximum: 100, too_long: "不能超过100个字符" }
validates :course_name, presence: true
- validates :platform, presence: true, inclusion: {in: %W(tencent douyu bilibili vbt)}
+ validates :platform, presence: true
# validates :live_time, presence: true
validates :duration, numericality: { only_integer: true, greater_than: 0}, allow_blank: true
- def platform_name
- case platform
- when "tencent"
- "腾讯课堂"
- when "douyu"
- "斗鱼直播"
- when "vbt"
- "威佰通"
- else
- platform
- end
- end
-
def op_auth?
user == User.current || User.current.admin_or_business?
end
diff --git a/app/views/live_links/index.json.jbuilder b/app/views/live_links/index.json.jbuilder
index 419fb49bb..95891fc8a 100644
--- a/app/views/live_links/index.json.jbuilder
+++ b/app/views/live_links/index.json.jbuilder
@@ -1,5 +1,5 @@
json.lives @lives do |live|
- json.(live, :id, :description, :on_status, :duration, :course_name)
+ json.(live, :id, :description, :on_status, :duration, :course_name, :platform)
json.url live.on_status ? live.url : ""
json.author_name live.user.show_real_name
json.author_login live.user.login
@@ -7,7 +7,6 @@ json.lives @lives do |live|
json.op_auth live.op_auth?
json.delete_auth live.delete_auth?
json.live_time live.live_time&.strftime('%Y-%m-%d %H:%M:%S')
- json.platform live.platform_name
end
json.my_live_id @my_live_id
json.total_count @total_count
\ No newline at end of file
From 6dfb704646d6a83fe78b482edde45e551d7f5f68 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 15:55:23 +0800
Subject: [PATCH 29/78] =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 7e9577c1c..d39e1fe86 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -7,11 +7,9 @@ namespace :subjects do
subjects = Subject.where(status: 2, hidden: 0)
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
- buffer_size = 0
- str = []
subjects.find_in_batches(batch_size: 50) do |s|
+ str = []
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
- buffer_size += 1
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -29,7 +27,6 @@ namespace :subjects do
puts sql
ActiveRecord::Base.connection.execute sql
str = []
- buffer_size = 0
end
end
end
From 5491643af99a9738be6f771323e67dde888cda14 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 16:09:27 +0800
Subject: [PATCH 30/78] 1
---
lib/tasks/statistic_subject_info.rake | 35 ++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index d39e1fe86..ccca9d28b 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -7,9 +7,11 @@ namespace :subjects do
subjects = Subject.where(status: 2, hidden: 0)
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
- subjects.find_in_batches(batch_size: 50) do |s|
+ Parallel.in_processes(4) do |i|
str = []
- Parallel.each_with_index(s, in_processes: 4) do |subject, index|
+ puts("Parallel.worker_number: #{Parallel.worker_number}")
+ subjects.find_in_batches(start: (Parallel.worker_number/4) * subjects.count,
+ finish: ((Parallel.worker_number+1)/4) * subjects.count) do |subject|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -22,15 +24,40 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
- if str.size == 100 || subject == s.last
+ if str.size == 50 || subject == s.last
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
str = []
end
end
+
end
- if buffer_size > 0
+
+ # subjects.find_in_batches(batch_size: 50) do |s|
+ # str = []
+ # Parallel.each_with_index(s, in_processes: 4) do |subject, index|
+ # puts("---------------------data_statistic: #{subject.id}")
+ # Rails.logger.info("---------------------data_statistic: #{subject.id}")
+ # data = Subjects::DataStatisticService.new(subject)
+ # study_count = data.study_count
+ # next if study_count == 0
+ # course_study_count = data.course_study_count
+ # initiative_study = study_count - course_study_count
+ # str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
+ # "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
+ # "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
+ # puts "index: #{index}; worker_number: #{Parallel.worker_number}"
+ # puts "####str: #{str}"
+ # if str.size == 100 || subject == s.last
+ # sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ # puts sql
+ # ActiveRecord::Base.connection.execute sql
+ # str = []
+ # end
+ # end
+ # end
+ if str.size > 0
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
From 6b2d0ffb63b3bb65e9df86c56cea9adaf42e0613 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 16:12:10 +0800
Subject: [PATCH 31/78] 1
---
lib/tasks/statistic_subject_info.rake | 38 ++++++++++++++-------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index ccca9d28b..44c3d2cf7 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -11,24 +11,26 @@ namespace :subjects do
str = []
puts("Parallel.worker_number: #{Parallel.worker_number}")
subjects.find_in_batches(start: (Parallel.worker_number/4) * subjects.count,
- finish: ((Parallel.worker_number+1)/4) * subjects.count) do |subject|
- puts("---------------------data_statistic: #{subject.id}")
- Rails.logger.info("---------------------data_statistic: #{subject.id}")
- data = Subjects::DataStatisticService.new(subject)
- study_count = data.study_count
- next if study_count == 0
- course_study_count = data.course_study_count
- initiative_study = study_count - course_study_count
- str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
- "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
- "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- puts "index: #{index}; worker_number: #{Parallel.worker_number}"
- puts "####str: #{str}"
- if str.size == 50 || subject == s.last
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- puts sql
- ActiveRecord::Base.connection.execute sql
- str = []
+ finish: ((Parallel.worker_number+1)/4) * subjects.count) do |s|
+ s.each do |subject|
+ puts("---------------------data_statistic: #{subject.id}")
+ Rails.logger.info("---------------------data_statistic: #{subject.id}")
+ data = Subjects::DataStatisticService.new(subject)
+ study_count = data.study_count
+ next if study_count == 0
+ course_study_count = data.course_study_count
+ initiative_study = study_count - course_study_count
+ str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
+ "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
+ "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
+ puts "index: #{index}; worker_number: #{Parallel.worker_number}"
+ puts "####str: #{str}"
+ if str.size == 50 || subject == s.last
+ sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ puts sql
+ ActiveRecord::Base.connection.execute sql
+ str = []
+ end
end
end
From b07bec9346b385779a1c8a49da65f721f2fe3955 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 16:13:10 +0800
Subject: [PATCH 32/78] 1
---
lib/tasks/statistic_subject_info.rake | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 44c3d2cf7..7f338652e 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -23,7 +23,6 @@ namespace :subjects do
str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
"#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
if str.size == 50 || subject == s.last
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
From 1c99de4c8453bcee246d432409b4a28ef7553447 Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 16:13:45 +0800
Subject: [PATCH 33/78] =?UTF-8?q?=E5=BF=85=E9=80=89=E7=AD=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/Video/LiveNew.js | 56 +++++++++----------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js
index d505f052d..6d4197171 100644
--- a/public/react/src/modules/courses/Video/LiveNew.js
+++ b/public/react/src/modules/courses/Video/LiveNew.js
@@ -1,5 +1,5 @@
import React,{ Component } from "react";
-import { Modal , Form , Input , Spin , Select , DatePicker , InputNumber } from 'antd';
+import { Modal , Form , Input , Spin , Select , AutoComplete , DatePicker , InputNumber } from 'antd';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
import { handleDateString } from 'educoder';
@@ -9,6 +9,7 @@ import axios from 'axios';
const { TextArea } = Input;
const { Option } = Select;
+const array=['腾讯课堂','B站','斗鱼','威佰通']
function range(start, end) {
const result = [];
@@ -34,17 +35,14 @@ class LiveNew extends Component{
this.state={
isSpining:false,
beginTime:undefined,
- beginTimeFlag:false,
}
}
componentDidMount=()=>{
- console.log("1",this.props.liveId)
this.checkType();
}
componentDidUpdate=(prevState)=>{
- console.log("2",prevState.liveId);
if(prevState && prevState.liveId !== this.props.liveId){
this.setState({
isSpining:true
@@ -55,7 +53,6 @@ class LiveNew extends Component{
checkType=()=>{
const { liveId } = this.props;
- console.log("3",this.props.liveId);
this.clearAll();
if(liveId){
const url =`/live_links/${liveId}/edit.json`;
@@ -64,7 +61,7 @@ class LiveNew extends Component{
this.props.form.setFieldsValue({
url:result.data.url,
description:result.data.description,
- platform:result.data.platform || "tencent",
+ platform:result.data.platform || "腾讯课堂",
duration:result.data.duration,
course_name:result.data.course_name
})
@@ -80,15 +77,12 @@ class LiveNew extends Component{
}
handleSubmit=()=>{
+ this.setState({
+ isSpining:true
+ })
this.props.form.validateFields((err, values) => {
if(!err){
- const { beginTime } = this.state;
- if(!beginTime){
- this.setState({
- beginTimeFlag:true
- })
- return;
- }
+ console.log(values);
const { liveId } = this.props;
if(liveId){
// 修改
@@ -108,6 +102,9 @@ class LiveNew extends Component{
live_time:beginTime
}).then(result=>{
if(result){
+ this.setState({
+ isSpining:false
+ })
this.props.showNotification("修改成功!");
const { setliveVisibel } = this.props;
setliveVisibel && setliveVisibel(false,true);
@@ -127,6 +124,9 @@ class LiveNew extends Component{
live_time:beginTime
}).then(result=>{
if(result){
+ this.setState({
+ isSpining:false
+ })
this.props.showNotification("添加成功!");
const { setliveVisibel } = this.props;
setliveVisibel && setliveVisibel(false,true);
@@ -156,7 +156,7 @@ class LiveNew extends Component{
clearAll=()=>{
this.props.form.setFieldsValue({
course_name:undefined,
- platform:"tencent",
+ platform:"腾讯课堂",
url:undefined,
description:undefined,
duration:undefined
@@ -173,10 +173,15 @@ class LiveNew extends Component{
}
render(){
- const { isSpining , beginTime , beginTimeFlag } = this.state;
+ const { isSpining , beginTime } = this.state;
const {getFieldDecorator} = this.props.form;
const { visible } = this.props;
+ const dataSource = array.map((item,key)=>{
+ return(
+
+ )
+ })
return(
-
-
-
-
+
+
)}
{getFieldDecorator('url', {
- rules: [{required: true, message: "请输入第三方直播链接"}],
+ rules: [],
})(
)}
-
*开播时间
+
开播时间
-
- {
- beginTimeFlag && 请选择开播时间
- }
-
{getFieldDecorator('duration', {
From 8d5c1dd96252060590854e3829a7577741866281 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 16:23:49 +0800
Subject: [PATCH 34/78] 1
---
lib/tasks/statistic_subject_info.rake | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 7f338652e..6ae42653d 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -58,11 +58,11 @@ namespace :subjects do
# end
# end
# end
- if str.size > 0
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- puts sql
- ActiveRecord::Base.connection.execute sql
- end
+ # if str.size > 0
+ # sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ # puts sql
+ # ActiveRecord::Base.connection.execute sql
+ # end
puts("---------------------data_statistic_end")
Rails.logger.info("---------------------data_statistic_end")
end
From 4a7eeb8c908d880f20bef236f3f7b23f0d38bb60 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 16:26:03 +0800
Subject: [PATCH 35/78] 1
---
lib/tasks/statistic_subject_info.rake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 6ae42653d..fb0532177 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -17,7 +17,7 @@ namespace :subjects do
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
study_count = data.study_count
- next if study_count == 0
+ #next if study_count == 0
course_study_count = data.course_study_count
initiative_study = study_count - course_study_count
str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
From a5ed9c1f192ac8740ae30aa0f837c37a964f0119 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 13 Feb 2020 16:27:50 +0800
Subject: [PATCH 36/78] =?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/models/live_link.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/live_link.rb b/app/models/live_link.rb
index 3cc17e6b3..9b59eb8c1 100644
--- a/app/models/live_link.rb
+++ b/app/models/live_link.rb
@@ -4,7 +4,7 @@ class LiveLink < ApplicationRecord
has_many :tidings, as: :container, dependent: :destroy
- validates :url, format: { with: CustomRegexp::URL, message: "必须为网址超链接" }
+ # validates :url, format: { with: CustomRegexp::URL, message: "必须为网址超链接" }
validates :description, length: { maximum: 100, too_long: "不能超过100个字符" }
validates :course_name, presence: true
validates :platform, presence: true
From 15564639ecb9559f89ff8c579a800e6dae9f1bab Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 16:35:26 +0800
Subject: [PATCH 37/78] =?UTF-8?q?=E7=9B=B4=E6=92=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/Video/LiveNew.js | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js
index 6d4197171..589709b24 100644
--- a/public/react/src/modules/courses/Video/LiveNew.js
+++ b/public/react/src/modules/courses/Video/LiveNew.js
@@ -102,14 +102,17 @@ class LiveNew extends Component{
live_time:beginTime
}).then(result=>{
if(result){
- this.setState({
- isSpining:false
- })
this.props.showNotification("修改成功!");
const { setliveVisibel } = this.props;
setliveVisibel && setliveVisibel(false,true);
}
+ this.setState({
+ isSpining:false
+ })
}).catch(error=>{
+ this.setState({
+ isSpining:false
+ })
console.log(error);
})
}
@@ -124,14 +127,17 @@ class LiveNew extends Component{
live_time:beginTime
}).then(result=>{
if(result){
- this.setState({
- isSpining:false
- })
this.props.showNotification("添加成功!");
const { setliveVisibel } = this.props;
setliveVisibel && setliveVisibel(false,true);
}
+ this.setState({
+ isSpining:false
+ })
}).catch(error=>{
+ this.setState({
+ isSpining:false
+ })
console.log(error);
})
}
From 2848643c8d9f1aae3e41906c1844039b783db1c7 Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 16:40:52 +0800
Subject: [PATCH 38/78] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=95=88=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Video/LiveNew.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js
index 589709b24..15c0a8403 100644
--- a/public/react/src/modules/courses/Video/LiveNew.js
+++ b/public/react/src/modules/courses/Video/LiveNew.js
@@ -77,12 +77,11 @@ class LiveNew extends Component{
}
handleSubmit=()=>{
- this.setState({
- isSpining:true
- })
this.props.form.validateFields((err, values) => {
if(!err){
- console.log(values);
+ this.setState({
+ isSpining:true
+ })
const { liveId } = this.props;
if(liveId){
// 修改
From fd8f6014a191b4eeb8632858cf5da1002ed16032 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 16:52:21 +0800
Subject: [PATCH 39/78] 1
---
lib/tasks/statistic_subject_info.rake | 58 ++++++++++++++-------------
1 file changed, 31 insertions(+), 27 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index fb0532177..5f5adf1d4 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -8,10 +8,10 @@ namespace :subjects do
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
Parallel.in_processes(4) do |i|
- str = []
puts("Parallel.worker_number: #{Parallel.worker_number}")
subjects.find_in_batches(start: (Parallel.worker_number/4) * subjects.count,
finish: ((Parallel.worker_number+1)/4) * subjects.count) do |s|
+ str = []
s.each do |subject|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
@@ -24,40 +24,44 @@ namespace :subjects do
"#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "####str: #{str}"
- if str.size == 50 || subject == s.last
+ puts "####str: #{str.size}"
+ puts "#####{subject == s.last}"
+ if subject == s.last
+ put "------------------------------------------------"
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
- str = []
end
end
end
end
- # subjects.find_in_batches(batch_size: 50) do |s|
- # str = []
- # Parallel.each_with_index(s, in_processes: 4) do |subject, index|
- # puts("---------------------data_statistic: #{subject.id}")
- # Rails.logger.info("---------------------data_statistic: #{subject.id}")
- # data = Subjects::DataStatisticService.new(subject)
- # study_count = data.study_count
- # next if study_count == 0
- # course_study_count = data.course_study_count
- # initiative_study = study_count - course_study_count
- # str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
- # "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
- # "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- # puts "index: #{index}; worker_number: #{Parallel.worker_number}"
- # puts "####str: #{str}"
- # if str.size == 100 || subject == s.last
- # sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- # puts sql
- # ActiveRecord::Base.connection.execute sql
- # str = []
- # end
- # end
- # end
+ subjects.find_in_batches(batch_size: 50) do |s|
+ Parallel.in_processes(4) do |i|
+
+ end
+ Parallel.each_with_index(s, in_processes: 4) do |subject, index|
+ puts("---------------------data_statistic: #{subject.id}")
+ Rails.logger.info("---------------------data_statistic: #{subject.id}")
+ data = Subjects::DataStatisticService.new(subject)
+ study_count = data.study_count
+ next if study_count == 0
+ course_study_count = data.course_study_count
+ initiative_study = study_count - course_study_count
+ str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
+ "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
+ "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
+ puts "index: #{index}; worker_number: #{Parallel.worker_number}"
+ puts "####str: #{str}"
+ if str.size == 100 || subject == s.last
+ sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ puts sql
+ ActiveRecord::Base.connection.execute sql
+ str = []
+ end
+ end
+ end
# if str.size > 0
# sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
# puts sql
@@ -77,7 +81,7 @@ namespace :subjects do
"choice_shixun_frequency, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
- Parallel.each(s, in_processes: 4) do |subject|
+ Parallel.each(in_processes: 4) do |subject|
puts("---------------------course_info_statistic: #{subject.id}")
Rails.logger.info("---------------------course_info_statistic: #{subject.id}")
data = Subjects::CourseUsedInfoService.call(subject)
From a2fb0a247c1416eabaf87d977492169d4305aa8d Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 16:55:10 +0800
Subject: [PATCH 40/78] 1
---
lib/tasks/statistic_subject_info.rake | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 5f5adf1d4..341b5eaf9 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -38,9 +38,7 @@ namespace :subjects do
end
subjects.find_in_batches(batch_size: 50) do |s|
- Parallel.in_processes(4) do |i|
-
- end
+ str = []
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
@@ -54,11 +52,10 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
- if str.size == 100 || subject == s.last
+ if subject == s.last
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
- str = []
end
end
end
From 579177bff1fdaf86e60a679697b392db1e40a530 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 17:09:36 +0800
Subject: [PATCH 41/78] =?UTF-8?q?=E6=8F=92=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 63 +++++++++++++--------------
1 file changed, 31 insertions(+), 32 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 341b5eaf9..b559878de 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -7,39 +7,38 @@ namespace :subjects do
subjects = Subject.where(status: 2, hidden: 0)
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
- Parallel.in_processes(4) do |i|
- puts("Parallel.worker_number: #{Parallel.worker_number}")
- subjects.find_in_batches(start: (Parallel.worker_number/4) * subjects.count,
- finish: ((Parallel.worker_number+1)/4) * subjects.count) do |s|
- str = []
- s.each do |subject|
- puts("---------------------data_statistic: #{subject.id}")
- Rails.logger.info("---------------------data_statistic: #{subject.id}")
- data = Subjects::DataStatisticService.new(subject)
- study_count = data.study_count
- #next if study_count == 0
- course_study_count = data.course_study_count
- initiative_study = study_count - course_study_count
- str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
- "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
- "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- puts "####str: #{str}"
- puts "####str: #{str.size}"
- puts "#####{subject == s.last}"
- if subject == s.last
- put "------------------------------------------------"
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- puts sql
- ActiveRecord::Base.connection.execute sql
- end
- end
- end
-
- end
-
+ # Parallel.in_processes(4) do |i|
+ # puts("Parallel.worker_number: #{Parallel.worker_number}")
+ # subjects.find_in_batches(start: (Parallel.worker_number/4) * subjects.count,
+ # finish: ((Parallel.worker_number+1)/4) * subjects.count) do |s|
+ # str = []
+ # s.each do |subject|
+ # puts("---------------------data_statistic: #{subject.id}")
+ # Rails.logger.info("---------------------data_statistic: #{subject.id}")
+ # data = Subjects::DataStatisticService.new(subject)
+ # study_count = data.study_count
+ # #next if study_count == 0
+ # course_study_count = data.course_study_count
+ # initiative_study = study_count - course_study_count
+ # str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
+ # "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
+ # "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
+ # puts "####str: #{str}"
+ # puts "####str: #{str.size}"
+ # puts "#####{subject == s.last}"
+ # if subject == s.last
+ # put "------------------------------------------------"
+ # sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ # puts sql
+ # ActiveRecord::Base.connection.execute sql
+ # end
+ # end
+ # end
+ #
+ # end
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each_with_index(s, in_processes: 4) do |subject, index|
+ Parallel.each_with_index(s, in_threads: 4) do |subject, index|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -52,7 +51,7 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
- if subject == s.last
+ if str.size == 50
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
From 7496098027dd48a2272134d4a4de0e8b9f3ed5f7 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 17:12:39 +0800
Subject: [PATCH 42/78] =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index b559878de..9c818326a 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -51,18 +51,14 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
- if str.size == 50
- sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- puts sql
- ActiveRecord::Base.connection.execute sql
- end
+ end
+ if str.size > 0
+ sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ puts sql
+ ActiveRecord::Base.connection.execute sql
end
end
- # if str.size > 0
- # sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- # puts sql
- # ActiveRecord::Base.connection.execute sql
- # end
+
puts("---------------------data_statistic_end")
Rails.logger.info("---------------------data_statistic_end")
end
From 7c3dc6e023dc431cf08c55386c14a947472303de Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 17:15:15 +0800
Subject: [PATCH 43/78] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/Video/LiveItem.js | 2 +-
.../react/src/modules/courses/Video/LiveNew.js | 8 ++++----
.../src/modules/courses/Video/VideoIndex.js | 16 ++++++++++++++--
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js
index 0bee79fe2..8e70e2972 100644
--- a/public/react/src/modules/courses/Video/LiveItem.js
+++ b/public/react/src/modules/courses/Video/LiveItem.js
@@ -44,7 +44,7 @@ class LiveItem extends Component{
{item.description}
{
- item.on_status?
+ (item.on_status && item.url)?
进入
:
进入
diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js
index 15c0a8403..e9d9bf9b1 100644
--- a/public/react/src/modules/courses/Video/LiveNew.js
+++ b/public/react/src/modules/courses/Video/LiveNew.js
@@ -191,7 +191,7 @@ class LiveNew extends Component{
{getFieldDecorator('course_name', {
- rules: [{required: true, message: "请输入课程名字"}],
+ rules: [{required: true, message: "请输入课程名称"}],
})(
-
+
)}
@@ -230,7 +230,7 @@ class LiveNew extends Component{
{
`
body{
- width: 100%!important;
+ width: calc(100% - 7px)!important;
overflow: hidden!important;
}
- `}:""
+ .-task-sidebar{
+ right:44px!important
+ }
+ `}:
+
}
From cb480355057e501513b8261c4fda7813301ed755 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 13 Feb 2020 17:52:29 +0800
Subject: [PATCH 44/78] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E7=94=A8=E6=88=B7?=
=?UTF-8?q?=E6=89=80=E5=9C=A8=E5=9C=B0=E4=B8=AD=E5=8C=85=E5=90=AB=E7=9C=81?=
=?UTF-8?q?=E3=80=81=E5=B8=82=E7=9A=84=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/migrate/20200213094050_migrate_user_location.rb | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 db/migrate/20200213094050_migrate_user_location.rb
diff --git a/db/migrate/20200213094050_migrate_user_location.rb b/db/migrate/20200213094050_migrate_user_location.rb
new file mode 100644
index 000000000..a15d299a1
--- /dev/null
+++ b/db/migrate/20200213094050_migrate_user_location.rb
@@ -0,0 +1,11 @@
+class MigrateUserLocation < ActiveRecord::Migration[5.2]
+ def change
+ UserExtension.where("location like '%省'").each do |ue|
+ ue.update_column("location", ue.location.chop)
+ end
+
+ UserExtension.where("location_city like '%市'").each do |ue|
+ ue.update_column("location_city", ue.location_city.chop)
+ end
+ end
+end
From 605bf26a28e621d8d3fb2770371fca984405b85a Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:04:18 +0800
Subject: [PATCH 45/78] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=97=B6=E9=97=B4?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 65 ++++++++-------------------
1 file changed, 19 insertions(+), 46 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 9c818326a..330ebf629 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -5,40 +5,14 @@ namespace :subjects do
puts("---------------------data_statistic_begin")
Rails.logger.info("---------------------data_statistic_begin")
subjects = Subject.where(status: 2, hidden: 0)
+ if ENV['subject_id'].present?
+ subjects = subjects.where(id:ENV['subject_id'])
+ end
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
- # Parallel.in_processes(4) do |i|
- # puts("Parallel.worker_number: #{Parallel.worker_number}")
- # subjects.find_in_batches(start: (Parallel.worker_number/4) * subjects.count,
- # finish: ((Parallel.worker_number+1)/4) * subjects.count) do |s|
- # str = []
- # s.each do |subject|
- # puts("---------------------data_statistic: #{subject.id}")
- # Rails.logger.info("---------------------data_statistic: #{subject.id}")
- # data = Subjects::DataStatisticService.new(subject)
- # study_count = data.study_count
- # #next if study_count == 0
- # course_study_count = data.course_study_count
- # initiative_study = study_count - course_study_count
- # str << ("(#{subject.id}, #{study_count}, #{course_study_count}, #{initiative_study}, " +
- # "#{data.passed_count}, #{data.course_used_count}, #{data.school_used_count}, " +
- # "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- # puts "####str: #{str}"
- # puts "####str: #{str.size}"
- # puts "#####{subject == s.last}"
- # if subject == s.last
- # put "------------------------------------------------"
- # sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- # puts sql
- # ActiveRecord::Base.connection.execute sql
- # end
- # end
- # end
- #
- # end
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each_with_index(s, in_threads: 4) do |subject, index|
+ Parallel.each_with_index(s, in_processes: 4) do |subject, index|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -67,38 +41,37 @@ namespace :subjects do
puts("---------------------course_info_statistic_begin")
Rails.logger.info("---------------------course_info_statistic_begin")
subjects = Subject.where(status: 2, hidden: 0)
- str = ""
- buffer_size = 0
column_value = "subject_id, school_id, school_name, course_count, student_count, choice_shixun_num, " +
"choice_shixun_frequency, created_at, updated_at"
-
+ if ENV['subject_id'].present?
+ subjects = subjects.where(id:ENV['subject_id'])
+ end
subjects.find_in_batches(batch_size: 50) do |s|
- Parallel.each(in_processes: 4) do |subject|
+ str = []
+ Parallel.each(s, in_processes: 4) do |subject|
puts("---------------------course_info_statistic: #{subject.id}")
Rails.logger.info("---------------------course_info_statistic: #{subject.id}")
data = Subjects::CourseUsedInfoService.call(subject)
data.each do |key|
next if key[:school_id].nil?
- str += ", " unless str.empty?
- str += ("(#{subject.id}, #{key[:school_id]}, '#{key[:school_name]}', #{key[:course_count]}, " +
+ str << ("(#{subject.id}, #{key[:school_id]}, '#{key[:school_name]}', #{key[:course_count]}, " +
"#{key[:student_count]}, #{key[:choice_shixun_num]}, #{key[:choice_shixun_frequency]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- buffer_size += 1
- if buffer_size == 1000 || key == data.last
- sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str}"
+ if str.size == 1000
+ sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ str_c = str
puts sql
ActiveRecord::Base.connection.execute sql
- str = ""
- buffer_size = 0
+ str -= str_c
end
end
+ if str.size > 0
+ sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ puts sql
+ ActiveRecord::Base.connection.execute sql
+ end
end
end
- if buffer_size > 0
- sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str}"
- puts sql
- ActiveRecord::Base.connection.execute sql
- end
puts("---------------------course_info_statistic_end")
Rails.logger.info("---------------------course_info_statistic_end")
end
From 2eb23337e7e031dd7877e0d9db51a75d445729b0 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:10:37 +0800
Subject: [PATCH 46/78] =?UTF-8?q?=E8=B0=83=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 330ebf629..402be454b 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -48,7 +48,7 @@ namespace :subjects do
end
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each(s, in_processes: 4) do |subject|
+ Parallel.each(s, in_threads: 4) do |subject|
puts("---------------------course_info_statistic: #{subject.id}")
Rails.logger.info("---------------------course_info_statistic: #{subject.id}")
data = Subjects::CourseUsedInfoService.call(subject)
@@ -57,6 +57,7 @@ namespace :subjects do
str << ("(#{subject.id}, #{key[:school_id]}, '#{key[:school_name]}', #{key[:course_count]}, " +
"#{key[:student_count]}, #{key[:choice_shixun_num]}, #{key[:choice_shixun_frequency]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
+ puts "str: #{str}"
if str.size == 1000
sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}"
str_c = str
From 6fdc83b710e8edb4cbe50a6b61a7c3d0ac8ff880 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:13:44 +0800
Subject: [PATCH 47/78] 1
---
app/services/subjects/course_used_info_service.rb | 2 +-
lib/tasks/statistic_subject_info.rake | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/services/subjects/course_used_info_service.rb b/app/services/subjects/course_used_info_service.rb
index 5ae5abe1c..296e1ed94 100644
--- a/app/services/subjects/course_used_info_service.rb
+++ b/app/services/subjects/course_used_info_service.rb
@@ -22,7 +22,7 @@ class Subjects::CourseUsedInfoService < ApplicationService
# choice_shixun_frequency: 选用该课程实训的次数
course_info = []
schools.find_in_batches do |s|
- Parallel.each(s) do |school|
+ s.each do |school|
name = school.name
course_count = school.course_count
student_count = school.courses.joins(:course_members).where(course_members: {role: 4, course_id: course_ids}).size
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 402be454b..e37c6e509 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -48,7 +48,7 @@ namespace :subjects do
end
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each(s, in_threads: 4) do |subject|
+ Parallel.each(s, in_threads: 6) do |subject|
puts("---------------------course_info_statistic: #{subject.id}")
Rails.logger.info("---------------------course_info_statistic: #{subject.id}")
data = Subjects::CourseUsedInfoService.call(subject)
From 9a5362347a75ecf41250dfb2b574e5e7fabb7331 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:14:53 +0800
Subject: [PATCH 48/78] 1
---
lib/tasks/statistic_subject_info.rake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index e37c6e509..0b7ac7a12 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -48,7 +48,7 @@ namespace :subjects do
end
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each(s, in_threads: 6) do |subject|
+ Parallel.each(s, in_processes: 6) do |subject|
puts("---------------------course_info_statistic: #{subject.id}")
Rails.logger.info("---------------------course_info_statistic: #{subject.id}")
data = Subjects::CourseUsedInfoService.call(subject)
From aa5438bad8c30c06bb540d0d4e9d7493277b1cd8 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:18:42 +0800
Subject: [PATCH 49/78] 1
---
lib/tasks/statistic_subject_info.rake | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 0b7ac7a12..cf9d7c32e 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -57,7 +57,6 @@ namespace :subjects do
str << ("(#{subject.id}, #{key[:school_id]}, '#{key[:school_name]}', #{key[:course_count]}, " +
"#{key[:student_count]}, #{key[:choice_shixun_num]}, #{key[:choice_shixun_frequency]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- puts "str: #{str}"
if str.size == 1000
sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}"
str_c = str
From fc72ef1040278da2b2be79afc7f2287f7a2bade1 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, 13 Feb 2020 18:28:06 +0800
Subject: [PATCH 50/78] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 12dc596a6..349c0cdc1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,7 +43,7 @@
/public/react/config/stats.json
/public/react/stats.json
/public/react/.idea/*
-
+/public/h5build
/public/npm-debug.log
# avatars
From 662ffbbea133cbfc8d505a7c2ff64b924a524c83 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:38:01 +0800
Subject: [PATCH 51/78] 1
---
.../subjects/shixun_used_info_service.rb | 2 +-
lib/tasks/statistic_subject_info.rake | 26 +++++++++----------
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/app/services/subjects/shixun_used_info_service.rb b/app/services/subjects/shixun_used_info_service.rb
index 5fa99a120..bd145e622 100644
--- a/app/services/subjects/shixun_used_info_service.rb
+++ b/app/services/subjects/shixun_used_info_service.rb
@@ -11,7 +11,7 @@ class Subjects::ShixunUsedInfoService < ApplicationService
position = stage.position
shixuns = stage.shixuns.includes(myshixuns: :games, homework_commons: :course)
shixuns.find_in_batches(batch_size: 1000) do |s|
- Parallel.each_with_index(s, in_processes: 2) do |shixun, index|
+ s.each_with_index do |shixun, index|
stage = "#{position}-#{index+1}"
name = shixun.name
myshixuns = shixun.myshixuns
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index cf9d7c32e..ca390868b 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -12,7 +12,7 @@ namespace :subjects do
"school_used_count, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each_with_index(s, in_processes: 4) do |subject, index|
+ Parallel.each_with_index(s, in_processes: 6) do |subject, index|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -80,12 +80,11 @@ namespace :subjects do
puts("---------------------shixun_info_statistic_begin")
Rails.logger.info("---------------------shixun_info_statistic_begin")
subjects = Subject.where(status: 2, hidden: 0)
- str = ""
- buffer_size = 0
column_value = "subject_id, shixun_id, stage, shixun_name, challenge_count, course_count, " +
"school_count, used_count, passed_count, evaluate_count, passed_ave_time, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
- Parallel.each_with_index(s, in_processes: 4) do |subject|
+ str = []
+ Parallel.each_with_index(s, in_processes: 6) do |subject|
puts("---------------------shixun_info_statistic: #{subject.id}")
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
data = Subjects::ShixunUsedInfoService.call(subject)
@@ -96,21 +95,20 @@ namespace :subjects do
"#{key[:course_count]}, #{key[:school_count]}, #{key[:used_count]}, #{key[:passed_count]}, " +
"#{key[:evaluate_count]}, #{key[:passed_ave_time]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- buffer_size += 1
- if buffer_size == 1000 || key == data.last
- sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str}"
+ if str.size == 1000
+ sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.uniq.join(",")}"
+ str_c = str
puts sql
ActiveRecord::Base.connection.execute sql
- str = ""
- buffer_size = 0
+ str -= str_c
end
end
end
- end
- if buffer_size > 0
- sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str}"
- puts sql
- ActiveRecord::Base.connection.execute sql
+ if str.size > 0
+ sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.uniq.join(",")}"
+ puts sql
+ ActiveRecord::Base.connection.execute sql
+ end
end
puts("---------------------shixun_info_statistic_end")
Rails.logger.info("---------------------shixun_info_statistic_end")
From 5ef5b68c9495cdd7945d4e297bb6a494d30bad2c Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:38:32 +0800
Subject: [PATCH 52/78] 1
---
lib/tasks/statistic_subject_info.rake | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index ca390868b..3d0f0109c 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -80,6 +80,9 @@ namespace :subjects do
puts("---------------------shixun_info_statistic_begin")
Rails.logger.info("---------------------shixun_info_statistic_begin")
subjects = Subject.where(status: 2, hidden: 0)
+ if ENV['subject_id'].present?
+ subjects = subjects.where(id:ENV['subject_id'])
+ end
column_value = "subject_id, shixun_id, stage, shixun_name, challenge_count, course_count, " +
"school_count, used_count, passed_count, evaluate_count, passed_ave_time, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
From f76349219d6557aae0e8052d01ddf8116fd97a70 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:43:10 +0800
Subject: [PATCH 53/78] 1
---
lib/tasks/statistic_subject_info.rake | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 3d0f0109c..61a8201a6 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -93,17 +93,16 @@ namespace :subjects do
data = Subjects::ShixunUsedInfoService.call(subject)
data.each do |key|
next if key[:shixun_id].nil?
- str += ", " unless str.empty?
- str += ("(#{subject.id}, #{key[:shixun_id]}, '#{key[:stage]}', '#{key[:name]}', #{key[:challenge_count]}, " +
+ str << ("(#{subject.id}, #{key[:shixun_id]}, '#{key[:stage]}', '#{key[:name]}', #{key[:challenge_count]}, " +
"#{key[:course_count]}, #{key[:school_count]}, #{key[:used_count]}, #{key[:passed_count]}, " +
"#{key[:evaluate_count]}, #{key[:passed_ave_time]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
if str.size == 1000
- sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.uniq.join(",")}"
str_c = str
+ str -= str_c
+ sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str_c.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
- str -= str_c
end
end
end
From a06f3c2e265639149e5be232b1199ea7250648bb Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:46:47 +0800
Subject: [PATCH 54/78] =?UTF-8?q?=E8=B0=83=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 61a8201a6..d1db1ac64 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -92,6 +92,7 @@ namespace :subjects do
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
data = Subjects::ShixunUsedInfoService.call(subject)
data.each do |key|
+ puts "###shixun_id: #{key[:shixun_id]}"
next if key[:shixun_id].nil?
str << ("(#{subject.id}, #{key[:shixun_id]}, '#{key[:stage]}', '#{key[:name]}', #{key[:challenge_count]}, " +
"#{key[:course_count]}, #{key[:school_count]}, #{key[:used_count]}, #{key[:passed_count]}, " +
@@ -99,10 +100,10 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
if str.size == 1000
str_c = str
- str -= str_c
sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str_c.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
+ str -= str_c
end
end
end
From 716f0a9626c056e221c09c4b71e92c25bdd2f4c0 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 18:51:34 +0800
Subject: [PATCH 55/78] 1
---
lib/tasks/statistic_subject_info.rake | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index d1db1ac64..52afeda58 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -12,7 +12,7 @@ namespace :subjects do
"school_used_count, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each_with_index(s, in_processes: 6) do |subject, index|
+ Parallel.each_with_index(s, in_threads: 4) do |subject, index|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)
@@ -92,7 +92,6 @@ namespace :subjects do
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
data = Subjects::ShixunUsedInfoService.call(subject)
data.each do |key|
- puts "###shixun_id: #{key[:shixun_id]}"
next if key[:shixun_id].nil?
str << ("(#{subject.id}, #{key[:shixun_id]}, '#{key[:stage]}', '#{key[:name]}', #{key[:challenge_count]}, " +
"#{key[:course_count]}, #{key[:school_count]}, #{key[:used_count]}, #{key[:passed_count]}, " +
@@ -106,11 +105,11 @@ namespace :subjects do
str -= str_c
end
end
- end
- if str.size > 0
- sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.uniq.join(",")}"
- puts sql
- ActiveRecord::Base.connection.execute sql
+ if str.size > 0
+ sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.uniq.join(",")}"
+ puts sql
+ ActiveRecord::Base.connection.execute sql
+ end
end
end
puts("---------------------shixun_info_statistic_end")
From 08187267baae2f82a678d2a4ea4f054aafd08402 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 19:03:12 +0800
Subject: [PATCH 56/78] 1
---
lib/tasks/statistic_subject_info.rake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 52afeda58..109d05f3e 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -87,7 +87,7 @@ namespace :subjects do
"school_count, used_count, passed_count, evaluate_count, passed_ave_time, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
str = []
- Parallel.each_with_index(s, in_processes: 6) do |subject|
+ Parallel.each_with_index(s, in_processes: 4) do |subject|
puts("---------------------shixun_info_statistic: #{subject.id}")
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
data = Subjects::ShixunUsedInfoService.call(subject)
From 384d3634825ed1161767d2415efb26e6b0390f0c Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 19:05:05 +0800
Subject: [PATCH 57/78] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/Video/LiveItem.js | 65 +++++++++++++++++--
.../src/modules/courses/Video/LiveNew.js | 3 +-
2 files changed, 63 insertions(+), 5 deletions(-)
diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js
index 8e70e2972..c6796d747 100644
--- a/public/react/src/modules/courses/Video/LiveItem.js
+++ b/public/react/src/modules/courses/Video/LiveItem.js
@@ -1,11 +1,16 @@
import React,{ Component } from "react";
import { getImageUrl } from 'educoder';
+import { Modal } from 'antd';
import { WordsBtn } from 'educoder';
-import moment from 'moment';
import axios from 'axios';
class LiveItem extends Component{
-
+ constructor(props) {
+ super(props);
+ this.state = {
+ visible:false
+ }
+ }
deleteLive=(id)=>{
this.props.confirm({
@@ -27,12 +32,55 @@ class LiveItem extends Component{
console.log('Cancel');
},
});
+ }
+ alertInfo=()=>{
+ console.log("dddd");
+ this.setState({
+ visible:true
+ })
+ }
+ onDialogOkBtnClick=()=>{
+ this.setState({
+ visible:false,
+ })
}
render(){
const { key, item , setLiveId } = this.props;
+ const { visible } = this.state;
+ console.log(visible);
return(
+
+
+
+
+ {
+ visible ?
+
+ :
+ ""
+ }
{item.course_name}
@@ -44,11 +92,20 @@ class LiveItem extends Component{
{item.description}
{
- (item.on_status && item.url)?
-
进入
+ item.on_status ?
+
+ {
+ item.url ?
+ 进入
+ :
+ 进入
+ }
+
:
进入
}
+
进入
+
diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js
index e9d9bf9b1..0961d0ef7 100644
--- a/public/react/src/modules/courses/Video/LiveNew.js
+++ b/public/react/src/modules/courses/Video/LiveNew.js
@@ -9,7 +9,8 @@ import axios from 'axios';
const { TextArea } = Input;
const { Option } = Select;
-const array=['腾讯课堂','B站','斗鱼','威佰通']
+// ,'威佰通'
+const array=['腾讯课堂','B站','斗鱼'];
function range(start, end) {
const result = [];
From 4e048cf032e4abbf4dc5798a05adb5714c86e766 Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 19:14:59 +0800
Subject: [PATCH 58/78] fix
---
public/react/src/modules/courses/Video/LiveItem.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js
index c6796d747..e78d216dc 100644
--- a/public/react/src/modules/courses/Video/LiveItem.js
+++ b/public/react/src/modules/courses/Video/LiveItem.js
@@ -104,8 +104,6 @@ class LiveItem extends Component{
:
进入
}
- 进入
-
From cfd68702e4a28b655ac0b98895283b73160dd2b0 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 19:33:10 +0800
Subject: [PATCH 59/78] 1
---
lib/tasks/statistic_subject_info.rake | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 109d05f3e..e338754f7 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -86,8 +86,7 @@ namespace :subjects do
column_value = "subject_id, shixun_id, stage, shixun_name, challenge_count, course_count, " +
"school_count, used_count, passed_count, evaluate_count, passed_ave_time, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
- str = []
- Parallel.each_with_index(s, in_processes: 4) do |subject|
+ Parallel.each_with_index(s, in_processes: 4) do |subject, index, str = []|
puts("---------------------shixun_info_statistic: #{subject.id}")
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
data = Subjects::ShixunUsedInfoService.call(subject)
@@ -98,15 +97,13 @@ namespace :subjects do
"#{key[:evaluate_count]}, #{key[:passed_ave_time]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
if str.size == 1000
- str_c = str
- sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str_c.uniq.join(",")}"
+ sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
- str -= str_c
end
end
if str.size > 0
- sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.uniq.join(",")}"
+ sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
end
@@ -120,27 +117,22 @@ namespace :subjects do
puts("---------------------user_info_statistic_begin")
Rails.logger.info("---------------------user_info_statistic_begin")
subjects = Subject.where(status: 2, hidden: 0)
- str = ""
- buffer_size = 0
column_value = "user_id, subject_id, username, passed_myshixun_count, passed_games_count, " +
"code_line_count, evaluate_count, cost_time, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s|
- Parallel.each_with_index(s, in_processes: 4) do |subject, index|
+ str = []
+ Parallel.each(s, in_processes: 4) do |subject|
puts("---------------------user_info_statistic: #{subject.id}")
data = Subjects::UserUsedInfoService.call(subject)
data.each do |key|
next if key[:user_id].nil?
- str += ", " unless str.empty?
- str += ("(#{key[:user_id]}, #{subject.id}, '#{key[:name].gsub(/'/, '"')}', #{key[:passed_myshixun_count]}, " +
+ str << ("(#{key[:user_id]}, #{subject.id}, '#{key[:name].gsub(/'/, '"')}', #{key[:passed_myshixun_count]}, " +
"#{key[:passed_games_count]}, #{key[:code_line_count]}, #{key[:evaluate_count]}, #{key[:cost_time]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- buffer_size += 1
- if buffer_size == 1000 || (key == data.last)
+ if str.size == 1000
sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str}"
ActiveRecord::Base.connection.execute sql
- str = ""
- buffer_size = 0
end
end
end
From f4806076c40ea1dbd86a0ee718e087ccb9613ea9 Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 19:52:50 +0800
Subject: [PATCH 60/78] =?UTF-8?q?=E5=B1=85=E4=B8=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Video/LiveItem.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js
index e78d216dc..098c5fa23 100644
--- a/public/react/src/modules/courses/Video/LiveItem.js
+++ b/public/react/src/modules/courses/Video/LiveItem.js
@@ -48,7 +48,6 @@ class LiveItem extends Component{
render(){
const { key, item , setLiveId } = this.props;
const { visible } = this.state;
- console.log(visible);
return(
直播链接失效
From 8928f1c4919ad7d661ed046dc1e31192c87f45b3 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 19:58:41 +0800
Subject: [PATCH 61/78] 1
---
app/services/subjects/user_used_info_service.rb | 2 +-
lib/tasks/statistic_subject_info.rake | 17 +++++++----------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/app/services/subjects/user_used_info_service.rb b/app/services/subjects/user_used_info_service.rb
index 78dbfe8e9..2e6594575 100644
--- a/app/services/subjects/user_used_info_service.rb
+++ b/app/services/subjects/user_used_info_service.rb
@@ -13,7 +13,7 @@ class Subjects::UserUsedInfoService < ApplicationService
users_info = []
users = User.includes(myshixuns: :games).where(myshixuns: {shixun_id: shixun_ids}, games: {status: 2}, users: {is_test: false})
users.find_in_batches(batch_size: 500) do |u|
- Parallel.each(u, in_processes: 2) do |user|
+ u.each do |user|
myshixuns = user.myshixuns.select{|m| shixun_ids.include?(m.shixun_id)}
name = "#{user.lastname}#{user.firstname}"
passed_myshixun_count = myshixuns.select{|m| m.status == 1}.size
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index e338754f7..f7e6ca100 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -119,29 +119,26 @@ namespace :subjects do
subjects = Subject.where(status: 2, hidden: 0)
column_value = "user_id, subject_id, username, passed_myshixun_count, passed_games_count, " +
"code_line_count, evaluate_count, cost_time, created_at, updated_at"
-
subjects.find_in_batches(batch_size: 50) do |s|
- str = []
- Parallel.each(s, in_processes: 4) do |subject|
+ Parallel.each_with_index(s, in_processes: 4) do |subject, index, str = []|
puts("---------------------user_info_statistic: #{subject.id}")
data = Subjects::UserUsedInfoService.call(subject)
data.each do |key|
- next if key[:user_id].nil?
str << ("(#{key[:user_id]}, #{subject.id}, '#{key[:name].gsub(/'/, '"')}', #{key[:passed_myshixun_count]}, " +
"#{key[:passed_games_count]}, #{key[:code_line_count]}, #{key[:evaluate_count]}, #{key[:cost_time]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
if str.size == 1000
- sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str}"
+ sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str.join(",")}"
ActiveRecord::Base.connection.execute sql
end
end
+ if str > 0
+ sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str.join(",")}"
+ puts sql
+ ActiveRecord::Base.connection.execute sql
+ end
end
end
- if buffer_size > 0
- sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str}"
- puts sql
- ActiveRecord::Base.connection.execute sql
- end
puts("---------------------user_info_statistic_end")
Rails.logger.info("---------------------user_info_statistic_end")
end
From 9380e69a159bc34425392f139bf55687ea105aa8 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 20:00:57 +0800
Subject: [PATCH 62/78] 1
---
lib/tasks/statistic_subject_info.rake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index f7e6ca100..8b3199eae 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -132,7 +132,7 @@ namespace :subjects do
ActiveRecord::Base.connection.execute sql
end
end
- if str > 0
+ if str.size > 0
sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
From 009670eb62efc9c8080201d9c4cdbcc18b5e9fcb Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 20:09:06 +0800
Subject: [PATCH 63/78] 1
---
lib/tasks/statistic_subject_info.rake | 35 ++++++++++++++-------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index 8b3199eae..e4cc3b380 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -57,13 +57,13 @@ namespace :subjects do
str << ("(#{subject.id}, #{key[:school_id]}, '#{key[:school_name]}', #{key[:course_count]}, " +
"#{key[:student_count]}, #{key[:choice_shixun_num]}, #{key[:choice_shixun_frequency]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- if str.size == 1000
- sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}"
- str_c = str
- puts sql
- ActiveRecord::Base.connection.execute sql
- str -= str_c
- end
+ # if str.size == 1000
+ # sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}"
+ # str_c = str
+ # puts sql
+ # ActiveRecord::Base.connection.execute sql
+ # str -= str_c
+ # end
end
if str.size > 0
sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}"
@@ -96,11 +96,11 @@ namespace :subjects do
"#{key[:course_count]}, #{key[:school_count]}, #{key[:used_count]}, #{key[:passed_count]}, " +
"#{key[:evaluate_count]}, #{key[:passed_ave_time]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- if str.size == 1000
- sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.join(",")}"
- puts sql
- ActiveRecord::Base.connection.execute sql
- end
+ # if str.size == 1000
+ # sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.join(",")}"
+ # puts sql
+ # ActiveRecord::Base.connection.execute sql
+ # end
end
if str.size > 0
sql = "REPLACE INTO subject_shixun_infos(#{column_value}) VALUES #{str.join(",")}"
@@ -119,7 +119,7 @@ namespace :subjects do
subjects = Subject.where(status: 2, hidden: 0)
column_value = "user_id, subject_id, username, passed_myshixun_count, passed_games_count, " +
"code_line_count, evaluate_count, cost_time, created_at, updated_at"
- subjects.find_in_batches(batch_size: 50) do |s|
+ subjects.find_in_batches(batch_size: 20) do |s|
Parallel.each_with_index(s, in_processes: 4) do |subject, index, str = []|
puts("---------------------user_info_statistic: #{subject.id}")
data = Subjects::UserUsedInfoService.call(subject)
@@ -127,10 +127,11 @@ namespace :subjects do
str << ("(#{key[:user_id]}, #{subject.id}, '#{key[:name].gsub(/'/, '"')}', #{key[:passed_myshixun_count]}, " +
"#{key[:passed_games_count]}, #{key[:code_line_count]}, #{key[:evaluate_count]}, #{key[:cost_time]}, " +
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
- if str.size == 1000
- sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str.join(",")}"
- ActiveRecord::Base.connection.execute sql
- end
+ # if str.size == 1000
+ # sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str.join(",")}"
+ # ActiveRecord::Base.connection.execute sql
+ # str = []
+ # end
end
if str.size > 0
sql = "REPLACE INTO subject_user_infos(#{column_value}) VALUES #{str.join(",")}"
From edebe313bfdb4b4d65f5b2a6b61ec9361dcdf290 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 20:09:47 +0800
Subject: [PATCH 64/78] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E5=AD=A6=E4=B9=A0=E7=BB=9F=E8=AE=A1=E5=A4=9A=E8=BF=9B=E7=A8=8B?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/statistic_subject_info.rake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake
index e4cc3b380..71fb8ed36 100644
--- a/lib/tasks/statistic_subject_info.rake
+++ b/lib/tasks/statistic_subject_info.rake
@@ -46,7 +46,7 @@ namespace :subjects do
if ENV['subject_id'].present?
subjects = subjects.where(id:ENV['subject_id'])
end
- subjects.find_in_batches(batch_size: 50) do |s|
+ subjects.find_in_batches(batch_size: 20) do |s|
str = []
Parallel.each(s, in_processes: 6) do |subject|
puts("---------------------course_info_statistic: #{subject.id}")
@@ -85,7 +85,7 @@ namespace :subjects do
end
column_value = "subject_id, shixun_id, stage, shixun_name, challenge_count, course_count, " +
"school_count, used_count, passed_count, evaluate_count, passed_ave_time, created_at, updated_at"
- subjects.find_in_batches(batch_size: 50) do |s|
+ subjects.find_in_batches(batch_size: 20) do |s|
Parallel.each_with_index(s, in_processes: 4) do |subject, index, str = []|
puts("---------------------shixun_info_statistic: #{subject.id}")
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
From 753e99819226981d6f101b80d99bc70047dc54c7 Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 20:43:45 +0800
Subject: [PATCH 65/78] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=9A=84=E8=B7=B3?=
=?UTF-8?q?=E8=BD=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/Video/VideoIndex.js | 13 +++++++++++--
public/react/src/modules/message/js/MessagSub.js | 2 ++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js
index 4c7e4a889..5b6cd3491 100644
--- a/public/react/src/modules/courses/Video/VideoIndex.js
+++ b/public/react/src/modules/courses/Video/VideoIndex.js
@@ -47,8 +47,17 @@ class VideoIndex extends Component{
}
componentDidMount=()=>{
- const { type ,page } = this.state;
- this.checkType(type,page);
+ const { search } = this.props.location;
+ const { page } = this.state;
+
+ if(search && search === "?open=live"){
+ this.setState({
+ type:"live"
+ })
+ this.checkType("live",page);
+ }else{
+ this.checkType("video",page);
+ }
}
// 获取直播列表
getLiveList=(page)=>{
diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js
index 3d42b7c98..45310673f 100644
--- a/public/react/src/modules/message/js/MessagSub.js
+++ b/public/react/src/modules/message/js/MessagSub.js
@@ -510,6 +510,8 @@ class MessagSub extends Component {
//分组作业
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}`);
}
+ case 'LiveLink':
+ return window.open(`/courses/${item.belong_container_id}/course_videos?open=live`);
case 'Hack':
if (item.extra && item.parent_container_type !== 'HackDelete') {
return window.open(`/problems/${item.extra}/edit`);
From 4d8ffc1710b4a5126329a9d118fd03fcb45de92d Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 20:56:17 +0800
Subject: [PATCH 66/78] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/myshixuns_controller.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index 350ee581f..e14f0dbdd 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -286,6 +286,7 @@ class MyshixunsController < ApplicationController
message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted"
uid_logger_dubug("112233#{author_name}")
uid_logger_dubug("112233#{author_email}")
+ uid_logger_dubug("daiao_debug: #{@repo_path}: #{path}; #{message}; #{content}; ")
@content = GitService.update_file(repo_path: @repo_path,
file_path: path,
message: message,
From bfbfee98893e3ec38d92b2946dea2f5e132607f9 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 13 Feb 2020 21:16:56 +0800
Subject: [PATCH 67/78] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/myshixuns_controller.rb | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index e14f0dbdd..b7e105f51 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -266,6 +266,7 @@ class MyshixunsController < ApplicationController
end
# 隐藏代码文件 和 VNC的都不需要走版本库
unless @hide_code || (@myshixun.shixun&.vnc_evaluate && params[:evaluate].present?)
+ uid_logger_dubug("#######enter_#{@myshixun.identifier}")
# 远程版本库文件内容
last_content = GitService.file_content(repo_path: @repo_path, path: path)["content"]
@@ -275,8 +276,8 @@ class MyshixunsController < ApplicationController
else
params[:content]
end
- uid_logger_dubug("###11222333####{content}")
- uid_logger_dubug("###222333####{last_content}")
+ uid_logger_dubug("content_#{@myshixun.identifier}: #{content}")
+ uid_logger_dubug("###last_content_#{@myshixun.identifier}####{last_content}")
if content != last_content
@content_modified = 1
@@ -286,7 +287,7 @@ class MyshixunsController < ApplicationController
message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted"
uid_logger_dubug("112233#{author_name}")
uid_logger_dubug("112233#{author_email}")
- uid_logger_dubug("daiao_debug: #{@repo_path}: #{path}; #{message}; #{content}; ")
+ uid_logger_dubug("daiao_debug_#{@myshixun.identifier}: #{@repo_path}: #{path}; #{message}; #{content}; ")
@content = GitService.update_file(repo_path: @repo_path,
file_path: path,
message: message,
From 1d9ef64e3a3183705fdb1742a130d4b7216bbf5b Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Thu, 13 Feb 2020 21:20:52 +0800
Subject: [PATCH 68/78] =?UTF-8?q?=E7=A7=BB=E5=8A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/Video/LiveItem.js | 2 +-
public/react/src/modules/courses/Video/VideoIndex.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js
index 098c5fa23..85cc05bc0 100644
--- a/public/react/src/modules/courses/Video/LiveItem.js
+++ b/public/react/src/modules/courses/Video/LiveItem.js
@@ -74,7 +74,7 @@ class LiveItem extends Component{
overflow: hidden!important;
}
.-task-sidebar{
- right:44px!important
+ right:42px!important
}
`}
diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js
index 5b6cd3491..6807cef7d 100644
--- a/public/react/src/modules/courses/Video/VideoIndex.js
+++ b/public/react/src/modules/courses/Video/VideoIndex.js
@@ -209,7 +209,7 @@ class VideoIndex extends Component{
overflow: hidden!important;
}
.-task-sidebar{
- right:44px!important
+ right:42px!important
}
`}: