Commit dc4b6860 authored by liming's avatar liming

mobile端增加app版本获取接口

parent 7521ec27
...@@ -3,11 +3,14 @@ package com.antai.sport.http.server.mobile.api.business.app.controller; ...@@ -3,11 +3,14 @@ package com.antai.sport.http.server.mobile.api.business.app.controller;
import com.antai.sport.http.server.common.base.Result; import com.antai.sport.http.server.common.base.Result;
import com.antai.sport.http.server.mobile.api.business.app.service.AppService; import com.antai.sport.http.server.mobile.api.business.app.service.AppService;
import com.antai.sport.http.server.mobile.api.business.app.vo.AppDownloadPathVO; import com.antai.sport.http.server.mobile.api.business.app.vo.AppDownloadPathVO;
import com.antai.sport.http.server.mobile.api.business.app.vo.AppLatestVersionVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -26,4 +29,14 @@ public class AppController { ...@@ -26,4 +29,14 @@ public class AppController {
public ResponseEntity<Result<AppDownloadPathVO>> getAppDownloadPath() { public ResponseEntity<Result<AppDownloadPathVO>> getAppDownloadPath() {
return success(appService.getAppDownloadPath()); return success(appService.getAppDownloadPath());
} }
/**
* 获取app最新版本
*/
@ApiOperation(value = "获取app最新版本", notes = "作者: 潘维吉")
@GetMapping("/version")
public ResponseEntity<Result<AppLatestVersionVO>> getAppLatestVersion(
@ApiParam(value = "客户端类型: 1.android 2.ios", required = true) @RequestParam Integer clientType) {
return success(appService.getAppLatestVersion(clientType));
}
} }
package com.antai.sport.http.server.mobile.api.business.app.mapper; package com.antai.sport.http.server.mobile.api.business.app.mapper;
import com.antai.sport.http.server.mobile.api.business.app.vo.AppDownloadPathVO; import com.antai.sport.http.server.mobile.api.business.app.vo.AppDownloadPathVO;
import com.antai.sport.http.server.mobile.api.business.app.vo.AppLatestVersionVO;
import org.apache.ibatis.annotations.Param;
public interface AppBusinessMapper { public interface AppBusinessMapper {
AppDownloadPathVO getAppDownloadPath(); AppDownloadPathVO getAppDownloadPath();
AppLatestVersionVO getAppLatestVersion(@Param("clientType") Integer clientType);
} }
...@@ -2,6 +2,7 @@ package com.antai.sport.http.server.mobile.api.business.app.service; ...@@ -2,6 +2,7 @@ package com.antai.sport.http.server.mobile.api.business.app.service;
import com.antai.sport.http.server.mobile.api.business.app.mapper.AppBusinessMapper; import com.antai.sport.http.server.mobile.api.business.app.mapper.AppBusinessMapper;
import com.antai.sport.http.server.mobile.api.business.app.vo.AppDownloadPathVO; import com.antai.sport.http.server.mobile.api.business.app.vo.AppDownloadPathVO;
import com.antai.sport.http.server.mobile.api.business.app.vo.AppLatestVersionVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -14,4 +15,8 @@ public class AppService { ...@@ -14,4 +15,8 @@ public class AppService {
public AppDownloadPathVO getAppDownloadPath() { public AppDownloadPathVO getAppDownloadPath() {
return appBusinessMapper.getAppDownloadPath(); return appBusinessMapper.getAppDownloadPath();
} }
public AppLatestVersionVO getAppLatestVersion(Integer clientType) {
return appBusinessMapper.getAppLatestVersion(clientType);
}
} }
package com.antai.sport.http.server.mobile.api.business.app.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 潘维吉
* @date 2019/10/17 14:50
* @email 406798106@qq.com
* @description APP最新版本VO
*/
@ApiModel(value = "AppLatestVersionVO", description = "APP最新版本接口响应数据")
@Getter
@Setter
@ToString
public class AppLatestVersionVO {
/**
* 版本号x.y.z
*/
@ApiModelProperty("版本号x.y.z")
private String version;
/**
* 更新内容
*/
@ApiModelProperty("更新内容")
private String content;
/**
* 下载URL
*/
@ApiModelProperty("下载页url")
private String downloadPageUrl;
/**
* false.不强制 true.强制
*/
@ApiModelProperty("false.不强制 true.强制")
private Boolean forceUpdate;
}
...@@ -53,6 +53,7 @@ project: ...@@ -53,6 +53,7 @@ project:
- /match/bicycle/auto/create - /match/bicycle/auto/create
- /test/** - /test/**
- /app/download/path - /app/download/path
- /app/version
swagger: swagger:
enable: false enable: false
......
...@@ -5,4 +5,12 @@ ...@@ -5,4 +5,12 @@
select (select url from app_version where client_type = 1 order by id desc limit 1) as android_path, select (select url from app_version where client_type = 1 order by id desc limit 1) as android_path,
(select download_page_url from app_version where client_type = 2 order by id desc limit 1) as ios_path (select download_page_url from app_version where client_type = 2 order by id desc limit 1) as ios_path
</select> </select>
<select id="getAppLatestVersion" resultType="com.antai.sport.http.server.mobile.api.business.app.vo.AppLatestVersionVO">
select version,content,download_page_url,force_update
from app_version
where client_type=#{clientType}
order by id desc
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment