commit
98c1115223
@ -0,0 +1,38 @@
|
||||
package com.zh.project0512.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.zh.project0512.model.Task;
|
||||
import com.zh.project0512.service.ITaskService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Tag(name = "定时任务")
|
||||
@RestController
|
||||
public class ScheduleController {
|
||||
@Autowired
|
||||
private ITaskService taskService;
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void taskBegin() {
|
||||
UpdateWrapper<Task> ew = new UpdateWrapper<>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
ew.eq("status",0).eq("date_format(start, '%Y-%m-%d')", now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.set("status",1).set("updateAt",now);
|
||||
taskService.update(ew);
|
||||
}
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void taskEnd() {
|
||||
UpdateWrapper<Task> ew = new UpdateWrapper<>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
ew.eq("status",1).eq("date_format(end, '%Y-%m-%d')", now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.set("status",2).set("updateAt",now);
|
||||
taskService.update(ew);
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package com.zh.project0512.controller.manage;
|
||||
|
||||
import com.zh.project0512.utils.result.Result;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "抖音")
|
||||
@RestController
|
||||
@RequestMapping("/douyin")
|
||||
public class DouyinController {
|
||||
private String rootUrl = "https://open.douyin.com";
|
||||
@PostMapping("/code")
|
||||
public Result getCode(){
|
||||
String url = rootUrl + "/platform/oauth/connect/";
|
||||
// String content = HttpClientDownPage.sendGet(url);
|
||||
return Result.success("content");
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.zh.project0512.controller.manage;
|
||||
|
||||
import com.zh.project0512.utils.result.Result;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "快手")
|
||||
@RestController
|
||||
@RequestMapping("/ks")
|
||||
public class KsController {
|
||||
|
||||
@Value("${ks.appid}")
|
||||
private String appid;
|
||||
@Value("${ks.secret}")
|
||||
private String secret;
|
||||
@Value("${ks.redirectUrl}")
|
||||
private String redirectUrl;
|
||||
|
||||
private String rootUrl = "https://open.kuaishou.com";
|
||||
@PostMapping("/code")
|
||||
public Result getCode(){
|
||||
String code = "e1609427a93aa4434335c4d3e9a1773dd79e135cc65b965a725ade4e8b856996063874c4";
|
||||
String url = rootUrl + "/oauth2/access_token";
|
||||
Map<String, String> param = new HashMap<>();
|
||||
param.put("app_id", appid);
|
||||
param.put("app_secret", secret);
|
||||
param.put("code",code);
|
||||
param.put("grant_type", "authorization_code");
|
||||
String s = null;
|
||||
System.out.println(s);
|
||||
|
||||
return Result.success(s);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue