From 4998daa1a3a7fd2063bfe7fa7c098196f2649924 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 20 Aug 2019 08:32:13 +0800 Subject: [PATCH 01/15] update .gitignore --- config/aliyun_vod.yml | 16 ---------------- log/.keep | 0 2 files changed, 16 deletions(-) delete mode 100644 config/aliyun_vod.yml delete mode 100644 log/.keep diff --git a/config/aliyun_vod.yml b/config/aliyun_vod.yml deleted file mode 100644 index aa6547a62..000000000 --- a/config/aliyun_vod.yml +++ /dev/null @@ -1,16 +0,0 @@ -defaults: &defaults - access_key_id: 'test' - access_key_secret: 'test' - base_url: 'http://vod.cn-shanghai.aliyuncs.com' - cate_id: '-1' - callback_url: 'http://47.96.87.25:48080/api/callbacks/aliyun_vod.json' - signature_key: 'test12345678' - -development: - <<: *defaults - -test: - <<: *defaults - -production: - <<: *defaults \ No newline at end of file diff --git a/log/.keep b/log/.keep deleted file mode 100644 index e69de29bb..000000000 From f461ffe1ed063ac8c7a419e8d26519d86bc4f5ef Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 20 Aug 2019 09:32:03 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_course.rake | 12 ++--- lib/tasks/user.rake | 86 ++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 lib/tasks/user.rake diff --git a/lib/tasks/public_course.rake b/lib/tasks/public_course.rake index 0f10b84ad..6a16fcd3b 100644 --- a/lib/tasks/public_course.rake +++ b/lib/tasks/public_course.rake @@ -58,7 +58,7 @@ namespace :public_course do # 更新某个课程的某类时间 - # 执行示例 bundle exec rake public_course:time args=-1,2932,1,1 + # 执行示例 RAILS_ENV=production bundle exec rake public_course:time args=-1,2932,1,1 task :time => :environment do # course_id = ENV['args'].split(",")[0] # 对应课堂的id # type = ENV['args'].split(",")[1] @@ -70,13 +70,13 @@ namespace :public_course do # 讨论区 created_on = random_time start_time, end_time messages = Message.where(board_id: course.boards) - message_details = MessageDetail.where(message_id: messages) - messages.update_columns(created_on: created_on, updated_on: created_on) - message_details.update_columns(created_at: created_on, updated_at: created_on) - + messages.each do |message| + message.update_columns(created_on: created_on, updated_on: created_on) + MessageDetail.where(message_id: message.id).update_all(created_at: created_on, updated_at: created_on) + end when 2 # 作业 - course.homework_commons.each do |homework| + course.homework_commons.each do |homework| created_at = random_time(start_time, end_time) publish_time = random_larger_time created_at, start_time, end_time end_time = random_larger_time publish_time, start_time, end_time diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake new file mode 100644 index 000000000..8cd1d90ae --- /dev/null +++ b/lib/tasks/user.rake @@ -0,0 +1,86 @@ +# add test user +namespace :sync do + task :add_user => :environment do + DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + user_count = ENV['args'].split(",")[0].to_i # 用户数 + rand_chart = ENV['args'].split(",")[1] # 手机号或者邮箱等前面的随机数 + + puts rand_chart + puts user_count + + (1..user_count).each do |i| + puts i + + no = sprintf("%04d", i) + phone = "#{rand_chart}160731#{no}" + mail = "#{rand_chart}#{no}@educoder.net" + code = generate_identifier User, 8 + login = "m" + code + + + l = "赵,钱,孙,李,周,吴,郑,王,冯,陈,褚,卫,蒋,沈,韩,杨,朱,秦,尤,许,何,吕,施,张,孔,曹,严,华,金,魏,陶,姜,黄".split(",") + f = "爱童,安妮,若婷,安煜,博,雷,梅,静,士红,大龙,冰波,慧娟,梅,婧婧,军,淋,真,维,涛,程程, + 谷南,慕儿,夏岚,友儿,小萱,紫青,妙菱,冬寒,曼柔,语蝶,青筠,夜安,觅海,问安,晓槐,雅山,访云,翠容,寒凡,晓绿,以菱, + 冬云,含玉,访枫,含卉,夜白,冷安,灵竹,醉薇,元珊,幻波,盼夏,元瑶,迎曼,水云,访琴,谷波,乐之,笑白,之山,妙海,紫霜, + 平夏,凌旋,孤丝,怜寒,向萍,凡松,青丝,翠安,如天,凌雪,绮菱,代云,南莲,寻南,春文,香薇,冬灵,凌珍,采绿,天春,沛文, + 紫槐,幻柏,采文,春梅,雪旋,盼海,映梦,安雁,映容,凝阳,访风,天亦,平绿,盼香,觅风,小霜,雪萍,半雪,山柳,谷雪,靖易, + 白薇,梦菡,飞绿,如波,又晴,友易,香菱,冬亦,问,妙春,海冬,半安,平春,幼柏,秋灵,凝芙,念烟,白山,从灵,尔芙,迎蓉, + 念寒,翠绿,翠芙,靖儿,妙柏,千凝,小珍,天巧,妙旋,雪枫,夏菡,元绿,痴灵,绮琴,雨双,听枫,觅荷,凡之,晓凡,雅彤,香薇, + 孤风,从安,绮彤,之玉,雨珍,幻丝,代梅,香波,青亦,元菱,海瑶,飞槐,听露,梦岚,幻竹,新冬,盼翠,谷云".split(",") + + lastname = l[rand(l.length)].strip + f[rand(f.length)].strip + + edit_params = { + login: login, + admin: false, + type: User, + phone: phone, + lastname: lastname, + mail: mail, + authentication: 1, + professional_certification: 1, + profile_completed: true, + is_test: true + } + User.create!(edit_params) + puts "aa" + UserExtension.create!(user_id: @user.id, school_id: 117) + puts i + end + + + user = User.new(admin: false, login: login, mail: email, phone: phone, type: "User") + user.password = "edu12345678" + # 现在因为是验证码,所以在注册的时候就可以激活 + user.status = 1 + # 必须要用save操作,密码的保存是在users中 + if user.save! + # todo user_extension + UserExtension.create!(user_id: @user.id) + + # 注册时,记录是否是引流用户 + ip = request.remote_ip + ua = UserAgent.find_by_ip(ip) + ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua + successful_authentication(@user) + session[:user_id] = @user.id + normal_status("注册成功") + end + end + + # 随机生成字符 + def generate_identifier(container, num) + code = DCODES.sample(num).join + if container == User + while container.exists?(login: code) do + code = DCODES.sample(num).join + end + else + while container.exists?(identifier: code) do + code = DCODES.sample(num).join + end + end + code + end + +end \ No newline at end of file From cee025b35fcbca5003c974257f792ca20b4745b5 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 20 Aug 2019 09:45:06 +0800 Subject: [PATCH 03/15] ogm --- .../react/src/modules/user/usersInfo/video/VideoUploadList.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index dcf195deb..bcfb0deb2 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -61,6 +61,10 @@ function VideoUploadList (props) { // alert("请先选择需要上传的文件!") return } + if (file.type && file.type.indexOf('ogm') != -1) { + showNotification(`不支持的视频格式`) + return; + } if (file.size > 200 * 1024 * 1024) { // 超过200m TODO clearInput() From 3277299ce8c5f601eca4f20622fb0dcd13f78dc7 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 20 Aug 2019 09:52:23 +0800 Subject: [PATCH 04/15]
--- public/react/src/modules/user/usersInfo/video/VideoUpload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/video/VideoUpload.js b/public/react/src/modules/user/usersInfo/video/VideoUpload.js index ec63454f9..26036529a 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUpload.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUpload.js @@ -37,7 +37,7 @@ function VideoUpload (props) {
-
+
标题: {String(title.length)}/{MAX_LENGTH} From b4a84fa8d6fd0438a712dd18aa31200d4f8f08e6 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 20 Aug 2019 10:15:55 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E7=81=AB=E7=8B=90=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/react/src/App.css b/public/react/src/App.css index cb36f7d63..a6f1d45e7 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -73,4 +73,13 @@ html, body { } .formItemInline .ant-form-item-control-wrapper { flex: 1; +} + + +/* 兼容性 */ +/* 火狐有滚动条时高度问题 */ +@-moz-document url-prefix() { + .newContainers { + min-height: calc(100% - 60px) !important; + } } \ No newline at end of file From d6427285884987bf2f579437eb2d14d3060e0108 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 20 Aug 2019 10:19:01 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/user.rake | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake index 8cd1d90ae..7e2cd2c57 100644 --- a/lib/tasks/user.rake +++ b/lib/tasks/user.rake @@ -42,30 +42,11 @@ namespace :sync do profile_completed: true, is_test: true } - User.create!(edit_params) + user = User.create!(edit_params) puts "aa" - UserExtension.create!(user_id: @user.id, school_id: 117) + UserExtension.create!(user_id: user.id, school_id: 117) puts i end - - - user = User.new(admin: false, login: login, mail: email, phone: phone, type: "User") - user.password = "edu12345678" - # 现在因为是验证码,所以在注册的时候就可以激活 - user.status = 1 - # 必须要用save操作,密码的保存是在users中 - if user.save! - # todo user_extension - UserExtension.create!(user_id: @user.id) - - # 注册时,记录是否是引流用户 - ip = request.remote_ip - ua = UserAgent.find_by_ip(ip) - ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua - successful_authentication(@user) - session[:user_id] = @user.id - normal_status("注册成功") - end end # 随机生成字符 From 39b239c2d7deda65739876a744d02d8d2188e5bb Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 20 Aug 2019 10:29:05 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/user/usersInfo/video/VideoUploadList.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index bcfb0deb2..8ad7ea9c2 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -61,7 +61,14 @@ function VideoUploadList (props) { // alert("请先选择需要上传的文件!") return } - if (file.type && file.type.indexOf('ogm') != -1) { + // avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm + if (file.name + && file.name.indexOf('.avi') == -1 && file.name.indexOf('.flv') == -1 + && file.name.indexOf('.f4v') == -1 && file.name.indexOf('.m4v') == -1 + && file.name.indexOf('.mov') == -1 && file.name.indexOf('.mp4') == -1 + && file.name.indexOf('.rmvb') == -1 && file.name.indexOf('.swf') == -1 + && file.name.indexOf('.webm') == -1 + ) { showNotification(`不支持的视频格式`) return; } From 46c16c4075b629d71e6d5f5d8c2c2576e8373f6f Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 20 Aug 2019 10:39:29 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_course.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/public_course.rake b/lib/tasks/public_course.rake index 6a16fcd3b..24fa3e844 100644 --- a/lib/tasks/public_course.rake +++ b/lib/tasks/public_course.rake @@ -69,6 +69,7 @@ namespace :public_course do when 1 # 讨论区 created_on = random_time start_time, end_time + puts created_on messages = Message.where(board_id: course.boards) messages.each do |message| message.update_columns(created_on: created_on, updated_on: created_on) From 40771b31c76b0e7434d85d1d4985346d9d6ba220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 20 Aug 2019 10:54:09 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/PathDetail/PathDetailIndex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 43128e446..34564a79d 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -497,7 +497,7 @@ class PathDetailIndex extends Component{
} { - this.props.checkIfLogin()===false?"123213":progress === undefined ? "" : progress === null ? "" : + this.props.checkIfLogin()===false?"":progress === undefined ? "" : progress === null ? "" :

我的进展 From 1c2ffd1563e4535adf0081e7b88d3983389fec18 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 20 Aug 2019 11:04:54 +0800 Subject: [PATCH 10/15] false --- public/react/src/context/TPIContextProvider.js | 2 ++ public/react/src/modules/page/MainContentContainer.js | 1 + 2 files changed, 3 insertions(+) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 006c0af49..724f8bc11 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -539,6 +539,8 @@ pop_box_new(htmlvalue, 480, 182); .then((response) => { // {"status":1,"message":"Unauthorized. \u7528\u6237\u8ba4\u8bc1\u5931\u8d25."} + window.__fetchAllFlag = false; + if (response.data.status == 403) { window.location.href = "/403"; return; diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 0211b3801..33257703d 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -298,6 +298,7 @@ class MainContentContainer extends Component { }).then((fetchRepositoryCodeResponse) => { // monaca 需要刷新,不然无法编辑 if (this.retryAndRefresh && fetchRepositoryCodeResponse.data.content) { + this.retryAndRefresh = false; window.location.reload() return; } From ff6649cd2c3eef3513f95e8884041b5efd40c79a Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 20 Aug 2019 11:16:34 +0800 Subject: [PATCH 11/15] modify bind email and phone error tip --- app/libs/util.rb | 9 +++++++++ app/services/users/bind_email_service.rb | 2 +- app/services/users/bind_phone_service.rb | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/libs/util.rb b/app/libs/util.rb index 6c7784606..f39ce2b58 100644 --- a/app/libs/util.rb +++ b/app/libs/util.rb @@ -42,4 +42,13 @@ module Util return '' if str.blank? str.gsub(/<\/?.*?>/, '').gsub(/[\n\t\r]/, '').gsub(/ /, '') end + + def conceal(str, type = nil) + str = str.to_s + case type + when :phone then "#{str[0..2]}***#{str[-4..-1]}" + when :email then "#{str[0..2]}***#{str[str.rindex('@')..-1]}" + else "#{str[0..2]}***#{str[-3..-1]}" + end + end end \ No newline at end of file diff --git a/app/services/users/bind_email_service.rb b/app/services/users/bind_email_service.rb index 4c8124ffa..ed1c46404 100644 --- a/app/services/users/bind_email_service.rb +++ b/app/services/users/bind_email_service.rb @@ -11,7 +11,7 @@ class Users::BindEmailService < ApplicationService def call Users::BindEmailForm.new(params).validate! - raise Error, '该邮箱已被绑定' if User.where.not(id: user.id).exists?(mail: params[:email]) + raise Error, '该邮箱已被其他账号绑定' if User.where.not(id: user.id).exists?(mail: params[:email]) code = VerificationCode.where(email: params[:email], code: params[:code], code_type: 5).last raise Error, '验证码无效' unless code&.effective? diff --git a/app/services/users/bind_phone_service.rb b/app/services/users/bind_phone_service.rb index af4292230..2294e4b3c 100644 --- a/app/services/users/bind_phone_service.rb +++ b/app/services/users/bind_phone_service.rb @@ -11,7 +11,7 @@ class Users::BindPhoneService < ApplicationService def call Users::BindPhoneForm.new(params).validate! - raise Error, '该手机号已被绑定' if User.where.not(id: user.id).exists?(phone: params[:phone]) + raise Error, '该手机号已被其他账号绑定' if User.where.not(id: user.id).exists?(phone: params[:phone]) code = VerificationCode.where(phone: params[:phone], code: params[:code], code_type: 4).last raise Error, '验证码无效' unless code&.effective? From ac9a9b2e18b249d9b20eb37c7317ee67aab9aced Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 20 Aug 2019 11:21:51 +0800 Subject: [PATCH 12/15] test host --- public/react/src/common/UrlTool.js | 1 + public/react/src/common/educoder.js | 2 +- public/react/src/modules/page/main/Webssh.js | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index 1a910f224..fc2100694 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -1,4 +1,5 @@ const isDev = window.location.port == 3007; +export const TEST_HOST = "http://47.96.87.25:48080" export function getImageUrl(path) { // https://www.educoder.net // https://testbdweb.trustie.net diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index ae690e8ae..6f3284db2 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -4,7 +4,7 @@ import { from } from '_array-flatten@2.1.2@array-flatten'; export { getImageUrl as getImageUrl, getUrl as getUrl, getUrl2 as getUrl2, setImagesUrl as setImagesUrl , getUploadActionUrl as getUploadActionUrl, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth - , getTaskUrlById as getTaskUrlById } from './UrlTool'; + , getTaskUrlById as getTaskUrlById, TEST_HOST } from './UrlTool'; export { default as queryString } from './UrlTool2'; export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC'; diff --git a/public/react/src/modules/page/main/Webssh.js b/public/react/src/modules/page/main/Webssh.js index ef38ccba9..51119a056 100644 --- a/public/react/src/modules/page/main/Webssh.js +++ b/public/react/src/modules/page/main/Webssh.js @@ -1,11 +1,11 @@ import React, { Component } from 'react'; - +import { TEST_HOST } from 'educoder' export function loadSshScript(callback) { let _url_origin = ``; let prefix = 'react/build' if (window.location.port == 3007) { - prefix = '' - _url_origin = 'https://newweb.educoder.net/'; + // prefix = '' + _url_origin = TEST_HOST + '/' // 'https://newweb.educoder.net/'; } else { // _url_origin = `https://testeduplus2.educoder.net/`; _url_origin = '/'; From 68a848e0b75ef08bc4f1f456bd7d802f0bc90915 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 20 Aug 2019 12:07:05 +0800 Subject: [PATCH 13/15] ali cdn test --- public/react/scripts/build.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index 8f2e93942..c18479299 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -193,10 +193,10 @@ function generateNewIndexJsp() { } const newVersion = '1.1.1' let cdnHost = 'https://shixun.educoder.net' - cdnHost = 'http://cdn.educoder.net' - cdnHost = '' + cdnHost = 'https://ali-cdn.educoder.net' + // cdnHost = '' var result = data.replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) - .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) + // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) .replace('/css/css_min_all.css', `${cdnHost}/react/build/css/css_min_all.css?v=${newVersion}`) .replace('/css/iconfont.css', `${cdnHost}/react/build/css/iconfont.css?v=${newVersion}`) From 1acd53d7c86244e72a827ef71338530aa1b98faa Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 20 Aug 2019 13:55:06 +0800 Subject: [PATCH 14/15] =?UTF-8?q?rake=20=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_course.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/public_course.rake b/lib/tasks/public_course.rake index 6a16fcd3b..67d5603ab 100644 --- a/lib/tasks/public_course.rake +++ b/lib/tasks/public_course.rake @@ -42,7 +42,7 @@ namespace :public_course do begin CourseMember.create!(course_id: course_id, user_id: user_id, role: 4) rescue Exception => e - Rails.logger() + Rails.logger(e.message) end end end @@ -69,6 +69,7 @@ namespace :public_course do when 1 # 讨论区 created_on = random_time start_time, end_time + puts created_on messages = Message.where(board_id: course.boards) messages.each do |message| message.update_columns(created_on: created_on, updated_on: created_on) @@ -133,5 +134,4 @@ namespace :public_course do end large_time end -end - +end \ No newline at end of file From 897c69990ad53b7870af14ce5a82a5a3c31d0049 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 20 Aug 2019 14:17:21 +0800 Subject: [PATCH 15/15] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=BD=AE=E8=AE=AD=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_course.rake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/tasks/public_course.rake b/lib/tasks/public_course.rake index 67d5603ab..ff50a4e28 100644 --- a/lib/tasks/public_course.rake +++ b/lib/tasks/public_course.rake @@ -68,12 +68,15 @@ namespace :public_course do case type.to_i when 1 # 讨论区 - created_on = random_time start_time, end_time - puts created_on messages = Message.where(board_id: course.boards) messages.each do |message| + created_on = random_time start_time, end_time + puts created_on message.update_columns(created_on: created_on, updated_on: created_on) - MessageDetail.where(message_id: message.id).update_all(created_at: created_on, updated_at: created_on) + MessageDetail.where(message_id: message.id).each do |detail| + rand_created_on = random_time start_time, end_time + detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on) + end end when 2 # 作业