FIX api bug
This commit is contained in:
parent
0771b2783c
commit
d75882030e
|
@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
|
|||
include RenderExpand
|
||||
include RenderHelper
|
||||
include ControllerRescueHandler
|
||||
# include LaboratoryHelper
|
||||
include LaboratoryHelper
|
||||
include GitHelper
|
||||
include LoggerHelper
|
||||
include LoginHelper
|
||||
|
|
|
@ -29,4 +29,4 @@ module LaboratoryHelper
|
|||
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
|
||||
@_default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,25 +29,6 @@ class UsersController < ApplicationController
|
|||
@user = current_user
|
||||
# TODO 等消息上线再打开注释
|
||||
#@tidding_count = unviewed_tiddings(current_user) if current_user.present?
|
||||
@course =
|
||||
if params[:course_id]
|
||||
Course.find params[:course_id]
|
||||
elsif params[:board_id]
|
||||
Board.find(params[:board_id]).course
|
||||
elsif params[:graduation_topic_id]
|
||||
GraduationTopic.find(params[:graduation_topic_id]).course
|
||||
elsif params[:graduation_group_id]
|
||||
GraduationGroup.find(params[:graduation_group_id]).course
|
||||
elsif params[:graduation_work_id]
|
||||
GraduationWork.find(params[:graduation_work_id]).course
|
||||
elsif params[:graduation_task_id]
|
||||
GraduationTask.find(params[:graduation_task_id]).course
|
||||
elsif params[:poll_id]
|
||||
Poll.find(params[:poll_id]).course
|
||||
elsif params[:attachment_id]
|
||||
Attachment.find(params[:attachment_id]).course
|
||||
end
|
||||
@course_identity = current_user.course_identity(@course) if @course
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
missing_template
|
||||
|
@ -72,14 +53,14 @@ class UsersController < ApplicationController
|
|||
|
||||
# Redo: 消息总数缓存
|
||||
def get_navigation_info
|
||||
@old_domain = edu_setting('old_edu_host')
|
||||
@user = current_user
|
||||
# 新消息数
|
||||
@new_message = @user.tidings.where("created_at > '#{@user.click_time}'").count > 0 || @user.private_messages.where("created_at > '#{@user.click_time}'").count > 0
|
||||
|
||||
@user_url = "/users/#{@user.login}"
|
||||
@career = Career.where(status: true).order("created_at asc").pluck(:id, :name)
|
||||
@auth = User.current.ec_school.present? ? "#{@old_domain}/ecs/department?school_id=#{User.current.ec_school}" : nil
|
||||
# @old_domain = edu_setting('old_edu_host')
|
||||
# @user = current_user
|
||||
# # 新消息数
|
||||
# @new_message = @user.tidings.where("created_at > '#{@user.click_time}'").count > 0 || @user.private_messages.where("created_at > '#{@user.click_time}'").count > 0
|
||||
#
|
||||
# @user_url = "/users/#{@user.login}"
|
||||
# @career = Career.where(status: true).order("created_at asc").pluck(:id, :name)
|
||||
# @auth = User.current.ec_school.present? ? "#{@old_domain}/ecs/department?school_id=#{User.current.ec_school}" : nil
|
||||
end
|
||||
|
||||
# 用户回复功能
|
||||
|
|
|
@ -13,20 +13,3 @@ json.phone @user.phone
|
|||
json.email @user.mail
|
||||
json.profile_completed @user.profile_completed?
|
||||
json.professional_certification @user.professional_certification
|
||||
json.main_site current_laboratory.main_site?
|
||||
json.is_shixun_marker current_user.is_shixun_marker? || current_user.admin_or_business?
|
||||
if @course
|
||||
json.course_identity @course_identity
|
||||
json.course_name @course.name
|
||||
json.course_public @course.is_public
|
||||
json.course_excellent @course.excellent
|
||||
if params[:group_info]
|
||||
json.group_info @course.teacher_group(@user.id) if @course_identity < Course::STUDENT
|
||||
end
|
||||
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)
|
||||
json.course_is_end @course.is_end
|
||||
end
|
||||
|
||||
if params[:school]
|
||||
json.user_school @user.school_name
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue