init project

This commit is contained in:
Jasder
2020-03-09 00:40:16 +08:00
commit 2937b2a94d
6549 changed files with 7215173 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
json.username @user.full_name
json.login @user.login
json.user_id @user.id
json.image_url url_to_avatar(@user)
json.admin @user.admin
json.is_teacher @user.user_extension.teacher?

View File

@@ -0,0 +1,8 @@
json.user_id user.id
json.login user.login
json.name user.full_name
json.grade user.grade
json.identity user&.user_extension&.identity
# json.email user.mail # 邮箱原则上不暴露的,如果实在需要的话只能对某些具体的接口公开
json.image_url url_to_avatar(user)
json.school user.school_name

View File

@@ -0,0 +1,4 @@
json.id user.id
json.name user.real_name
json.login user.login
json.image_url url_to_avatar(user)

View File

@@ -0,0 +1,8 @@
# 单表存储的信息可以放里面
json.array! users do |user|
json.username user.full_name
json.login user.login
json.user_id user.id
json.image_url url_to_avatar(user)
end

View File

@@ -0,0 +1,35 @@
json.extract! observed_user, :id, :nickname, :show_realname
json.phone observed_user.hidden_phone
json.mail observed_user.hidden_mail
json.avatar_url url_to_avatar(observed_user)
user = ActiveDecorator::Decorator.instance.decorate(observed_user)
json.name user.name
json.authentication user.authentication_status
json.professional_certification user.professional_certification_status
extension = observed_user.user_extension
json.gender extension&.gender
json.location extension&.location
json.location_city extension&.location_city
json.identity extension&.identity
json.technical_title extension&.technical_title
json.student_id extension&.student_id
json.school_id extension&.school_id
json.school_name extension&.school&.name
json.department_id extension&.department_id
json.department_name extension&.department&.name
json.base_info_completed user.profile_completed?
json.all_certified user.all_certified?
json.has_password user.hashed_password.present?
json.open_users do
json.array! user.open_users do |open_user|
json.extract! open_user, :id, :en_type, :nickname
end
end

View File

@@ -0,0 +1,3 @@
json.count @count
json.courses @courses, partial: 'users/courses/shared/course', as: :course

View File

@@ -0,0 +1,18 @@
json.id course.id
json.name course.name
# json.members_count course.members_count
json.members_count course.course_members_count
# json.homework_commons_count course.homework_commons_count
json.homework_commons_count get_tasks_count course
json.attachments_count course.attachments.count
json.visits course.visits
json.school course.school&.name
json.first_category_url module_url(course.course_modules.where(hidden: 0).order(position: :desc).first, course)
json.is_public course.is_public
json.can_visited observed_logged_user? || course.can_visited?
json.teacher do
json.partial! 'users/shared/real_user', user: course.teacher
end

View File

@@ -0,0 +1,4 @@
json.container_type_text experience.container_type_text
json.score experience.score
json.created_at experience.created_at&.strftime('%Y-%m-%d %H:%M')
json.content experience.content

View File

@@ -0,0 +1,3 @@
json.experience_total observed_user.experience
json.count @count
json.experiences @experience_records, partial: 'users/experience_records/shared/experience', as: :experience

View File

@@ -0,0 +1,60 @@
json.top do
json.shixun_url "/shixuns"
json.shixun_paths_url "/paths"
json.course_url "/courses"
json.competitions_url "#{@old_domain}/competitions"
json.topic_url "/forums"
json.new_course_url "/courses/new"
json.new_shixun_url "/shixuns/new"
json.new_shixun_path_url "/paths/new"
json.new_project_url "#{@old_domain}/projects/new"
json.join_course_url "/courses/join_course_multi_role"
json.join_project_url "#{@old_domain}/applied_project/applied_project_info"
json.message_url "#{@user_url}/user_tidings"
json.new_message @new_message
json.moop_cases_url "#{@old_domain}/moop_cases"
json.crowdsourcing_url "/crowdsourcing"
# 客户管理
json.customer_management_url current_user.partner_managers.exists? ? "/partners/#{current_user.partner_managers.first.partner_id}/customers" : nil
json.career_url do
json.array! @career.to_a do |c|
if c[1].present?
json.name c[1]
json.url "#{@old_domain}/careers/#{c[0]}/introduction"
end
end
end
json.auth @auth
json.avatar_url "#{@user_url}"
json.my_course_url "#{@user_url}"
json.my_shixun_url "#{@user_url}?type=a_shixun"
json.my_shixun_paths_url "#{@user_url}?type=a_path"
json.my_project_url "#{@user_url}?type=a_project"
json.account_manager_url "#{@old_domain}/my/account"
json.logout_url logout_accounts_path
json.college_identifier @user.college_identifier
# 旧版的域名
json.old_url @old_domain
# 云上实验室管理权限
laboratory_user = current_laboratory.laboratory_users.exists?(user_id: @user&.id) || @user&.admin_or_business?
json.laboratory_user laboratory_user
json.laboratory_admin_url laboratory_user ? "/cooperative" : nil
json.laboratory_user @user&.admin_or_business? || current_laboratory&.laboratory_users.exists?(user_id: @user&.id)
end
json.down do
json.web_root "#{@old_domain}"
json.about_us "#{@old_domain}/help?index=1"
json.connect_us "#{@old_domain}/help?index=2"
json.cooperation_partner "#{@old_domain}/help?index=3"
json.service_agreement "#{@old_domain}/help?index=4"
json.help_center "#{@old_domain}/help?index=5"
json.feedback "#{@old_domain}/help?index=6"
end
json.online_consult "https://shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd"

View File

@@ -0,0 +1,32 @@
json.username @user.full_name
json.real_name @user.real_name
json.login @user.login
json.user_id @user.id
json.image_url url_to_avatar(@user)
json.admin @user.admin?
json.business @user.business?
json.is_teacher @user.user_extension&.teacher?
json.user_identity @user.identity
json.tidding_count 0
json.user_phone_binded @user.phone.present?
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

View File

@@ -0,0 +1,4 @@
json.container_type_text grade.container_type_text
json.score grade.score
json.created_at grade.created_at&.strftime('%Y-%m-%d %H:%M')
json.content grade.content

View File

@@ -0,0 +1,3 @@
json.grade_total observed_user.grade
json.count @count
json.grade_records @grade_records, partial: 'users/grade_records/shared/grade', as: :grade

View File

@@ -0,0 +1,22 @@
json.id @user.id
json.name @user.full_name
json.avatar_url url_to_avatar(@user)
json.is_logged_user @user.logged_user?
json.experience @user.experience
json.grade @user.grade
json.follow_count @user.follow_count
json.fan_count @user.fan_count
json.identity @user.identity
#json.brief_introduction @user.user_extension&.brief_introduction
json.authentication @user.authentication
json.professional_certification @user.professional_certification
json.phone_binded @user.phone_binded?
json.email_binded @user.email_binded?
json.college_identifier @user.college_identifier
json.followed User.current.watched?(@user)
if @user.logged_user?
#json.can_apply_trial @user.can_apply_trial?
json.attendance_signed @user.attendance_signed?
json.tomorrow_attendance_gold @user.tomorrow_attendance_gold
end

View File

@@ -0,0 +1 @@
<%= @contents.html_safe %>

View File

@@ -0,0 +1,4 @@
json.total_count @total_count
json.users do
json.partial! 'user_small', users: @users
end

View File

@@ -0,0 +1,5 @@
json.username @user.full_name
json.login @user.login
json.user_id @user.id
json.image_url url_to_avatar(@user)
json.admin @user.admin

View File

@@ -0,0 +1,15 @@
json.count @count
json.target do
json.partial! 'users/user_simple', user: target_user
end
json.messages do
json.array! @messages.each do |message|
json.extract! message, :id, :user_id, :receiver_id, :sender_id, :content
json.send_time message.display_send_time
json.send_day message.send_time.strftime('%Y-%m-%d')
json.sender do
json.partial! 'users/user_simple', user: message.sender
end
end
end

View File

@@ -0,0 +1,11 @@
json.status 0
json.message 'success'
json.private_message do
json.extract! @message, :id, :user_id, :receiver_id, :sender_id, :content
json.send_day @message.send_time.strftime('%Y-%m-%d')
json.send_time @message.display_send_time
json.sender do
json.partial! 'users/user_simple', user: @message.sender
end
end

View File

@@ -0,0 +1,13 @@
json.count @count
json.private_messages do
json.array! @messages.each do |message|
json.extract! message, :id, :content, :message_count
json.unread message.unread?
json.send_time message.display_send_time
json.target do
json.partial! 'users/user_simple', user: message.target
end
end
end

View File

@@ -0,0 +1,26 @@
user = observed_user
json.count @count
json.project_packages do
json.array! @packages.each do |package|
json.extract! package, :id, :title, :status, :min_price, :max_price, :visit_count, :bidding_users_count
is_creator = user.id == package.creator_id
json.type is_creator ? 'manage' : 'bidden'
json.category_id package.project_package_category_id
json.category_name package.category_name
unless is_creator
json.bidden_status @bidding_status_map[package.id]
end
json.deadline_at package.display_deadline_at
json.published_at package.display_published_at
json.operation do
can_manage = current_user&.id == observed_user.id || current_user&.admin_or_business?
json.can_edit can_manage && package.editable?
json.can_delete can_manage && package.deletable?
end
end
end

View File

@@ -0,0 +1,3 @@
json.count @count
json.projects @projects, partial: 'users/projects/shared/project', as: :project

View File

@@ -0,0 +1,6 @@
json.count @count
json.projects do
json.array! @projects do |project|
json.extract! project, :id, :name
end
end

View File

@@ -0,0 +1,13 @@
json.id project.id
json.name project.name
json.members_count project.members.count
json.issues_count project.issues.count
json.changesets_count project.project_score&.changeset_num.to_i
json.is_public project.is_public?
json.can_visited project.can_visited?
json.owner do
json.partial! 'users/shared/real_user', user: project.owner
end

View File

@@ -0,0 +1,6 @@
json.count @count
json.course_list @course_lists do |course_list|
json.id course_list.id
json.name course_list.name
end

View File

@@ -0,0 +1,3 @@
json.id course_list.id
json.name course_list.name

View File

@@ -0,0 +1,8 @@
json.id question_bank.id
json.name question_bank.name
json.is_public question_bank.is_public
json.quotes_count question_bank.quotes
json.creator_name question_bank.user.name
json.course_list_name question_bank.course_list.name
json.updated_at question_bank.updated_at

View File

@@ -0,0 +1,2 @@
json.users @contacts, partial: 'users/user_simple', as: :user
json.count @contacts.size

View File

@@ -0,0 +1,4 @@
json.projects @projects do |project|
json.project_id project.id
json.project_name project.name
end

View File

@@ -0,0 +1,4 @@
json.id user.id
json.real_name user.real_name
json.avatar_url url_to_avatar(user)
json.school_name user.school_name

View File

@@ -0,0 +1,3 @@
json.count @count
json.shixuns @shixuns, partial: 'users/shixuns/shared/shixun', as: :shixun, locals: { user: observed_user }

View File

@@ -0,0 +1,10 @@
json.id shixun.id
json.identifier shixun.identifier
json.tag shixun.first_tag_repertoire&.name
json.image_url url_to_avatar(shixun)
json.name shixun.name
json.status shixun.status
json.human_status shixun.human_status
json.challenges_count shixun.challenges_count
json.finished_challenges_count @finished_challenges_count_map&.fetch(shixun.id, 0) || shixun.finished_challenges_count(user)
json.is_jupyter shixun.is_jupyter

View File

@@ -0,0 +1 @@
json.partial! 'users/user', locals: { user: @user }

View File

@@ -0,0 +1,3 @@
json.count @count
json.subjects @subjects, partial: 'users/subjects/shared/subject', as: :subject

View File

@@ -0,0 +1,8 @@
json.id subject.id
json.name subject.name
json.tag subject.repertoire&.name
json.image_url url_to_avatar(subject)
json.owner_id subject.user.id
json.owner_name subject.user.full_name
json.visits_count subject.visits
json.can_visited subject.can_visited?

View File

@@ -0,0 +1,7 @@
if @notice && @notice.end_time > Time.now
json.system_update true
json.system_score @notice.notes.rstrip
json.(@notice, :subject, :start_time, :end_time)
else
json.system_update false
end

View File

@@ -0,0 +1,6 @@
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id
json.play_duration video.video_play_duration
json.published_at video.display_published_at
json.created_at video.display_created_at
json.updated_at video.display_updated_at

View File

@@ -0,0 +1,2 @@
json.count @count
json.videos @videos, partial: 'video', as: :video

View File

@@ -0,0 +1,7 @@
json.count @count
json.videos do
json.array! @videos.each do |video|
json.partial! 'video', video: video
json.file_url nil
end
end

View File

@@ -0,0 +1 @@
json.partial! 'video', video: current_video