From 29e707a88d7a0add21c4bdab4e03ba1ee54f7b10 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 3 Aug 2016 16:31:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A0=E5=85=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BF=AE=E6=94=B9=E3=80=81=E4=BA=8C=E7=BA=A7=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E4=B8=89=E4=B8=AA=E5=9B=9E=E5=A4=8D=E6=97=B6=E5=A4=9A?= =?UTF-8?q?=E4=BA=86=E4=B8=AA=E8=BE=B9=E6=A1=86BUG=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/blog_comment.rb | 10 +++++++--- app/api/mobile/entities/jours.rb | 10 +++++++--- app/api/mobile/entities/message.rb | 10 +++++++--- app/api/mobile/entities/project.rb | 2 +- app/services/projects_service.rb | 6 +++--- public/assets/wechat/join_project.html | 2 +- public/assets/wechat/project.html | 8 ++++---- .../wechat/controllers/edit_project_member.js | 3 ++- public/javascripts/wechat/controllers/join_class.js | 5 +++-- public/javascripts/wechat/controllers/join_project.js | 6 ++++-- public/javascripts/wechat/controllers/project_list.js | 9 ++++++--- 11 files changed, 45 insertions(+), 26 deletions(-) diff --git a/app/api/mobile/entities/blog_comment.rb b/app/api/mobile/entities/blog_comment.rb index 726949bb5..14bc9decb 100644 --- a/app/api/mobile/entities/blog_comment.rb +++ b/app/api/mobile/entities/blog_comment.rb @@ -85,7 +85,7 @@ module Mobile #取二级回复的底楼层 parents_reply = [] parents_reply = get_reply_parents_no_root(parents_reply, c) - if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom] + if parents_reply.count > 0 && !opt[:bottom] if opt[:type] == 1 # opt[:bottom] = true # parents_reply[opt[:page]..opt[:page]] @@ -104,9 +104,9 @@ module Mobile #取二级回复的顶楼层 parents_reply = [] parents_reply = get_reply_parents_no_root(parents_reply, c) - if parents_reply.count >= 2 && !opt[:top] + if parents_reply.count > 2 && !opt[:top] if opt[:type] == 1 - opt[:bottom] = true + opt[:top] = true tStart = (opt[:page]-1)*5+2 tEnd = (opt[:page])*5+2 - 1 @@ -125,6 +125,10 @@ module Mobile parents_reply = parents_reply.reverse[0..1] parents_reply.reverse end + elsif parents_reply.count == 2 && !opt[:top] + opt[:top] = true + parents_reply = parents_reply.reverse[0..0] + parents_reply.reverse else [] end diff --git a/app/api/mobile/entities/jours.rb b/app/api/mobile/entities/jours.rb index 0e4c699c2..6379e88e4 100644 --- a/app/api/mobile/entities/jours.rb +++ b/app/api/mobile/entities/jours.rb @@ -101,7 +101,7 @@ module Mobile elsif opt[:comment_type] == "homework" parents_reply = get_reply_parents(parents_reply, f) end - if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom] + if parents_reply.count > 0 && !opt[:bottom] if opt[:type] == 1 # opt[:bottom] = true # parents_reply[opt[:page]..opt[:page]] @@ -125,9 +125,9 @@ module Mobile elsif opt[:comment_type] == "homework" parents_reply = get_reply_parents(parents_reply, f) end - if parents_reply.count >= 2 && !opt[:top] + if parents_reply.count > 2 && !opt[:top] if opt[:type] == 1 - opt[:bottom] = true + opt[:top] = true tStart = (opt[:page]-1)*5+2 tEnd = (opt[:page])*5+2 - 1 @@ -146,6 +146,10 @@ module Mobile parents_reply = parents_reply.reverse[0..1] parents_reply.reverse end + elsif parents_reply.count == 2 && !opt[:top] + opt[:top] = true + parents_reply = parents_reply.reverse[0..0] + parents_reply.reverse else [] end diff --git a/app/api/mobile/entities/message.rb b/app/api/mobile/entities/message.rb index c2744f63a..4571dedfe 100644 --- a/app/api/mobile/entities/message.rb +++ b/app/api/mobile/entities/message.rb @@ -92,7 +92,7 @@ module Mobile #取二级回复的底楼层 parents_reply = [] parents_reply = get_reply_parents_no_root(parents_reply, c) - if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom] + if parents_reply.count > 0 && !opt[:bottom] if opt[:type] == 1 # opt[:bottom] = true # parents_reply[opt[:page]..opt[:page]] @@ -111,9 +111,9 @@ module Mobile #取二级回复的顶楼层 parents_reply = [] parents_reply = get_reply_parents_no_root(parents_reply, c) - if parents_reply.count >= 2 && !opt[:top] + if parents_reply.count > 2 && !opt[:top] if opt[:type] == 1 - opt[:bottom] = true + opt[:top] = true tStart = (opt[:page]-1)*5+2 tEnd = (opt[:page])*5+2 - 1 @@ -132,6 +132,10 @@ module Mobile parents_reply = parents_reply.reverse[0..1] parents_reply.reverse end + elsif parents_reply.count == 2 && !opt[:top] + opt[:top] = true + parents_reply = parents_reply.reverse[0..0] + parents_reply.reverse else [] end diff --git a/app/api/mobile/entities/project.rb b/app/api/mobile/entities/project.rb index 073f7cd0f..55ab67be2 100644 --- a/app/api/mobile/entities/project.rb +++ b/app/api/mobile/entities/project.rb @@ -5,7 +5,7 @@ module Mobile expose :id expose :user_id expose :invite_code - expose :qrcode + # expose :qrcode expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options| current_user = options[:user] diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 7358bc15c..2df36eb5e 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -17,7 +17,7 @@ class ProjectsService def show_project(params,current_user) project = Project.find(params[:id]) project.generate_invite_code - project.generate_qrcode + # project.generate_qrcode project end @@ -104,7 +104,7 @@ class ProjectsService class JoinProjectError < Errors define_error [ - 0, '加入成功', + 0, '您已成功加入项目', 1, '您的邀请码不正确', 2, '您还未登录', 3, '您已经是该项目的管理人员', @@ -131,7 +131,7 @@ class ProjectsService else if params[:invite_code].present? - if params[:role_id] == 5 + if params[:role] == 5 members = [] user_grades = [] project_info = [] diff --git a/public/assets/wechat/join_project.html b/public/assets/wechat/join_project.html index 3ab29bf70..41c86691d 100644 --- a/public/assets/wechat/join_project.html +++ b/public/assets/wechat/join_project.html @@ -2,7 +2,7 @@