Skip to content

Commit

Permalink
Merge pull request #2 from kdyzm/kdyzm
Browse files Browse the repository at this point in the history
添加xxl-job特殊前缀,防止接口路径和主项目冲突
  • Loading branch information
kdyzm authored May 12, 2021
2 parents 378957c + fcd2a1b commit fd15df9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ public ExecutorBizClient(String addressUrl, String accessToken) {

@Override
public ReturnT<String> beat() {
return XxlJobRemotingUtil.postBody(addressUrl+"beat", accessToken, timeout, "", String.class);
return XxlJobRemotingUtil.postBody(addressUrl+"xxl-job/beat", accessToken, timeout, "", String.class);
}

@Override
public ReturnT<String> idleBeat(IdleBeatParam idleBeatParam){
return XxlJobRemotingUtil.postBody(addressUrl+"idleBeat", accessToken, timeout, idleBeatParam, String.class);
return XxlJobRemotingUtil.postBody(addressUrl+"xxl-job/idleBeat", accessToken, timeout, idleBeatParam, String.class);
}

@Override
public ReturnT<String> run(TriggerParam triggerParam) {
return XxlJobRemotingUtil.postBody(addressUrl + "run", accessToken, timeout, triggerParam, String.class);
return XxlJobRemotingUtil.postBody(addressUrl + "xxl-job/run", accessToken, timeout, triggerParam, String.class);
}

@Override
public ReturnT<String> kill(KillParam killParam) {
return XxlJobRemotingUtil.postBody(addressUrl + "kill", accessToken, timeout, killParam, String.class);
return XxlJobRemotingUtil.postBody(addressUrl + "xxl-job/kill", accessToken, timeout, killParam, String.class);
}

@Override
public ReturnT<LogResult> log(LogParam logParam) {
return XxlJobRemotingUtil.postBody(addressUrl + "log", accessToken, timeout, logParam, LogResult.class);
return XxlJobRemotingUtil.postBody(addressUrl + "xxl-job/log", accessToken, timeout, logParam, LogResult.class);
}

}
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
package com.xxl.job.core.controller;

import com.google.gson.Gson;
import com.xxl.job.core.biz.impl.ExecutorBizImpl;
import com.xxl.job.core.biz.model.*;
import groovy.util.logging.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @author kdyzm
* @date 2021/5/7
*/
@RestController
@RequestMapping("/xxl-job")
public class XxlJobController {

private static final Logger log = LoggerFactory.getLogger(XxlJobController.class);

@PostMapping("/beat")
public ReturnT<String> beat() {
log.debug("接收到beat请求");
return new ExecutorBizImpl().beat();
}

@PostMapping("/idleBeat")
public ReturnT<String> idleBeat(@RequestBody IdleBeatParam param) {
log.debug("接收到idleBeat请求,{}",new Gson().toJson(param));
return new ExecutorBizImpl().idleBeat(param);
}

@PostMapping("/run")
public ReturnT<String> run(@RequestBody TriggerParam param) {
log.debug("接收到run请求,{}",new Gson().toJson(param));
return new ExecutorBizImpl().run(param);
}

@PostMapping("/kill")
public ReturnT<String> kill(@RequestBody KillParam param) {
log.debug("接收到kill请求,{}",new Gson().toJson(param));
return new ExecutorBizImpl().kill(param);
}

Expand Down

0 comments on commit fd15df9

Please sign in to comment.