feat(apk): 添加最新版本接口并扩展响应数据

- 在现有接口中增加 version 字段返回
- 新增 latest_version 接口用于获取最新APK版本
- 从附件表按创建时间倒序查找最新APK记录
- 统一返回版本号信息到客户端
- 添加暂无安装包的错误处理逻辑
This commit is contained in:
2026-04-09 14:01:39 +08:00
parent e2cb70911b
commit ab27bb6bf6

View File

@@ -104,6 +104,22 @@ class Apk extends Api
$response = [ $response = [
'url' => $this->request->domain() . $attachment->url, 'url' => $this->request->domain() . $attachment->url,
'filename' => $attachment->filename, '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); $this->success('获取成功', $response);