#coding=utf-8 module Mobile module Apis class Upgrade < Grape::API include ApplicationHelper resource :upgrade do desc "get update info" params do requires :platform, type: String, desc: '平台名,android, ios' end get do @current_version = ::PhoneAppVersion.reorder('created_at desc').first attachment = @current_version.attachments.first if attachment.nil? raise '未发现客户端!' end url = "http://" + Setting.host_name + "/attachments/download/" + attachment.id.to_s + "/" + attachment.filename { version: @current_version.version, url: url, desc: @current_version.description } end end end end end