From 6ceea6b33e0664eb59984a4b1a306bb9d4a9d3b4 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 1 Aug 2019 10:24:14 +0800 Subject: [PATCH 1/9] =?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/services/users/update_account_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/users/update_account_service.rb b/app/services/users/update_account_service.rb index 7163b7623..d73c9c907 100644 --- a/app/services/users/update_account_service.rb +++ b/app/services/users/update_account_service.rb @@ -52,7 +52,7 @@ 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? + sms_notify_admin if user.user_extension.teacher? end user From 8b7f3bd517f6f1523ca578a34b8f60647f11e613 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 1 Aug 2019 10:45:47 +0800 Subject: [PATCH 2/9] =?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/services/users/update_account_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/users/update_account_service.rb b/app/services/users/update_account_service.rb index d73c9c907..c54353140 100644 --- a/app/services/users/update_account_service.rb +++ b/app/services/users/update_account_service.rb @@ -52,7 +52,7 @@ class Users::UpdateAccountService < ApplicationService if first_full_reward RewardGradeService.call(user, container_id: user.id, container_type: 'Account', score: 500) - sms_notify_admin if user.user_extension.teacher? + sms_notify_admin(user.lastname) if user.user_extension.teacher? end user @@ -68,8 +68,8 @@ class Users::UpdateAccountService < ApplicationService params.slice(*%i[location location_city identity student_id technical_title school_id department_id]) end - def sms_notify_admin - Educoder::Sms.send(mobile:'18182021083', send_type:'teacher_register', name:'管理员') + def sms_notify_admin name + Educoder::Sms.send(mobile:'18182021083', send_type:'teacher_register', name: name, user_name:'管理员') rescue => ex Util.logger_error(ex) end From 9205e7fa29ed837b7549e675fc953f404a305712 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, 1 Aug 2019 10:55:47 +0800 Subject: [PATCH 3/9] =?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/public/css/edu-all.css | 4 ++++ public/stylesheets/educoder/edu-all.css | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 6bc9d30fc..9f129eabc 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -3416,3 +3416,7 @@ a.singlepublishtwo{ .shaiContent li.shaiItem:hover i.iconfont{ color: #4CACFF!important } + +.detail_for_paragraph p{ + white-space: pre-wrap; +} \ No newline at end of file diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 33649a220..fa879a9e5 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -3712,3 +3712,7 @@ a.singlepublishtwo{ .shaiContent li.shaiItem:hover i.iconfont{ color: #4CACFF!important } + +.detail_for_paragraph p{ + white-space: pre-wrap; +} \ No newline at end of file From 38ffa1c5025bc53d4c3b4a381da68f86a33f27d9 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, 1 Aug 2019 10:57:14 +0800 Subject: [PATCH 4/9] =?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/tpm/TPMIndexHOC.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index b122a904a..564e147fc 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -32,14 +32,14 @@ if (!window['indexHOCLoaded']) { // $('head').append($('') // .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?6`)); + .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?7`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?6`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?7`)); // index.html有加载 $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?6`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?7`)); // $('head').append($('') From 584dddb63e93ce296b99a683c38661485d65acb4 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 1 Aug 2019 10:59:47 +0800 Subject: [PATCH 5/9] fix private message order by bug --- .../private_message_details_controller.rb | 2 +- app/services/search_shixun_service.rb | 96 ------------------- 2 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 app/services/search_shixun_service.rb diff --git a/app/controllers/users/private_message_details_controller.rb b/app/controllers/users/private_message_details_controller.rb index 486d23d7f..ee17c8d22 100644 --- a/app/controllers/users/private_message_details_controller.rb +++ b/app/controllers/users/private_message_details_controller.rb @@ -7,7 +7,7 @@ class Users::PrivateMessageDetailsController < Users::BaseController messages = observed_user.private_messages.without_deleted.where(target: target_user) @count = messages.count - @messages = messages.order(send_time: :asc).includes(sender: :user_extension) + @messages = messages.order(send_time: :desc).includes(sender: :user_extension) end private diff --git a/app/services/search_shixun_service.rb b/app/services/search_shixun_service.rb deleted file mode 100644 index 2e77e82d8..000000000 --- a/app/services/search_shixun_service.rb +++ /dev/null @@ -1,96 +0,0 @@ -class SearchShixunService < ApplicationService - include ElasticsearchAble - - attr_reader :user, :params - - def initialize(user, params) - @user = user - @params = params - end - - def call - Shixun.search(keyword, - fields: search_fields, - where: where_clauses, - order: order_clauses, - includes: includes_clauses, - page: page, - per_page: per_page) - end - - private - - def tag_filter_shixun_ids - return [] if params[:tag_level].to_i == 0 || params[:tag_id].blank? - - case params[:tag_level].to_i - when 1 then - Repertoire.find(params[:tag_id]).tag_repertoires.joins(:shixun_tag_repertoires) - .pluck('shixun_tag_repertoires.shixun_id') - when 2 then - SubRepertoire.find(params[:tag_id]).tag_repertoires.joins(:shixun_tag_repertoires) - .pluck('shixun_tag_repertoires.shixun_id') - when 3 then - TagRepertoire.find(params[:tag_id]).shixun_tag_repertoires.pluck(:shixun_id) - else - [] - end - end - - def user_filter_shixun_ids - return [] if params[:order_by] != 'mine' - - user.shixun_members.pluck(:shixun_id) + user.myshixuns.pluck(:shixun_id) - end - - def keyword - params[:keyword].to_s.strip.presence || '*' - end - - def search_fields - %w(name^10 author_name challenge_names description challenge_tag_names) - end - - def where_clauses - hash = {} - - ids = user_filter_shixun_ids + tag_filter_shixun_ids - hash[:id] = ids if ids.present? - - if params[:order_by] == 'mine' - hash[:status] = { not: -1 } - else - hash.merge!(hidden: false, status: 2) - end - - unless params[:status].to_i.zero? - params[:status] = [0, 1] if params[:status].to_i == 1 - hash[:status] = params[:status] - end - - hash[:trainee] = params[:diff].to_i unless params[:diff].to_i.zero? - - hash - end - - def includes_clauses - [] - end - - def order_clauses - hash = { _score: :desc } - publish_order = { type: 'number', order: :desc, script: 'doc["status"].value=="2" ? 1 : 0' } - - sort = params[:sort].to_s.strip == 'asc' ? 'asc' : 'desc' - clauses = - case params[:order_by].presence - when 'new' then { _script: publish_order, created_at: sort } - when 'hot' then { _script: publish_order, myshixuns_count: sort } - when 'mine' then { created_at: sort } - else { _script: publish_order, publish_time: sort } - end - hash.merge!(clauses) - - hash - end -end \ No newline at end of file From 12ac9f6ee8293cc27e91f35e8018d9d97b9bd880 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 1 Aug 2019 11:01:50 +0800 Subject: [PATCH 6/9] add paginate to private message detail api --- app/controllers/users/private_message_details_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users/private_message_details_controller.rb b/app/controllers/users/private_message_details_controller.rb index ee17c8d22..fb87504e2 100644 --- a/app/controllers/users/private_message_details_controller.rb +++ b/app/controllers/users/private_message_details_controller.rb @@ -7,7 +7,7 @@ class Users::PrivateMessageDetailsController < Users::BaseController messages = observed_user.private_messages.without_deleted.where(target: target_user) @count = messages.count - @messages = messages.order(send_time: :desc).includes(sender: :user_extension) + @messages = paginate messages.order(send_time: :desc).includes(sender: :user_extension) end private From 55db1899e8bc9773f598fd713580e09a1632ad01 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 1 Aug 2019 11:02:39 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=AB=98=E6=A0=A1?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 26effd12e..8d1fc719b 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -408,7 +408,7 @@ class ShixunsController < ApplicationController @shixun.update_attributes(shixun_params) @shixun.shixun_info.update_attributes(shixun_info_params) @shixun.shixun_schools.delete_all - if params[:scope_partment].present? && params[:user_scope].to_i == 1 + if params[:scope_partment].present? && params[:shixun][:user_scope].to_i == 1 arr = [] ids = School.where(:name => params[:scope_partment]).pluck(:id).uniq ids.each do |id| From 320b347c5eb32b735bdf7d13e84ca6283e188b5f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 1 Aug 2019 11:06:39 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E9=AB=98=E6=A0=A1=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 8d1fc719b..fca143623 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -408,18 +408,16 @@ class ShixunsController < ApplicationController @shixun.update_attributes(shixun_params) @shixun.shixun_info.update_attributes(shixun_info_params) @shixun.shixun_schools.delete_all - if params[:scope_partment].present? && params[:shixun][:user_scope].to_i == 1 + logger.info("##########scope_partment:###{params[:scope_partment]}") + # scope_partment: 高校的名称 + if params[:scope_partment].present? arr = [] ids = School.where(:name => params[:scope_partment]).pluck(:id).uniq ids.each do |id| arr << { :school_id => id, :shixun_id => @shixun.id } end ShixunSchool.create!(arr) - use_scope = 1 - else - use_scope = 0 end - @shixun.update_attributes!(:use_scope => use_scope) # 超级管理员和运营人员才能保存 中间层服务器pod信息的配置 if current_user.admin? || current_user.business? @shixun.shixun_service_configs.destroy_all From 75ca8925e1a86042bf8cc279c16ed24f8cc3d51a 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, 1 Aug 2019 11:30:25 +0800 Subject: [PATCH 9/9] =?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/message/js/Messagerouting.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/message/js/Messagerouting.js b/public/react/src/modules/message/js/Messagerouting.js index 890350507..949da308d 100644 --- a/public/react/src/modules/message/js/Messagerouting.js +++ b/public/react/src/modules/message/js/Messagerouting.js @@ -150,8 +150,8 @@ class Messagerouting extends Component{ } render() { let{routing,unread_message_count,unread_tiding_count} =this.state; - console.log(this.props); - console.log(routing); + // console.log(this.props); + // console.log(routing); return (