Commit 054043ed by liangyuzhe

自定义api controller

parent 6e91099e
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Metal
ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left|
include left
end
include RailsParam::Param
rescue_from StandardError, with: :rescue_all rescue_from StandardError, with: :rescue_all
include TokenValidate include TokenValidate
def rescue_all(e) def rescue_all(e)
ErrorLog.error(e) ErrorLog.error(e)
render json: { code: 500, message: '抱歉~ 系统出错了,攻城狮们已经在修理了!', error: e.class.name.underscore, original_message: e.message } render json: { code: 500, message: '抱歉~ 系统出错了,攻城狮们已经在修理了!', error: e.class.name.underscore, original_message: e.message }
......
class PushsController < ApplicationController class PushsController < ApplicationController
include ActionController::HttpAuthentication::Token include ActionController::HttpAuthentication::Token
skip_before_action :verify_authenticity_token # skip_before_action :verify_authenticity_token
def token def token
param! :app_name, String, required: true param! :app_name, String, required: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment