diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..108d17f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/src/main/java/com/tihai/controller/ diff --git a/src/main/java/com/tihai/SuperAutoApplication.java b/src/main/java/com/tihai/SuperAutoApplication.java deleted file mode 100644 index f11a2f3..0000000 --- a/src/main/java/com/tihai/SuperAutoApplication.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.tihai; - -import lombok.extern.slf4j.Slf4j; -import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.core.env.Environment; -import org.springframework.scheduling.annotation.EnableScheduling; - -import java.net.InetAddress; -import java.net.UnknownHostException; - -/** - * @Copyright : DuanInnovator - * @Description :启动类 - * @Author : DuanInnovator - * @CreateTime : 2025/2/28 - * @Link : ... - **/ -@SpringBootApplication() -@EnableConfigurationProperties -@EnableDubbo -@EnableDiscoveryClient -@MapperScan("com.tihai.mapper") -@EnableScheduling -@Slf4j -public class SuperAutoApplication { - public static void main(String[] args) throws UnknownHostException { - SpringApplication app = new SpringApplicationBuilder(SuperAutoApplication.class).build(args); - Environment env = app.run(args).getEnvironment(); - String protocol = "http"; - if (env.getProperty("server.ssl.key-store") != null) { - protocol = "https"; - } - - String appName = env.getProperty("spring.application.name"); - String port = env.getProperty("server.port"); - String ip = InetAddress.getLocalHost().getHostAddress(); - String[] profiles = env.getActiveProfiles(); - String speed = env.getProperty("study.chaoxing.speed"); - - // ANSI 颜色定义 - String GREEN = "\033[1;32m"; - String CYAN = "\033[1;36m"; - String YELLOW = "\033[1;33m"; - String RESET = "\033[0m"; - - log.info("\n" + - "---------------------------------------------------------------------------------------\n" + - " 🚀 {}Application '{}' is running!{}\n\n" + - " 🔗 {}Local: {}://localhost:{}\n" + - " 🌐 {}External: {}://{}:{}\n" + - " 📦 {}Profile(s): {}\n" + - " 📚 {}Study Speed: {}\n" + - "---------------------------------------------------------------------------------------\n", - GREEN, appName, RESET, - CYAN, protocol, port, - CYAN, protocol, ip, port, - YELLOW, String.join(", ", profiles), - YELLOW, speed - ); - } - -} - diff --git a/src/main/java/com/tihai/controller/SuperStarController.java b/src/main/java/com/tihai/controller/SuperStarController.java deleted file mode 100644 index 017fa3c..0000000 --- a/src/main/java/com/tihai/controller/SuperStarController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.tihai.controller; - -import com.tihai.common.R; -import com.tihai.dubbo.dto.CourseSubmitTaskDTO; -import com.tihai.enums.BizCodeEnum; -import com.tihai.service.superstar.impl.SuperStarTaskServiceImpl; -import ma.glasnost.orika.MapperFacade; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; - -/** - * @Copyright : DuanInnovator - * @Description : 超星学习通-控制器 - * @Author : DuanInnovator - * @CreateTime : 2025/2/28 - * @Link : ... - **/ -@SuppressWarnings("all") -@RestController -@RequestMapping("/chaoxing") -public class SuperStarController { - - @Autowired - private SuperStarTaskServiceImpl chaoXingTaskService; - - @Autowired - private MapperFacade mapperFacade; - - /** - * 添加网课代刷任务 - * - * @return - */ - @PostMapping("") - public R addChaxingTask(@RequestBody @Valid CourseSubmitTaskDTO courseSubmitTaskDTO) { - - try { - chaoXingTaskService.addChaoXingTask(courseSubmitTaskDTO); - } catch (Exception e) { - - return R.error(BizCodeEnum.TASK_ALREADY_EXIST.getCode(), BizCodeEnum.TASK_ALREADY_EXIST.getMsg()); - } - return R.ok(); - } - - /** - * 启动任务 - */ - @GetMapping("") - public void start(){ - chaoXingTaskService.startChaoxingTask(); - } -} - diff --git a/src/main/java/com/tihai/controller/SuperStarCourseController.java b/src/main/java/com/tihai/controller/SuperStarCourseController.java deleted file mode 100644 index ec1f332..0000000 --- a/src/main/java/com/tihai/controller/SuperStarCourseController.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.tihai.controller; - -import com.tihai.dubbo.pojo.course.Course; -import com.tihai.common.R; -import com.tihai.domain.chaoxing.WkUser; -import com.tihai.dubbo.dto.WKUserDTO; -import com.tihai.enums.BizCodeEnum; -import com.tihai.service.superstar.SuperStarLoginService; -import com.tihai.utils.CourseUtil; -import ma.glasnost.orika.MapperFacade; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.io.IOException; -import java.util.List; - -/** - * @Copyright : DuanInnovator - * @Description : 超星-学习通获取用户课程 - * @Author : DuanInnovator - * @CreateTime : 2025/3/4 - * @Link : ... - **/ -@RestController -@RequestMapping("/chaoxing") -public class SuperStarCourseController { - - @Autowired - private SuperStarLoginService loginService; - @Autowired - private CourseUtil courseUtil; - - @Autowired - private MapperFacade mapperFacade; - - - /** - * 超星-学习通获取用户课程 - * @param userDTO 用户信息 - * @return 课程列表 - */ - @PostMapping("/course") - public R getCourseList(@RequestBody WKUserDTO userDTO) throws IOException { - String cookies = loginService.login(mapperFacade.map(userDTO, WkUser.class),false); - if(cookies!=null){ - courseUtil.setCookies(cookies); - courseUtil.setAccount(userDTO.getAccount()); - List courseList = courseUtil.getCourseList(); - return R.ok().put(courseList); - - }else { - return R.error(BizCodeEnum.ACCOUNT_OR_PASSWORD_ERROR.getCode(), BizCodeEnum.ACCOUNT_OR_PASSWORD_ERROR.getMsg()); - } - - } - - - -} - diff --git a/src/main/java/com/tihai/test/main.java b/src/main/java/com/tihai/test/main.java new file mode 100644 index 0000000..e7211c0 --- /dev/null +++ b/src/main/java/com/tihai/test/main.java @@ -0,0 +1,15 @@ +package com.tihai.test; + +/** + * @Copyright : DuanInnovator + * @Description : + * @Author : DuanInnovator + * @CreateTime : 2025/5/11 + * @Link : ... + **/ +public class main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} + diff --git a/src/main/resources/super-star.yml b/src/main/resources/super-star.yml deleted file mode 100644 index 582c22f..0000000 --- a/src/main/resources/super-star.yml +++ /dev/null @@ -1,17 +0,0 @@ -custom: - thread-pool: - core-size: 5 - max-size: 10 - keep-alive: 60 - queue-capacity: 100 - thread-name-prefix: "priority-pool-" - allow-core-thread-timeout: true - -study: - chaoxing: - speed: 3 - -cors: - allow: - origins: - - "http://localhost:3030"