feat(apk): 添加最新版本接口并扩展响应数据
- 在现有接口中增加 version 字段返回 - 新增 latest_version 接口用于获取最新APK版本 - 从附件表按创建时间倒序查找最新APK记录 - 统一返回版本号信息到客户端 - 添加暂无安装包的错误处理逻辑
This commit is contained in:
@@ -104,6 +104,22 @@ class Apk extends Api
|
||||
$response = [
|
||||
'url' => $this->request->domain() . $attachment->url,
|
||||
'filename' => $attachment->filename,
|
||||
'version' => $attachment->extparam,
|
||||
];
|
||||
|
||||
$this->success('获取成功', $response);
|
||||
}
|
||||
|
||||
public function latest_version(){
|
||||
$attachment = Attachment::where('category', 'apk')
|
||||
->order('createtime', 'desc')
|
||||
->find();
|
||||
|
||||
if (!$attachment) {
|
||||
$this->error('暂无安装包');
|
||||
}
|
||||
$response = [
|
||||
'version' => $attachment->extparam,
|
||||
];
|
||||
|
||||
$this->success('获取成功', $response);
|
||||
|
||||
Reference in New Issue
Block a user