44 lines
1.6 KiB
Java
44 lines
1.6 KiB
Java
package com.peanut.modules.common.controller;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.peanut.common.utils.R;
|
|
import com.peanut.modules.common.entity.ApkConfigEntity;
|
|
import com.peanut.modules.common.service.ApkConfigService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.Map;
|
|
|
|
@Slf4j
|
|
@RestController("commonApkConfigController")
|
|
@RequestMapping("/common/apkConfig")
|
|
public class ApkConfigController {
|
|
@Autowired
|
|
private ApkConfigService apkConfigService;
|
|
|
|
|
|
@RequestMapping("/getApkUrl")
|
|
public R getApkUrl(@RequestBody Map<String,Integer> map){
|
|
String url = apkConfigService.getApkUrl(map.get("type"));
|
|
return R.ok().put("result",url);
|
|
}
|
|
|
|
//获取更新包地址
|
|
@RequestMapping("/getUpdateUrl")
|
|
public R getUpdateUrl(@RequestBody Map<String,Object> params){
|
|
ApkConfigEntity apkConfig = apkConfigService.getOne(new LambdaQueryWrapper<ApkConfigEntity>()
|
|
.eq(ApkConfigEntity::getType,params.get("type")));
|
|
String updateUrl = "";
|
|
String appVer = params.get("version").toString();
|
|
if (StringUtils.isNotEmpty(apkConfig.getVersion())&&apkConfig.getVersion().contains(appVer)) {
|
|
updateUrl = apkConfig.getUpdateUrl();
|
|
}
|
|
return R.ok().put("updateUrl",updateUrl);
|
|
}
|
|
|
|
}
|