mirror of
https://github.com/luoye663/e5.git
synced 2024-12-26 19:58:50 +00:00
~
This commit is contained in:
parent
e3efe64926
commit
23d8501ee4
@ -15,4 +15,6 @@ public class OutlookVo {
|
||||
private String clientSecret;
|
||||
private Integer cronTimeRandomStart;
|
||||
private Integer cronTimeRandomEnd;
|
||||
private Integer step;
|
||||
private Integer status;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class SaveRandomBo {
|
||||
private int outlookId;
|
||||
private int cronTime;
|
||||
private String crondomTime;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import io.qyi.e5.outlook.bean.bo.insertOneBO;
|
||||
import io.qyi.e5.outlook.entity.Outlook;
|
||||
import io.qyi.e5.outlook.service.IOutlookService;
|
||||
import io.qyi.e5.util.ResultUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@ -34,6 +35,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/outlook/outlook")
|
||||
@Slf4j
|
||||
public class OutlookController {
|
||||
|
||||
@Autowired
|
||||
@ -96,7 +98,7 @@ public class OutlookController {
|
||||
return ResultUtil.error(-1, "最大间隔时间为 6 小时");
|
||||
}
|
||||
UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
||||
if (outlookService.saveRandomTime(authentication.getGithub_id(), bo.getCronTime(), cron_time_random_start, cron_time_random_end)) {
|
||||
if (outlookService.saveRandomTime(authentication.getGithub_id(), bo.getCronTime(), bo.getOutlookId(), cron_time_random_start, cron_time_random_end)) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
return ResultUtil.error(ResultEnum.UNKNOWN_ERROR);
|
||||
@ -126,6 +128,7 @@ public class OutlookController {
|
||||
List<OutlookListVo> vo = new ArrayList<>();
|
||||
outlooklist.forEach(outlook -> {
|
||||
OutlookListVo v = new OutlookListVo();
|
||||
log.info(outlook.toString());
|
||||
BeanUtils.copyProperties(outlook, v);
|
||||
vo.add(v);
|
||||
});
|
||||
|
@ -65,6 +65,12 @@ public class Outlook implements Serializable {
|
||||
|
||||
/*描述*/
|
||||
private String describes;
|
||||
|
||||
/*步骤*/
|
||||
private Integer step;
|
||||
/**
|
||||
* 随机时间结束
|
||||
* 状态: 1、等待配置 2、暂停 3、运行中 4、封禁 5、已停止(由于调用错误导致的停止)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public interface IOutlookService extends IService<Outlook> {
|
||||
|
||||
boolean save(String client_id, String client_secret, int outlook_id, int github_id);
|
||||
|
||||
boolean saveRandomTime(int github_id, int cron_time, int cron_time_random_start, int cron_time_random_end);
|
||||
boolean saveRandomTime(int github_id, int cron_time, int outlook_id, int cron_time_random_start, int cron_time_random_end);
|
||||
|
||||
int getMailList(Outlook outlook) throws Exception;
|
||||
|
||||
|
@ -116,6 +116,8 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
|
||||
}
|
||||
outlook1.setClientId(client_id);
|
||||
outlook1.setClientSecret(client_secret);
|
||||
outlook1.setStep(1)
|
||||
.setStatus(8);;
|
||||
if (baseMapper.update(outlook1, queryWrapper) != 1) {
|
||||
throw new APIException("更新记录失败!");
|
||||
}
|
||||
@ -123,14 +125,20 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveRandomTime(int github_id, int cron_time, int cron_time_random_start, int cron_time_random_end) {
|
||||
if (github_id == 0) {
|
||||
return false;
|
||||
public boolean saveRandomTime(int github_id, int cron_time, int outlook_id ,int cron_time_random_start, int cron_time_random_end) {
|
||||
if (github_id == 0 || outlook_id == 0) {
|
||||
throw new APIException("缺少参数!");
|
||||
}
|
||||
UpdateWrapper<Outlook> Wrapper = new UpdateWrapper<>();
|
||||
Wrapper.eq("github_id", github_id);
|
||||
Wrapper.eq("id", outlook_id);
|
||||
Outlook outlook = new Outlook();
|
||||
outlook.setCronTime(cron_time).setCronTimeRandomStart(cron_time_random_start).setCronTimeRandomEnd(cron_time_random_end);
|
||||
outlook.setCronTime(cron_time)
|
||||
.setCronTimeRandomStart(cron_time_random_start)
|
||||
.setCronTimeRandomEnd(cron_time_random_end)
|
||||
.setStep(2)
|
||||
.setStatus(6);
|
||||
|
||||
int update = baseMapper.update(outlook, Wrapper);
|
||||
// 有数据
|
||||
if (update > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user