You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
822 B

5 years ago
class EduApisController < ApplicationController
before_action :check_validate
skip_before_action :user_setup
skip_before_action :setup_laboratory
# trustie获取数据
def edu_data_info
# 每天晚上000000分获取前一天的数据
begin_time = (Time.now - 1.day).beginning_of_day
end_time = (Time.now - 1.day).at_end_of_day
@user_count = User.where(created_on: begin_time..end_time).count
@project_count = Project.where(created_on: begin_time..end_time).count
@shixun_count = Shixun.where(created_at: begin_time..end_time).count
@school_count = School.where(created_at: begin_time..end_time).count
end
private
def check_validate
logger.info("########")
render_unauthorized("401 Unauthorized") if params[:private_token] != "hriEn3UwXfJs3PmyXnSG"
end
end