admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.yeshi.fanli.service.manger;
 
import java.util.HashMap;
import java.util.Map;
 
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import org.yeshi.utils.HttpUtil;
 
import com.yeshi.fanli.entity.accept.AcceptData;
 
@Component
public class AppUpdateManager {
 
    public String getUpdateInfo(AcceptData acceptData) {
        Map<String, String> params = new HashMap<>();
        if ("android".equalsIgnoreCase(acceptData.getPlatform())) {// android更新
            params.put("method", "update");
            params.put("Platform", "Android");
            params.put("Version", acceptData.getVersion());
            params.put("device  ", acceptData.getDevice());
            params.put("time", System.currentTimeMillis() + "");
            params.put("Package", acceptData.getPackages());
            params.put("device", acceptData.getDevice());
            params.put("platform", "Android");
            params.put("key", "a3f390d88e4c41f2747bfa2f1b5f87db");
            params.put("versionCode", acceptData.getVersion() + "");
        } else {// IOS更新
            params.put("method", "update");
            params.put("Platform", "IOS");
            params.put("Version", acceptData.getVersion());
            params.put("device  ", acceptData.getDevice());
            params.put("time", System.currentTimeMillis() + "");
            params.put("Package", acceptData.getPackages());
            params.put("device", acceptData.getDevice());
            params.put("platform", "IOS");
            params.put("key", "32bb90e8976aab5298d5da10fe66f21d");
            params.put("versionCode", acceptData.getVersion() + "");
        }
        String url = "http://update.yeshitv.com:8090/update/update";
        String result = HttpUtil.post(url, params, null);
        return result;
    }
 
    @Cacheable(value = "config", key = "#acceptData.platform+'-'+#acceptData.version")
    public String getUpdateInfoCache(AcceptData acceptData) {
        return getUpdateInfo(acceptData);
    }
 
}