Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
新增 翻译 更新
Browse files Browse the repository at this point in the history
  • Loading branch information
KingPrimes authored and KingPrimes committed Jul 14, 2022
1 parent ab9315b commit 2b24162
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/maven.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.twg.bot.warframe.service.IWarframeTranslationService;
import com.twg.bot.warframe.utils.forums.GetForumsRivenDispositionUpdates;
import com.twg.bot.warframe.utils.forums.RivenDispositionUpdatesImage;
import com.twg.common.core.domain.AjaxResult;
import com.twg.common.core.redis.RedisCache;
import com.twg.common.utils.ListUtils;
import com.twg.common.utils.ip.GetServerPort;
Expand All @@ -28,15 +29,15 @@ public class RivenDispositionUpdatesTask {
* @throws Exception 可能存在空异常
*/
@Scheduled(cron = "0 0 0 * * ?")
public void renewRivenDisposition() throws Exception {
System.out.println("开始更新紫卡倾向");
//@Log(title = "WarframeRivenDisposition",businessType = BusinessType.INSERT)
public AjaxResult renewRivenDisposition() throws Exception {
List<WarframeRivenTrend> trends = GetForumsRivenDispositionUpdates.getRivenDispositionUpdates("");
List<WarframeRivenTrend> redis_trends = new ArrayList<>();
List<WarframeRivenTrend> redis_trends;
try {
//获取之前的缓存
redis_trends = SpringUtils.getBean(RedisCache.class).getCacheList("renew-riven-disposition");
} catch (Exception e) {
System.out.println("更新紫卡倾向失败:" + e.getMessage());
return AjaxResult.error("紫卡更新失败,错误信息:" + e.getMessage());
}

List<WarframeRivenTrend> image = new ArrayList<>();
Expand All @@ -62,5 +63,6 @@ public void renewRivenDisposition() throws Exception {
SpringUtils.getBean(RedisCache.class).setCacheList("renew-riven-disposition", trends);
SendAllGroup.sendAllGroup(Msg.builder().img("http://localhost:" + GetServerPort.getPort() + "/warframe/forums/riven/getNewsImage"), FunctionEnums.FUNCTION_WARFRAME);
}
return AjaxResult.success("紫卡更新完成");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.twg.bot.warframe.task;

import com.twg.bot.warframe.utils.WarframeTraUtils;
import com.twg.common.core.domain.AjaxResult;
import com.twg.common.utils.spring.SpringUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class WarframeTraTask {

@Scheduled(cron = "0 0 0 1/7 * ? ")
//@Log(title = "WarframeTra",businessType = BusinessType.INSERT)
public AjaxResult TaskUserDict() {
int i = SpringUtils.getBean(WarframeTraUtils.class).getUserDict();
return AjaxResult.success("翻译更新完成,共更新:" + i + "条数据");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

@Component
public class WarframeTraUtils {
//获取灰机Wiki的翻译词条
//https://warframe.huijiwiki.com/api.php?action=query&format=json&prop=revisions&titles=UserDict&formatversion=2&rvprop=content&rvlimit=1

@Autowired
WarframeTranslationServiceImpl translate;
Expand Down

0 comments on commit 2b24162

Please sign in to comment.