Junjie
6 天以前 72c49f3afa22c4f84760d57001e45a4fadf2d482
src/main/java/com/zy/asrs/service/impl/ApkBuildTaskServiceImpl.java
@@ -2,7 +2,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.asrs.entity.ApkBuildTask;
import com.zy.asrs.mapper.ApkBuildTaskMapper;
import com.zy.asrs.service.ApkBuildTaskService;
@@ -47,7 +47,7 @@
    private String adbPath;
    @Override
    public ApkBuildTask triggerBuild(String buildType, String repoAlias, String branch) throws Exception {
    public ApkBuildTask triggerBuild(String buildType, String androidTarget, String repoAlias, String branch, String serverUrl) throws Exception {
        // 检查是否有正在进行中的任务(状态0=等待中,1=打包中)
        List<ApkBuildTask> pendingTasks = this.baseMapper.selectPendingTasks();
        if (!pendingTasks.isEmpty()) {
@@ -61,8 +61,10 @@
        // 构建请求JSON
        JSONObject requestBody = new JSONObject();
        requestBody.put("build_type", buildType);
        requestBody.put("android_target", androidTarget);
        requestBody.put("repo_alias", repoAlias);
        requestBody.put("branch", branch);
        requestBody.put("server_url", serverUrl);
        // 发送打包请求
        Map<String, Object> headers = new HashMap<>();
@@ -101,13 +103,13 @@
        task.setQueueSize(queueSize);
        task.setCreatedAt(new Date());
        this.insert(task);
        this.save(task);
        return task;
    }
    @Override
    public ApkBuildTask refreshStatus(Long id) throws Exception {
        ApkBuildTask task = this.selectById(id);
        ApkBuildTask task = this.getById(id);
        if (task == null) {
            throw new RuntimeException("任务不存在");
        }
@@ -192,7 +194,7 @@
    @Override
    public String downloadApk(Long id) throws Exception {
        ApkBuildTask task = this.selectById(id);
        ApkBuildTask task = this.getById(id);
        if (task == null) {
            throw new RuntimeException("任务不存在");
        }
@@ -266,7 +268,7 @@
    @Override
    public String installApk(Long id, String deviceIp) throws Exception {
        ApkBuildTask task = this.selectById(id);
        ApkBuildTask task = this.getById(id);
        if (task == null) {
            throw new RuntimeException("任务不存在");
        }