change logs
This commit is contained in:
parent
bc2721deb0
commit
4682457b6b
|
@ -52,7 +52,6 @@ GEM
|
||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
addressable (2.7.0)
|
addressable (2.7.0)
|
||||||
public_suffix (>= 2.0.2, < 5.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
alipay (0.15.2)
|
|
||||||
ancestry (3.0.7)
|
ancestry (3.0.7)
|
||||||
activerecord (>= 3.2.0)
|
activerecord (>= 3.2.0)
|
||||||
annotate (2.6.5)
|
annotate (2.6.5)
|
||||||
|
@ -435,7 +434,6 @@ DEPENDENCIES
|
||||||
active_decorator
|
active_decorator
|
||||||
acts-as-taggable-on (~> 6.0)
|
acts-as-taggable-on (~> 6.0)
|
||||||
acts_as_list
|
acts_as_list
|
||||||
alipay (~> 0.15.1)
|
|
||||||
ancestry
|
ancestry
|
||||||
annotate (~> 2.6.0)
|
annotate (~> 2.6.0)
|
||||||
awesome_print
|
awesome_print
|
||||||
|
|
|
@ -343,7 +343,7 @@ class ApplicationController < ActionController::Base
|
||||||
User.current = User.find 8686
|
User.current = User.find 8686
|
||||||
elsif params[:debug] == 'admin'
|
elsif params[:debug] == 'admin'
|
||||||
logger.info "@@@@@@@@@@@@@@@@@@@@@@ debug mode....."
|
logger.info "@@@@@@@@@@@@@@@@@@@@@@ debug mode....."
|
||||||
user = User.find 35
|
user = User.find 36
|
||||||
User.current = user
|
User.current = user
|
||||||
cookies.signed[:user_id] = user.id
|
cookies.signed[:user_id] = user.id
|
||||||
end
|
end
|
||||||
|
|
|
@ -240,14 +240,14 @@ class UsersController < ApplicationController
|
||||||
if is_current_admin_user
|
if is_current_admin_user
|
||||||
owner = User.find_by(login: params['owner_login'])
|
owner = User.find_by(login: params['owner_login'])
|
||||||
if owner.nil?
|
if owner.nil?
|
||||||
raise Error, "项目创建者无法找到"
|
normal_status(-1, "创建者无法找到")
|
||||||
else
|
else
|
||||||
p = Project.find_by(user_id: owner.id, name: params['project_name'])
|
p = Project.find_by(user_id: owner.id, name: params['project_name'])
|
||||||
results = Blockchain::BalanceQueryOneProject.call({"user_id": params['user_id'].to_i, "project_id": p.id.to_i})
|
results = Blockchain::BalanceQueryOneProject.call({"user_id": params['user_id'].to_i, "project_id": p.id.to_i})
|
||||||
render json: { status: results[:status], balance: results[:balance]}
|
render json: { status: results[:status], balance: results[:balance]}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise Error, '没有权限'
|
normal_status(-1, "缺少权限")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -260,10 +260,10 @@ class UsersController < ApplicationController
|
||||||
if results == true
|
if results == true
|
||||||
render json: { status: 2 } # 重新查询余额
|
render json: { status: 2 } # 重新查询余额
|
||||||
else
|
else
|
||||||
raise Error, "转账失败"
|
normal_status(-1, "转账失败")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise Error, "缺少权限"
|
normal_status(-1, "缺少权限")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ class UsersController < ApplicationController
|
||||||
# 锁仓
|
# 锁仓
|
||||||
result = Blockchain::CreateTrade.call({user_id: user_id, project_id: project_id, token_num: token_num})
|
result = Blockchain::CreateTrade.call({user_id: user_id, project_id: project_id, token_num: token_num})
|
||||||
if result == false
|
if result == false
|
||||||
raise Error, "创建交易失败"
|
normal_status(-1, "创建交易失败")
|
||||||
else
|
else
|
||||||
bt = BlockchainTrade.new(user_id: user_id, project_id: project_id, token_num: token_num, money: money, state: 0) # state=0表示创建交易; state=1表示执行中; state=2表示执行完成
|
bt = BlockchainTrade.new(user_id: user_id, project_id: project_id, token_num: token_num, money: money, state: 0) # state=0表示创建交易; state=1表示执行中; state=2表示执行完成
|
||||||
bt.save()
|
bt.save()
|
||||||
|
@ -325,7 +325,7 @@ class UsersController < ApplicationController
|
||||||
render json: { status: status }
|
render json: { status: status }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise Error, "没有权限"
|
normal_status(-1, "缺少权限")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ class UsersController < ApplicationController
|
||||||
BlockchainTrade.find(trade_id).update(user_id2: user_id2, state: 1) # state=1表示锁定了,等待线下卖家发货
|
BlockchainTrade.find(trade_id).update(user_id2: user_id2, state: 1) # state=1表示锁定了,等待线下卖家发货
|
||||||
render json: {status: 2} # window.location.reload()
|
render json: {status: 2} # window.location.reload()
|
||||||
else
|
else
|
||||||
raise Error, "没有权限"
|
normal_status(-1, "缺少权限")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ class UsersController < ApplicationController
|
||||||
BlockchainTrade.find(trade_id).update(state: 2) # state=2表示确认收货
|
BlockchainTrade.find(trade_id).update(state: 2) # state=2表示确认收货
|
||||||
render json: {status: 2} # window.location.reload()
|
render json: {status: 2} # window.location.reload()
|
||||||
else
|
else
|
||||||
raise Error, "没有权限"
|
normal_status(-1, "缺少权限")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: { results: results }
|
render json: { results: results }
|
||||||
else
|
else
|
||||||
raise Error, "没有权限"
|
normal_status(-1, "缺少权限")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: { results: results }
|
render json: { results: results }
|
||||||
else
|
else
|
||||||
raise Error, "没有权限"
|
normal_status(-1, "缺少权限")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
#
|
#
|
||||||
|
|
||||||
class Attachment < ApplicationRecord
|
class Attachment < ApplicationRecord
|
||||||
|
|
|
@ -39,14 +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)
|
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
|
@ -54,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)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -10,12 +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
|
|
||||||
#
|
|
||||||
# index_laboratories_on_identifier (identifier) UNIQUE
|
|
||||||
# index_laboratories_on_school_id (school_id)
|
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
|
|
|
@ -39,14 +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)
|
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
|
@ -54,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)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
# 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
|
||||||
|
# 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")
|
||||||
|
@ -50,8 +52,7 @@
|
||||||
# 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")
|
||||||
# license_id :integer
|
# use_blockchain :boolean default("0")
|
||||||
# ignore_id :integer
|
|
||||||
# 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)
|
||||||
|
@ -71,6 +72,7 @@
|
||||||
# index_projects_on_updated_on (updated_on)
|
# index_projects_on_updated_on (updated_on)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
class Project < ApplicationRecord
|
class Project < ApplicationRecord
|
||||||
include Matchable
|
include Matchable
|
||||||
include Publicable
|
include Publicable
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
# projects_count :integer default("0")
|
# projects_count :integer default("0")
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
|
# ancestry :string(255)
|
||||||
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_project_categories_on_ancestry (ancestry)
|
||||||
#
|
#
|
||||||
|
|
||||||
class ProjectCategory < ApplicationRecord
|
class ProjectCategory < ApplicationRecord
|
||||||
|
|
|
@ -25,6 +25,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)
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
# 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
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -39,14 +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)
|
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
|
@ -54,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)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
# 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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Blockchain::TransferService < ApplicationService
|
||||||
payer = params['payer_id'].to_s
|
payer = params['payer_id'].to_s
|
||||||
payee = User.find_by(login: transfer_login)
|
payee = User.find_by(login: transfer_login)
|
||||||
if payee.nil?
|
if payee.nil?
|
||||||
raise Error, "未找到用户"
|
normal_status(-1, "未找到用户")
|
||||||
else
|
else
|
||||||
payee = payee.id.to_s
|
payee = payee.id.to_s
|
||||||
token_name = params['project_id'].to_s
|
token_name = params['project_id'].to_s
|
||||||
|
@ -24,7 +24,7 @@ class Blockchain::TransferService < ApplicationService
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "转账失败: #{e.message}"
|
puts "转账失败: #{e.message}"
|
||||||
raise Error, e.message
|
normal_status(-1, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Projects::CreateService < ApplicationService
|
||||||
@project
|
@project
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "create project service error: #{e.message}"
|
puts "create project service error: #{e.message}"
|
||||||
raise Error, e.message
|
normal_status(-1, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue