|
@@ -25,7 +25,29 @@ class Version extends Base
|
|
$this->success('返回成功', $this->request->param());
|
|
$this->success('返回成功', $this->request->param());
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取指定平台的最新版本
|
|
|
|
+ * @ApiTitle (获取最新版本信息)
|
|
|
|
+ * @ApiSummary (根据请求头platform参数返回最新版本)
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
+ * @ApiHeader (name="platform", type="string", required=true, description="平台标识,如android/ios/h5等")
|
|
|
|
+ */
|
|
|
|
+ public function getLatestVersion()
|
|
|
|
+ {
|
|
|
|
+ $platform = $this->request->header('platform', '');
|
|
|
|
+ if (!$platform) {
|
|
|
|
+ $this->error('缺少platform参数');
|
|
|
|
+ }
|
|
|
|
+ $version = \think\Db::name('version')
|
|
|
|
+ ->where('platform', $platform)
|
|
|
|
+ ->where('status', 'normal')
|
|
|
|
+ ->order('weigh desc, id desc')
|
|
|
|
+ ->find();
|
|
|
|
+ if (!$version) {
|
|
|
|
+ $this->success('获取成功', null);
|
|
|
|
+ }
|
|
|
|
+ $this->success('获取成功', $version);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|