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 1556dfe88..c2c0ec993 100644 --- a/public/assets/wechat/join_project.html +++ b/public/assets/wechat/join_project.html @@ -2,7 +2,7 @@