forked from Gitlink/forgeplus
Compare commits
2 Commits
aa81e7030d
...
6571db8a3c
Author | SHA1 | Date |
---|---|---|
qyzh | 6571db8a3c | |
qyzh | 2a02b6f530 |
|
@ -1,3 +1,24 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: public_key
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# owner_id :integer not null
|
||||
# name :string(255) not null
|
||||
# fingerprint :string(255) not null
|
||||
# content :text(65535) not null
|
||||
# mode :integer default("2"), not null
|
||||
# type :integer default("1"), not null
|
||||
# login_source_id :integer default("0"), not null
|
||||
# created_unix :integer
|
||||
# updated_unix :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# IDX_public_key_fingerprint (fingerprint)
|
||||
# IDX_public_key_owner_id (owner_id)
|
||||
#
|
||||
|
||||
class Gitea::PublicKey < Gitea::Base
|
||||
self.inheritance_column = nil # FIX The single-table inheritance mechanism failed
|
||||
# establish_connection :gitea_db
|
||||
|
|
|
@ -1,3 +1,34 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: webhook
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# repo_id :integer
|
||||
# org_id :integer
|
||||
# url :text(65535)
|
||||
# signature :text(65535)
|
||||
# http_method :string(255)
|
||||
# content_type :integer
|
||||
# secret :text(65535)
|
||||
# events :text(65535)
|
||||
# is_ssl :boolean
|
||||
# is_active :boolean
|
||||
# hook_task_type :integer
|
||||
# meta :text(65535)
|
||||
# last_status :integer
|
||||
# created_unix :integer
|
||||
# updated_unix :integer
|
||||
# is_system_webhook :boolean default("0"), not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# IDX_webhook_created_unix (created_unix)
|
||||
# IDX_webhook_is_active (is_active)
|
||||
# IDX_webhook_org_id (org_id)
|
||||
# IDX_webhook_repo_id (repo_id)
|
||||
# IDX_webhook_updated_unix (updated_unix)
|
||||
#
|
||||
|
||||
class Gitea::Webhook < Gitea::Base
|
||||
serialize :events, JSON
|
||||
self.inheritance_column = nil
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: hook_task
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# repo_id :integer
|
||||
# hook_id :integer
|
||||
# uuid :string(255)
|
||||
# type :integer
|
||||
# url :text(65535)
|
||||
# signature :text(65535)
|
||||
# payload_content :text(65535)
|
||||
# http_method :string(255)
|
||||
# content_type :integer
|
||||
# event_type :string(255)
|
||||
# is_ssl :boolean
|
||||
# is_delivered :boolean
|
||||
# delivered :integer
|
||||
# is_succeed :boolean
|
||||
# request_content :text(65535)
|
||||
# response_content :text(65535)
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# IDX_hook_task_repo_id (repo_id)
|
||||
#
|
||||
|
||||
class Gitea::WebhookTask < Gitea::Base
|
||||
serialize :payload_content, JSON
|
||||
serialize :request_content, JSON
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: statistics
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# dau :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
class Statistic < ApplicationRecord
|
||||
def self.record
|
||||
users = User.all
|
||||
count = 0
|
||||
t = Time.now - 1.day
|
||||
# t = Time.now.at_beginning_of_day
|
||||
users.each do |u|
|
||||
if !u.last_login_on.nil? && u.last_login_on >= t
|
||||
count += 1
|
||||
end
|
||||
end
|
||||
Statistic.create(dau: count)
|
||||
end
|
||||
end
|
|
@ -799,6 +799,9 @@ class User < Owner
|
|||
end
|
||||
|
||||
def daily_reward
|
||||
if !Rails.application.config_for(:configuration)["sponsor"]
|
||||
return
|
||||
end
|
||||
t1 = Time.now
|
||||
t2 = Time.new(t1.year, t1.month, t1.day)
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ set :environment, :development
|
|||
every '0 1 20 * *' do
|
||||
runner 'Sponsorship.monthly_payment'
|
||||
end
|
||||
every '0 2 * * *' do
|
||||
runner 'Statistic.record'
|
||||
end
|
||||
# every 1.month, at: 'January 20th 10:00am' do
|
||||
# runner 'Sponsorship.monthly_payment'
|
||||
# end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class CreateStatistics < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :statistics do |t|
|
||||
t.integer :dau
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Statistic, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue