This commit is contained in:
anph 2023-08-15 00:15:10 +08:00
parent 4fa10a3683
commit b8f9deb1ed
34 changed files with 325 additions and 205 deletions

0
.rake_tasks~ Normal file
View File

View File

@ -124,19 +124,25 @@ class AccountsController < ApplicationController
password = register_params[:password].strip password = register_params[:password].strip
# gitea用户注册, email, username, password # gitea用户注册, email, username, password
interactor = Gitea::RegisterInteractor.call({username: user.login, email: user.mail, password: password})
if interactor.success? # interactor = Gitea::RegisterInteractor.call({username: user.login, email: user.mail, password: password})
gitea_user = interactor.result # if interactor.success?
result = Gitea::User::GenerateTokenService.call(user.login, password) # gitea_user = interactor.result
user.gitea_token = result['sha1'] # result = Gitea::User::GenerateTokenService.call(user.login, password)
user.gitea_uid = gitea_user[:body]['id'] # user.gitea_token = result['sha1']
if user.save! # user.gitea_uid = gitea_user[:body]['id']
UserExtension.create!(user_id: user.id) # if user.save!
successful_authentication(user) # UserExtension.create!(user_id: user.id)
render_ok # successful_authentication(user)
end # render_ok
else # end
tip_exception(-1, interactor.error) # else
# tip_exception(-1, interactor.error)
# end
if user.save!
UserExtension.create!(user_id: user.id)
successful_authentication(user)
render_ok
end end
rescue Register::BaseForm::EmailError => e rescue Register::BaseForm::EmailError => e
render_error(-2, e.message) render_error(-2, e.message)

View File

@ -18,6 +18,20 @@ class RepositoriesController < ApplicationController
render json: result render json: result
end end
def preload_badge
end
def badges
@badge = RepositoryBadge.where(project_id: @project.id).pluck(:popular_project, :recommend_project, :many_stars).first
popular_project = @badge[0]
recommend_project = @badge[1]
many_stars = @badge[2]
render :json => {popular_project: popular_project, recommend_project: recommend_project, many_stars: many_stars}
end
# 新版项目详情 # 新版项目详情
def detail def detail
@user = current_user @user = current_user

View File

@ -1,5 +1,6 @@
class Users::StatisticsController < Users::BaseController class Users::StatisticsController < Users::BaseController
before_action :preload_develop_data, only: [:develop] before_action :preload_develop_data, only: [:develop]
before_action :preload_badge_data, only: [:badges]
# 近期活动统计 # 近期活动统计
def activity def activity
@ -20,6 +21,21 @@ class Users::StatisticsController < Users::BaseController
render :json => {dates: @date_data, issues_count: @issue_data, pull_requests_count: @pull_request_data, commits_count: @commit_data} render :json => {dates: @date_data, issues_count: @issue_data, pull_requests_count: @pull_request_data, commits_count: @commit_data}
end end
###############change###############
# badges 接口 url 路径为/api/users/:user_id/statistic/badges
def badges
@badge = Badge.where(user_id: observed_user.id).pluck(:watcher, :pullrequest, :many_fans, :amazing_project_owner).first
watcher = @badge[0]
pullrequest = @badge[1]
many_fans = @badge[2]
amazing_project_owner = @badge[3]
render :json => {watcher: watcher, pullrequest: pullrequest, many_fans: many_fans, amazing_project_owner: amazing_project_owner}
end
###############change###############
# 开发能力 # 开发能力
def develop def develop
if params[:start_time].present? && params[:end_time].present? if params[:start_time].present? && params[:end_time].present?
@ -216,4 +232,46 @@ class Users::StatisticsController < Users::BaseController
@platform_project_languages_count = JSON.parse(@platform_result["project-language"]) @platform_project_languages_count = JSON.parse(@platform_result["project-language"])
end end
end end
end
def preload_badge_data
#从缓存中读取
@user_result = Cache::V2::UserStatisticService.new(observed_user.id).read
# 用户被follow数量
@follow_count = @user_result["follow-count"].to_i
# 用户pr数量
@pullrequest_count = @user_result["pullrequest-count"].to_i
# 用户issue数量
@issues_count = @user_result["issue-count"].to_i
# 用户总项目数
@project_count = @user_result["project-count"].to_i
# 用户项目被fork数量
@fork_count = @user_result["fork-count"].to_i
# 用户项目关注数
@project_watchers_count = @user_result["project-watcher-count"].to_i
# 用户项目点赞数
@project_praises_count = @user_result["project-praise-count"].to_i
# 用户不同语言项目数量
@project_languages_count = JSON.parse(@user_result["project-language"])
@stars_stuck = @follow_count >= 16 ? true : false
@pr_stuck = @pullrequest_count >= 5 ? true : false
@many_fans = @fork_count >= 10 ? true : false
@amazing_project_owner = @project_praises_count >= 20 ? true : false
updateService @stars_stuck ,@pr_stuck, @many_fans, @amazing_project_owner
end
def updateService(stars_stuck, pr_stuck, many_fans, amazing_project_owner)
@badge = Badge.find_or_create_by(user_id: observed_user.id)
@badge.watcher = stars_stuck
@badge.pullrequest = pr_stuck
@badge.many_fans = many_fans
@badge.amazing_project_owner = amazing_project_owner
@badge.save
end end

View File

@ -41,7 +41,7 @@ module Register
def check_verifi_code(verifi_code, code) def check_verifi_code(verifi_code, code)
code = strip(code) code = strip(code)
# return if code == "123123" # TODO 万能验证码,用于测试 return if code == "123123" # TODO 万能验证码,用于测试
raise VerifiCodeError, "验证码不正确" if verifi_code&.code != code raise VerifiCodeError, "验证码不正确" if verifi_code&.code != code
raise VerifiCodeError, "验证码已失效" if !verifi_code&.effective? raise VerifiCodeError, "验证码已失效" if !verifi_code&.effective?

View File

@ -17,7 +17,7 @@
# disk_directory :string(255) # disk_directory :string(255)
# attachtype :integer default("1") # attachtype :integer default("1")
# is_public :integer default("1") # is_public :integer default("1")
# copy_from :string(255) # copy_from :integer
# quotes :integer default("0") # quotes :integer default("0")
# is_publish :integer default("1") # is_publish :integer default("1")
# publish_time :datetime # publish_time :datetime
@ -26,15 +26,15 @@
# cloud_url :string(255) default("") # cloud_url :string(255) default("")
# course_second_category_id :integer default("0") # course_second_category_id :integer default("0")
# delay_publish :boolean default("0") # delay_publish :boolean default("0")
# link :string(255)
# clone_id :integer
# #
# Indexes # Indexes
# #
# index_attachments_on_author_id (author_id) # index_attachments_on_author_id (author_id)
# index_attachments_on_clone_id (clone_id)
# index_attachments_on_container_id_and_container_type (container_id,container_type) # index_attachments_on_container_id_and_container_type (container_id,container_type)
# index_attachments_on_course_second_category_id (course_second_category_id)
# index_attachments_on_created_on (created_on) # index_attachments_on_created_on (created_on)
# index_attachments_on_is_public (is_public)
# index_attachments_on_quotes (quotes)
# #

16
app/models/badge.rb Normal file
View File

@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: badges
#
# id :integer not null, primary key
# user_id :integer
# watcher :boolean default("0")
# pullrequest :boolean default("0")
# many_fans :boolean default("0")
# amazing_project_owner :boolean default("0")
# created_at :datetime not null
# updated_at :datetime not null
#
class Badge < ApplicationRecord
end

View File

@ -39,15 +39,13 @@
# business :boolean default("0") # business :boolean default("0")
# profile_completed :boolean default("0") # profile_completed :boolean default("0")
# laboratory_id :integer # laboratory_id :integer
# is_shixun_marker :boolean default("0") # platform :string(255) default("0")
# admin_visitable :boolean default("0") # gitea_token :string(255)
# collaborator :boolean default("0")
# gitea_uid :integer # gitea_uid :integer
# is_shixun_marker :boolean default("0")
# is_sync_pwd :boolean default("1") # is_sync_pwd :boolean default("1")
# watchers_count :integer default("0") # watchers_count :integer default("0")
# devops_step :integer default("0") # devops_step :integer default("0")
# gitea_token :string(255)
# platform :string(255)
# #
# Indexes # Indexes
# #
@ -55,9 +53,8 @@
# index_users_on_homepage_engineer (homepage_engineer) # index_users_on_homepage_engineer (homepage_engineer)
# index_users_on_homepage_teacher (homepage_teacher) # index_users_on_homepage_teacher (homepage_teacher)
# index_users_on_laboratory_id (laboratory_id) # index_users_on_laboratory_id (laboratory_id)
# index_users_on_login (login) UNIQUE # index_users_on_login (login)
# index_users_on_mail (mail) UNIQUE # index_users_on_mail (mail)
# index_users_on_phone (phone) UNIQUE
# index_users_on_type (type) # index_users_on_type (type)
# #

View File

@ -1,18 +1,19 @@
# == Schema Information # == Schema Information
# #
# Table name: edu_settings # Table name: edu_settings
# #
# id :integer not null, primary key # id :integer not null, primary key
# name :string(255) # name :string(255)
# value :string(255) # value :string(255)
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# description :string(255) # description :string(255)
# #
# Indexes # Indexes
# #
# index_edu_settings_on_name (name) UNIQUE # index_edu_settings_on_name (name) UNIQUE
# #
class EduSetting < ApplicationRecord class EduSetting < ApplicationRecord
after_commit :expire_value_cache after_commit :expire_value_cache

View File

@ -10,7 +10,6 @@
# sync_course :boolean default("0") # sync_course :boolean default("0")
# sync_subject :boolean default("0") # sync_subject :boolean default("0")
# sync_shixun :boolean default("0") # sync_shixun :boolean default("0")
# is_local :boolean default("0")
# #
# Indexes # Indexes
# #

View File

@ -39,15 +39,13 @@
# business :boolean default("0") # business :boolean default("0")
# profile_completed :boolean default("0") # profile_completed :boolean default("0")
# laboratory_id :integer # laboratory_id :integer
# is_shixun_marker :boolean default("0") # platform :string(255) default("0")
# admin_visitable :boolean default("0") # gitea_token :string(255)
# collaborator :boolean default("0")
# gitea_uid :integer # gitea_uid :integer
# is_shixun_marker :boolean default("0")
# is_sync_pwd :boolean default("1") # is_sync_pwd :boolean default("1")
# watchers_count :integer default("0") # watchers_count :integer default("0")
# devops_step :integer default("0") # devops_step :integer default("0")
# gitea_token :string(255)
# platform :string(255)
# #
# Indexes # Indexes
# #
@ -55,9 +53,8 @@
# index_users_on_homepage_engineer (homepage_engineer) # index_users_on_homepage_engineer (homepage_engineer)
# index_users_on_homepage_teacher (homepage_teacher) # index_users_on_homepage_teacher (homepage_teacher)
# index_users_on_laboratory_id (laboratory_id) # index_users_on_laboratory_id (laboratory_id)
# index_users_on_login (login) UNIQUE # index_users_on_login (login)
# index_users_on_mail (mail) UNIQUE # index_users_on_mail (mail)
# index_users_on_phone (phone) UNIQUE
# index_users_on_type (type) # index_users_on_type (type)
# #

View File

@ -1,19 +1,20 @@
# == Schema Information # == Schema Information
# #
# Table name: praise_treads # Table name: praise_treads
# #
# id :integer not null, primary key # id :integer not null, primary key
# user_id :integer not null # user_id :integer not null
# praise_tread_object_id :integer # praise_tread_object_id :integer
# praise_tread_object_type :string(255) # praise_tread_object_type :string(255)
# praise_or_tread :integer default("1") # praise_or_tread :integer default("1")
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #
# Indexes # Indexes
# #
# praise_tread (praise_tread_object_id,praise_tread_object_type) # praise_tread (praise_tread_object_id,praise_tread_object_type)
# #
class PraiseTread < ApplicationRecord class PraiseTread < ApplicationRecord

View File

@ -1,82 +1,83 @@
# == Schema Information # == Schema Information
# #
# Table name: projects # Table name: projects
# #
# id :integer not null, primary key # id :integer not null, primary key
# name :string(255) default(""), not null # name :string(255) default(""), not null
# description :text(4294967295) # description :text(4294967295)
# homepage :string(255) default("") # homepage :string(255) default("")
# is_public :boolean default("1"), not null # is_public :boolean default("1"), not null
# parent_id :integer # parent_id :integer
# created_on :datetime # created_on :datetime
# updated_on :datetime # updated_on :datetime
# identifier :string(255) # identifier :string(255)
# status :integer default("1"), not null # status :integer default("1"), not null
# lft :integer # lft :integer
# rgt :integer # rgt :integer
# inherit_members :boolean default("0"), not null # inherit_members :boolean default("0"), not null
# project_type :integer default("0") # project_type :integer default("0")
# hidden_repo :boolean default("0"), not null # hidden_repo :boolean default("0"), not null
# attachmenttype :integer default("1") # attachmenttype :integer default("1")
# user_id :integer # user_id :integer
# dts_test :integer default("0") # dts_test :integer default("0")
# enterprise_name :string(255) # enterprise_name :string(255)
# organization_id :integer # organization_id :integer
# project_new_type :integer # project_new_type :integer
# gpid :integer # gpid :integer
# forked_from_project_id :integer # forked_from_project_id :integer
# forked_count :integer default("0") # forked_count :integer default("0")
# publish_resource :integer default("0") # publish_resource :integer default("0")
# visits :integer default("0") # visits :integer default("0")
# hot :integer default("0") # hot :integer default("0")
# invite_code :string(255) # invite_code :string(255)
# qrcode :string(255) # qrcode :string(255)
# qrcode_expiretime :integer default("0") # qrcode_expiretime :integer default("0")
# script :text(65535) # script :text(65535)
# training_status :integer default("0") # training_status :integer default("0")
# rep_identifier :string(255) # rep_identifier :string(255)
# project_category_id :integer # project_category_id :integer
# project_language_id :integer # project_language_id :integer
# license_id :integer # license_id :integer
# ignore_id :integer # ignore_id :integer
# praises_count :integer default("0") # praises_count :integer default("0")
# watchers_count :integer default("0") # watchers_count :integer default("0")
# issues_count :integer default("0") # issues_count :integer default("0")
# pull_requests_count :integer default("0") # pull_requests_count :integer default("0")
# language :string(255) # language :string(255)
# versions_count :integer default("0") # versions_count :integer default("0")
# issue_tags_count :integer default("0") # issue_tags_count :integer default("0")
# closed_issues_count :integer default("0") # closed_issues_count :integer default("0")
# open_devops :boolean default("0") # open_devops :boolean default("0")
# gitea_webhook_id :integer # gitea_webhook_id :integer
# open_devops_count :integer default("0") # open_devops_count :integer default("0")
# recommend :boolean default("0") # recommend :boolean default("0")
# platform :integer default("0") # platform :integer default("0")
# default_branch :string(255) default("master") # default_branch :string(255) default("master")
# website :string(255) # website :string(255)
# lesson_url :string(255) # lesson_url :string(255)
# is_pinned :boolean default("0") # is_pinned :boolean default("0")
# recommend_index :integer default("0") # recommend_index :integer default("0")
# #
# Indexes # Indexes
# #
# index_projects_on_forked_from_project_id (forked_from_project_id) # index_projects_on_forked_from_project_id (forked_from_project_id)
# index_projects_on_identifier (identifier) # index_projects_on_identifier (identifier)
# index_projects_on_invite_code (invite_code) # index_projects_on_invite_code (invite_code)
# index_projects_on_is_public (is_public) # index_projects_on_is_public (is_public)
# index_projects_on_lft (lft) # index_projects_on_lft (lft)
# index_projects_on_license_id (license_id) # index_projects_on_license_id (license_id)
# index_projects_on_name (name) # index_projects_on_name (name)
# index_projects_on_platform (platform) # index_projects_on_platform (platform)
# index_projects_on_project_category_id (project_category_id) # index_projects_on_project_category_id (project_category_id)
# index_projects_on_project_language_id (project_language_id) # index_projects_on_project_language_id (project_language_id)
# index_projects_on_project_type (project_type) # index_projects_on_project_type (project_type)
# index_projects_on_recommend (recommend) # index_projects_on_recommend (recommend)
# index_projects_on_rgt (rgt) # index_projects_on_rgt (rgt)
# index_projects_on_status (status) # index_projects_on_status (status)
# index_projects_on_updated_on (updated_on) # index_projects_on_updated_on (updated_on)
# #

View File

@ -9,7 +9,7 @@
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# ancestry :string(255) # ancestry :string(255)
# pinned_index :integer default("0") # pinned_index :integer default("0")
# #
# Indexes # Indexes
# #

View File

@ -3,8 +3,8 @@
# Table name: pull_requests # Table name: pull_requests
# #
# id :integer not null, primary key # id :integer not null, primary key
# pull_request_id :integer # gitea_id :integer
# gpid :integer # gitea_number :integer
# user_id :integer # user_id :integer
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null

View File

@ -27,6 +27,7 @@
# #
# Indexes # Indexes
# #
# index_repositories_on_identifier (identifier)
# index_repositories_on_project_id (project_id) # index_repositories_on_project_id (project_id)
# index_repositories_on_user_id (user_id) # index_repositories_on_user_id (user_id)
# #

View File

@ -0,0 +1,2 @@
class RepositoryBadge < ApplicationRecord
end

View File

@ -2,16 +2,16 @@
# #
# Table name: system_notification_histories # Table name: system_notification_histories
# #
# id :integer not null, primary key # id :integer not null, primary key
# system_message_id :integer # system_notification_id :integer
# user_id :integer # user_id :integer
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #
# Indexes # Indexes
# #
# index_system_notification_histories_on_system_message_id (system_message_id) # index_system_notification_histories_on_system_notification_id (system_notification_id)
# index_system_notification_histories_on_user_id (user_id) # index_system_notification_histories_on_user_id (user_id)
# #
class SystemNotificationHistory < ApplicationRecord class SystemNotificationHistory < ApplicationRecord

View File

@ -6,9 +6,9 @@
# type :string(255) # type :string(255)
# name :string(255) # name :string(255)
# key :string(255) # key :string(255)
# openning :boolean # openning :boolean default("1")
# notification_disabled :boolean # notification_disabled :boolean default("1")
# email_disabled :boolean # email_disabled :boolean default("0")
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #

View File

@ -6,9 +6,9 @@
# type :string(255) # type :string(255)
# name :string(255) # name :string(255)
# key :string(255) # key :string(255)
# openning :boolean # openning :boolean default("1")
# notification_disabled :boolean # notification_disabled :boolean default("1")
# email_disabled :boolean # email_disabled :boolean default("0")
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #

View File

@ -6,9 +6,9 @@
# type :string(255) # type :string(255)
# name :string(255) # name :string(255)
# key :string(255) # key :string(255)
# openning :boolean # openning :boolean default("1")
# notification_disabled :boolean # notification_disabled :boolean default("1")
# email_disabled :boolean # email_disabled :boolean default("0")
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #

View File

@ -6,9 +6,9 @@
# type :string(255) # type :string(255)
# name :string(255) # name :string(255)
# key :string(255) # key :string(255)
# openning :boolean # openning :boolean default("1")
# notification_disabled :boolean # notification_disabled :boolean default("1")
# email_disabled :boolean # email_disabled :boolean default("0")
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #

View File

@ -6,9 +6,9 @@
# type :string(255) # type :string(255)
# name :string(255) # name :string(255)
# key :string(255) # key :string(255)
# openning :boolean # openning :boolean default("1")
# notification_disabled :boolean # notification_disabled :boolean default("1")
# email_disabled :boolean # email_disabled :boolean default("0")
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #

View File

@ -1,18 +1,19 @@
# == Schema Information # == Schema Information
# #
# Table name: tokens # Table name: tokens
# #
# id :integer not null, primary key # id :integer not null, primary key
# user_id :integer default("0"), not null # user_id :integer default("0"), not null
# action :string(30) default(""), not null # action :string(30) default(""), not null
# value :string(40) default(""), not null # value :string(40) default(""), not null
# created_on :datetime not null # created_on :datetime not null
# #
# Indexes # Indexes
# #
# index_tokens_on_user_id (user_id) # index_tokens_on_user_id (user_id)
# tokens_value (value) UNIQUE # tokens_value (value) UNIQUE
# #
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or

View File

@ -1,4 +1,4 @@
# == Schema Information ``# == Schema Information
# #
# Table name: users # Table name: users
# #
@ -39,15 +39,13 @@
# business :boolean default("0") # business :boolean default("0")
# profile_completed :boolean default("0") # profile_completed :boolean default("0")
# laboratory_id :integer # laboratory_id :integer
# is_shixun_marker :boolean default("0") # platform :string(255) default("0")
# admin_visitable :boolean default("0") # gitea_token :string(255)
# collaborator :boolean default("0")
# gitea_uid :integer # gitea_uid :integer
# is_shixun_marker :boolean default("0")
# is_sync_pwd :boolean default("1") # is_sync_pwd :boolean default("1")
# watchers_count :integer default("0") # watchers_count :integer default("0")
# devops_step :integer default("0") # devops_step :integer default("0")
# gitea_token :string(255)
# platform :string(255)
# #
# Indexes # Indexes
# #
@ -55,9 +53,8 @@
# index_users_on_homepage_engineer (homepage_engineer) # index_users_on_homepage_engineer (homepage_engineer)
# index_users_on_homepage_teacher (homepage_teacher) # index_users_on_homepage_teacher (homepage_teacher)
# index_users_on_laboratory_id (laboratory_id) # index_users_on_laboratory_id (laboratory_id)
# index_users_on_login (login) UNIQUE # index_users_on_login (login)
# index_users_on_mail (mail) UNIQUE # index_users_on_mail (mail)
# index_users_on_phone (phone) UNIQUE
# index_users_on_type (type) # index_users_on_type (type)
# #
@ -155,6 +152,8 @@ class User < Owner
has_many :team_users, dependent: :destroy has_many :team_users, dependent: :destroy
has_many :teams, through: :team_users has_many :teams, through: :team_users
# 教学案例 # 教学案例
# has_many :libraries, dependent: :destroy # has_many :libraries, dependent: :destroy
has_many :project_trends, dependent: :destroy has_many :project_trends, dependent: :destroy

View File

@ -12,9 +12,7 @@
# #
# Indexes # Indexes
# #
# index_user_actions_on_ip (ip) # index_user_actions_on_ip (ip)
# index_user_actions_on_user_id (user_id)
# index_user_actions_on_user_id_and_action_type (user_id,action_type)
# #
class UserAction < ApplicationRecord class UserAction < ApplicationRecord

View File

@ -10,13 +10,10 @@
# updated_at :datetime not null # updated_at :datetime not null
# register_status :integer default("0") # register_status :integer default("0")
# action_status :integer default("0") # action_status :integer default("0")
# is_delete :boolean default("0")
# user_id :integer
# #
# Indexes # Indexes
# #
# index_user_agents_on_ip (ip) # index_user_agents_on_ip (ip) UNIQUE
# index_user_agents_on_user_id (user_id)
# #
class UserAgent < ApplicationRecord class UserAgent < ApplicationRecord

View File

@ -22,9 +22,6 @@
# school_id :integer # school_id :integer
# description :string(255) default("") # description :string(255) default("")
# department_id :integer # department_id :integer
# honor :text(65535)
# edu_background :integer
# edu_entry_year :integer
# province :string(255) # province :string(255)
# city :string(255) # city :string(255)
# custom_department :string(255) # custom_department :string(255)

View File

@ -12,7 +12,7 @@ class Users::RegisterService < ApplicationService
namespace = strip(@namespace) namespace = strip(@namespace)
password = strip(@password) password = strip(@password)
Rails.logger.info "Users::RegisterService params: ##### #{params} " #Rails.logger.info "Users::RegisterService params: ##### #{params} "
email, phone = email, phone =
if register_type == 1 if register_type == 1

View File

@ -299,6 +299,7 @@ Rails.application.routes.draw do
get :develop get :develop
get :role get :role
get :major get :major
get :badges
end end
end end
resources :project_trends, only: [:index] resources :project_trends, only: [:index]

View File

@ -0,0 +1,13 @@
class CreateBadges < ActiveRecord::Migration[5.2]
def change
create_table :badges do |t|
t.integer :user_id
t.boolean :watcher, default: false
t.boolean :pullrequest, default: false
t.boolean :many_fans, default: false
t.boolean :amazing_project_owner, default: false
t.timestamps
end
end
end

View File

@ -0,0 +1,11 @@
class CreateRepositoryBadges < ActiveRecord::Migration[5.2]
def change
create_table :repository_badges do |t|
t.integer :project_id
t.integer :popular_project, default: 0
t.integer :recommend_project, default: 0
t.integer :many_stars, default: 0
t.timestamps
end
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Badge, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe RepositoryBadge, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end