From 998a27f55f81a498830ca7cbf62d5d4fbf5bbb73 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 31 Jul 2019 17:09:06 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E3=80=81=E8=81=8C?= =?UTF-8?q?=E4=B8=9A=E8=AE=A4=E8=AF=81=E5=92=8C=E8=80=81=E5=B8=88=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=9A=84=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- app/services/discusses_service.rb | 2 +- app/services/users/update_account_service.rb | 8 ++++++++ lib/educoder/sms.rb | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index bc5b0a607..396c0900e 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -222,7 +222,7 @@ class SubjectsController < ApplicationController @subject.update_attributes(status: 1) ApplyAction.create(container_type: "ApplySubject", container_id: @subject.id, user_id: current_user.id, status: 0) begin - status = Trustie::Sms.send(mobile: '18711011226', send_type:'publish_subject' , name: '管理员') + status = Educoder::Sms.send(mobile: '18711011226', send_type:'publish_subject' , name: '管理员') rescue => e uid_logger_error("发送验证码出错: #{e}") end diff --git a/app/services/discusses_service.rb b/app/services/discusses_service.rb index c14850a4c..81ac1eb33 100644 --- a/app/services/discusses_service.rb +++ b/app/services/discusses_service.rb @@ -58,7 +58,7 @@ class DiscussesService praise_count: 0, position: params[:position], challenge_id: params[:challenge_id], hidden: !current_user.admin? ) # 发送手机通知 - Trustie::Sms.send(mobile:'18173242757', send_type:'discuss', name:'管理员') + Educoder::Sms.send(mobile:'18173242757', send_type:'discuss', name:'管理员') rescue Exception => e raise(e.message) end diff --git a/app/services/users/update_account_service.rb b/app/services/users/update_account_service.rb index d603cec8c..603f9beaa 100644 --- a/app/services/users/update_account_service.rb +++ b/app/services/users/update_account_service.rb @@ -51,6 +51,8 @@ class Users::UpdateAccountService < ApplicationService if first_full_reward RewardGradeService.call(user, container_id: user.id, container_type: 'Account', score: 500) + + sms_notify_admin if extension.teacher? end user @@ -65,4 +67,10 @@ class Users::UpdateAccountService < ApplicationService def user_extension_attributes params.slice(*%i[location location_city identity student_id technical_title school_id department_id]) end + + def sms_notify_admin + Educoder::Sms.send(mobile:'18175896138', send_type:'teacher_register', name:'管理员') + rescue => ex + Util.logger_error(ex) + end end \ No newline at end of file diff --git a/lib/educoder/sms.rb b/lib/educoder/sms.rb index 7fa1c0edb..63287301d 100644 --- a/lib/educoder/sms.rb +++ b/lib/educoder/sms.rb @@ -21,7 +21,7 @@ module Educoder def self.notify_admin(opt) opt[:name] = '管理员' - opt[:mobile] = ENV['NOTIFY_ADMIN_PHONE'] || EduSetting.get('notify_admin_phone') || '17680641960' + opt[:mobile] = ENV['NOTIFY_ADMIN_PHONE'] || EduSetting.get('notify_admin_phone') || '18711085785' send(opt) end @@ -40,6 +40,8 @@ module Educoder elsif send_type == 'competition_start' params['text'] = "【Edu实训】亲爱的#{user_name},你参与的#{name}将于#{result}开始,请及时参赛" Rails.logger.info "#{params['text']}" + elsif send_type == "teacher_register" + params['text'] = "【Edu实训】亲爱的#{user_name},有新的老师#{name}注册啦,请尽快处理" elsif send_type == 'subject_authorization' || send_type == 'shixun_authorization' params['text'] = "【Edu实训】亲爱的#{user_name},您提交的#{name}#{send_type=='subject_authorization'?'实训路径':'实训'}发布申请#{result},请登录平台查看详情" Rails.logger.info "#{params['text']}" From a3c674e28e9046a2c9a9d8c2d0d8f54aa9ac464b Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 1 Aug 2019 09:17:32 +0800 Subject: [PATCH 2/6] # --- public/react/src/common/TextUtil.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index bb0b3f145..2dab5c4aa 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -9,7 +9,7 @@ export function markdownToHTML(oldContent, selector) { window.$('#md_div').html('') // markdown to html if (selector && oldContent && oldContent.startsWith('
Date: Thu, 1 Aug 2019 09:21:29 +0800 Subject: [PATCH 3/6] p --- public/react/src/App.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/App.css b/public/react/src/App.css index 9d06bfc94..6f63551c6 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -52,6 +52,6 @@ html, body { color: #f5222d; } /* md多空格 */ -.markdown-body { - white-space: pre; +.markdown-body p { + white-space: pre-wrap; } \ No newline at end of file From 081f63b26776e78ba56b286393b79079b0ca7539 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 1 Aug 2019 09:43:08 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=88=90=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BA=BA=E5=91=98=E6=89=8B=E6=9C=BA=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users/update_account_service.rb | 2 +- lib/educoder/sms.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/users/update_account_service.rb b/app/services/users/update_account_service.rb index 603f9beaa..7163b7623 100644 --- a/app/services/users/update_account_service.rb +++ b/app/services/users/update_account_service.rb @@ -69,7 +69,7 @@ class Users::UpdateAccountService < ApplicationService end def sms_notify_admin - Educoder::Sms.send(mobile:'18175896138', send_type:'teacher_register', name:'管理员') + Educoder::Sms.send(mobile:'18182021083', send_type:'teacher_register', name:'管理员') rescue => ex Util.logger_error(ex) end diff --git a/lib/educoder/sms.rb b/lib/educoder/sms.rb index 63287301d..6a47ebec6 100644 --- a/lib/educoder/sms.rb +++ b/lib/educoder/sms.rb @@ -21,7 +21,7 @@ module Educoder def self.notify_admin(opt) opt[:name] = '管理员' - opt[:mobile] = ENV['NOTIFY_ADMIN_PHONE'] || EduSetting.get('notify_admin_phone') || '18711085785' + opt[:mobile] = ENV['NOTIFY_ADMIN_PHONE'] || EduSetting.get('notify_admin_phone') || '18182021083' send(opt) end From 65c0b6647b0a7e6e349224c7140fb631061aa7a4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 1 Aug 2019 09:45:13 +0800 Subject: [PATCH 5/6] =?UTF-8?q?mp3=E3=80=81mp4=E5=AE=9E=E8=AE=AD=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/picture_display.json.jbuilder | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder index 770f0d71b..fee271abf 100644 --- a/app/views/games/picture_display.json.jbuilder +++ b/app/views/games/picture_display.json.jbuilder @@ -25,28 +25,28 @@ elsif @type == "txt" elsif @type =="qrcode" json.qrcode_str @qrcode_str elsif @type == "mp3" || @type == "mp4" - # if @type == "mp4" - # json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171/123.mp4"}] - # json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172/456.mp4"}] - # json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173/789.mp4"}] - # else - # json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174/58099.mp3"}] - # json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] - # json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] - # end - json.orignal_file do - json.array! @orignal_picture do |file| - json.file_url attachment_show_users_path(:file_name => file, :path => @original_path) - end - end - json.user_file do - json.array! @user_picture do |file| - json.file_url attachment_show_users_path(:file_name => file, :path => @user_path, :time => Time.now.to_i) - end - end - json.answer_file do - json.array! @answer_picture do |file| - json.file_url attachment_show_users_path(:file_name => file, :path => @answer_path) - end + if @type == "mp4" + json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171/123.mp4"}] + json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172/456.mp4"}] + json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173/789.mp4"}] + else + json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174/58099.mp3"}] + json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] + json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] end + # json.orignal_file do + # json.array! @orignal_picture do |file| + # json.file_url attachment_show_users_path(:file_name => file, :path => @original_path) + # end + # end + # json.user_file do + # json.array! @user_picture do |file| + # json.file_url attachment_show_users_path(:file_name => file, :path => @user_path, :time => Time.now.to_i) + # end + # end + # json.answer_file do + # json.array! @answer_picture do |file| + # json.file_url attachment_show_users_path(:file_name => file, :path => @answer_path) + # end + #end end \ No newline at end of file From 4c7cca2e0a4a605a1fc9ba1014f3bea67c43ce61 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 1 Aug 2019 09:51:33 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=A4=9A=E5=AA=92?= =?UTF-8?q?=E4=BD=93=E6=B5=8B=E8=AF=95=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/picture_display.json.jbuilder | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder index fee271abf..770f0d71b 100644 --- a/app/views/games/picture_display.json.jbuilder +++ b/app/views/games/picture_display.json.jbuilder @@ -25,28 +25,28 @@ elsif @type == "txt" elsif @type =="qrcode" json.qrcode_str @qrcode_str elsif @type == "mp3" || @type == "mp4" - if @type == "mp4" - json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171/123.mp4"}] - json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172/456.mp4"}] - json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173/789.mp4"}] - else - json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174/58099.mp3"}] - json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] - json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] - end - # json.orignal_file do - # json.array! @orignal_picture do |file| - # json.file_url attachment_show_users_path(:file_name => file, :path => @original_path) - # end - # end - # json.user_file do - # json.array! @user_picture do |file| - # json.file_url attachment_show_users_path(:file_name => file, :path => @user_path, :time => Time.now.to_i) - # end + # if @type == "mp4" + # json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171/123.mp4"}] + # json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172/456.mp4"}] + # json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173/789.mp4"}] + # else + # json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174/58099.mp3"}] + # json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] + # json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] # end - # json.answer_file do - # json.array! @answer_picture do |file| - # json.file_url attachment_show_users_path(:file_name => file, :path => @answer_path) - # end - #end + json.orignal_file do + json.array! @orignal_picture do |file| + json.file_url attachment_show_users_path(:file_name => file, :path => @original_path) + end + end + json.user_file do + json.array! @user_picture do |file| + json.file_url attachment_show_users_path(:file_name => file, :path => @user_path, :time => Time.now.to_i) + end + end + json.answer_file do + json.array! @answer_picture do |file| + json.file_url attachment_show_users_path(:file_name => file, :path => @answer_path) + end + end end \ No newline at end of file