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.
trustieforge/app/api/mobile/apis/upgrade.rb

30 lines
812 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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