|
@@ -1,17 +1,48 @@
|
|
|
package com.lemon.lifecenter.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.lemon.lifecenter.dto.AppVersionDTO;
|
|
|
+import com.lemon.lifecenter.service.RestApiService;
|
|
|
+
|
|
|
@RestController
|
|
|
public class RestApiController {
|
|
|
- @RequestMapping()
|
|
|
- public Map<String, String> appVersion() {
|
|
|
- HashMap<String, String> result = new HashMap<String, String>();
|
|
|
+
|
|
|
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RestApiService restApiService;
|
|
|
+
|
|
|
+ @RequestMapping("/mobile/getAppVersion")
|
|
|
+ public ArrayList<HashMap<String, String>> appVersion(@RequestParam(value="deviceType", required=false, defaultValue="") String deviceType) {
|
|
|
+ ArrayList<HashMap<String, String>> result = new ArrayList<>();
|
|
|
+ HashMap<String, String> data = new HashMap<String, String>();
|
|
|
|
|
|
+ String code = "99";
|
|
|
+ if (deviceType.equals("")) {
|
|
|
+ code = "01";
|
|
|
+ } else {
|
|
|
+ AppVersionDTO dto = restApiService.selectAppVersion(deviceType);
|
|
|
+ if (dto == null) {
|
|
|
+ code = "02";
|
|
|
+ } else {
|
|
|
+ code = "00";
|
|
|
+ data.put("version", dto.getVersion());
|
|
|
+ data.put("downloadUrl", dto.getDownloadUrl());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ data.put("code", code);
|
|
|
+ result.add(data);
|
|
|
return result;
|
|
|
}
|
|
|
}
|