change logs

This commit is contained in:
nigel007 2021-04-26 17:03:45 +08:00
parent bc2721deb0
commit 4682457b6b
17 changed files with 131 additions and 144 deletions

View File

@ -52,7 +52,6 @@ GEM
activerecord (>= 3.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
alipay (0.15.2)
ancestry (3.0.7)
activerecord (>= 3.2.0)
annotate (2.6.5)
@ -435,7 +434,6 @@ DEPENDENCIES
active_decorator
acts-as-taggable-on (~> 6.0)
acts_as_list
alipay (~> 0.15.1)
ancestry
annotate (~> 2.6.0)
awesome_print

View File

@ -343,7 +343,7 @@ class ApplicationController < ActionController::Base
User.current = User.find 8686
elsif params[:debug] == 'admin'
logger.info "@@@@@@@@@@@@@@@@@@@@@@ debug mode....."
user = User.find 35
user = User.find 36
User.current = user
cookies.signed[:user_id] = user.id
end

View File

@ -240,14 +240,14 @@ class UsersController < ApplicationController
if is_current_admin_user
owner = User.find_by(login: params['owner_login'])
if owner.nil?
raise Error, "项目创建者无法找到"
normal_status(-1, "创建者无法找到")
else
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})
render json: { status: results[:status], balance: results[:balance]}
end
else
raise Error, '没有权限'
normal_status(-1, "缺少权限")
end
end
@ -260,10 +260,10 @@ class UsersController < ApplicationController
if results == true
render json: { status: 2 } # 重新查询余额
else
raise Error, "转账失败"
normal_status(-1, "转账失败")
end
else
raise Error, "缺少权限"
normal_status(-1, "缺少权限")
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})
if result == false
raise Error, "创建交易失败"
normal_status(-1, "创建交易失败")
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.save()
@ -325,7 +325,7 @@ class UsersController < ApplicationController
render json: { status: status }
end
else
raise Error, "没有权限"
normal_status(-1, "缺少权限")
end
end
@ -359,7 +359,7 @@ class UsersController < ApplicationController
BlockchainTrade.find(trade_id).update(user_id2: user_id2, state: 1) # state=1表示锁定了等待线下卖家发货
render json: {status: 2} # window.location.reload()
else
raise Error, "没有权限"
normal_status(-1, "缺少权限")
end
end
@ -371,7 +371,7 @@ class UsersController < ApplicationController
BlockchainTrade.find(trade_id).update(state: 2) # state=2表示确认收货
render json: {status: 2} # window.location.reload()
else
raise Error, "没有权限"
normal_status(-1, "缺少权限")
end
end
@ -399,7 +399,7 @@ class UsersController < ApplicationController
end
render json: { results: results }
else
raise Error, "没有权限"
normal_status(-1, "缺少权限")
end
end
@ -427,7 +427,7 @@ class UsersController < ApplicationController
end
render json: { results: results }
else
raise Error, "没有权限"
normal_status(-1, "缺少权限")
end
end

View File

@ -17,7 +17,7 @@
# disk_directory :string(255)
# attachtype :integer default("1")
# is_public :integer default("1")
# copy_from :string(255)
# copy_from :integer
# quotes :integer default("0")
# is_publish :integer default("1")
# publish_time :datetime
@ -26,15 +26,15 @@
# cloud_url :string(255) default("")
# course_second_category_id :integer default("0")
# delay_publish :boolean default("0")
# link :string(255)
# clone_id :integer
#
# Indexes
#
# 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_course_second_category_id (course_second_category_id)
# index_attachments_on_created_on (created_on)
# index_attachments_on_is_public (is_public)
# index_attachments_on_quotes (quotes)
#
class Attachment < ApplicationRecord

View File

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

View File

@ -10,12 +10,6 @@
# sync_course :boolean default("0")
# sync_subject :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
#

View File

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

View File

@ -37,6 +37,8 @@
# rep_identifier :string(255)
# project_category_id :integer
# project_language_id :integer
# license_id :integer
# ignore_id :integer
# praises_count :integer default("0")
# watchers_count :integer default("0")
# issues_count :integer default("0")
@ -50,8 +52,7 @@
# open_devops_count :integer default("0")
# recommend :boolean default("0")
# platform :integer default("0")
# license_id :integer
# ignore_id :integer
# use_blockchain :boolean default("0")
# default_branch :string(255) default("master")
# website :string(255)
# lesson_url :string(255)
@ -71,6 +72,7 @@
# index_projects_on_updated_on (updated_on)
#
class Project < ApplicationRecord
include Matchable
include Publicable

View File

@ -8,6 +8,11 @@
# projects_count :integer default("0")
# created_at :datetime not null
# updated_at :datetime not null
# ancestry :string(255)
#
# Indexes
#
# index_project_categories_on_ancestry (ancestry)
#
class ProjectCategory < ApplicationRecord

View File

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

View File

@ -14,6 +14,7 @@
# tokens_value (value) UNIQUE
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License

View File

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

View File

@ -13,8 +13,6 @@
# Indexes
#
# 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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ class Blockchain::TransferService < ApplicationService
payer = params['payer_id'].to_s
payee = User.find_by(login: transfer_login)
if payee.nil?
raise Error, "未找到用户"
normal_status(-1, "未找到用户")
else
payee = payee.id.to_s
token_name = params['project_id'].to_s
@ -24,7 +24,7 @@ class Blockchain::TransferService < ApplicationService
end
rescue => e
puts "转账失败: #{e.message}"
raise Error, e.message
normal_status(-1, e.message)
end
private

View File

@ -26,7 +26,7 @@ class Projects::CreateService < ApplicationService
@project
rescue => e
puts "create project service error: #{e.message}"
raise Error, e.message
normal_status(-1, e.message)
end
private