update 文档管理 翻译bug修改
This commit is contained in:
parent
c73dc4db7b
commit
95573662ff
|
@ -0,0 +1,30 @@
|
||||||
|
package com.m2pool.manage.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.mongodb.MongoDatabaseFactory;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.data.mongodb.core.SimpleMongoClientDatabaseFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description TODO
|
||||||
|
* @Date 2023/4/17 18:46
|
||||||
|
* @Author 杜懿
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public abstract class AbstractMongoDbConfig {
|
||||||
|
private String host;
|
||||||
|
private String port;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String database;
|
||||||
|
public MongoDatabaseFactory mongoDatabaseFactory() {
|
||||||
|
String connectionString = "mongodb://" + username + ":" + password+ "@"+ host+":"+port +"/" + database;
|
||||||
|
return new SimpleMongoClientDatabaseFactory(connectionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MongoDatabaseFactory mongoDatabaseNoUserFactory() {
|
||||||
|
String connectionString = "mongodb://"+ host+":"+port +"/" + database;
|
||||||
|
return new SimpleMongoClientDatabaseFactory(connectionString);
|
||||||
|
}
|
||||||
|
public abstract MongoTemplate getMongoTemplate();
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.m2pool.manage.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 管理系统html文档管理器
|
||||||
|
* @Date 2025/7/23 10:00
|
||||||
|
* @Author yyb
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties("spring.data.mongodb.documentation")
|
||||||
|
public class MongoDbConfig extends AbstractMongoDbConfig{
|
||||||
|
@Primary
|
||||||
|
@Bean(name = "docMongoTemplate")
|
||||||
|
@Override
|
||||||
|
public MongoTemplate getMongoTemplate() {
|
||||||
|
return new MongoTemplate(mongoDatabaseNoUserFactory());
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,9 +37,21 @@ public class ManageCatalogueDocumentDto {
|
||||||
@ApiModelProperty(value = "创建时间",example = "2025-05-22 14:22:13")
|
@ApiModelProperty(value = "创建时间",example = "2025-05-22 14:22:13")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "文档类型",example = "0其他 1服务条款 2api文档 3挖矿教程")
|
@ApiModelProperty(value = "文档类型",example = "1.挖矿教程 2.常见问题 3.公告中心 0.其他")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "文档子类型",example = "0没有 1服务条款、2费率、3API文档")
|
@ApiModelProperty(value = "文档子类型",example = "0没有 1服务条款、2费率、3API文档")
|
||||||
private Integer childType;
|
private Integer childType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文档标题链接",example = "https://www.m2pool.com")
|
||||||
|
private String titleUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文档内容链接",example = "https://www.m2pool.com")
|
||||||
|
private String articleUrl;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "币种",example = "rxd")
|
||||||
|
private String coin;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,21 @@ public class ManageDocumentDto {
|
||||||
@ApiModelProperty(value = "创建时间",example = "2025-05-22 14:22:13")
|
@ApiModelProperty(value = "创建时间",example = "2025-05-22 14:22:13")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "文档类型",example = "0其他 1服务条款 2api文档 3挖矿教程")
|
@ApiModelProperty(value = "文档类型",example = "1.挖矿教程 2.常见问题 3.公告中心 0.其他")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "文档子类型",example = "0没有 1服务条款、2费率、3API文档")
|
@ApiModelProperty(value = "文档子类型",example = "0没有 1服务条款、2费率、3API文档")
|
||||||
private Integer childType;
|
private Integer childType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文档标题链接",example = "https://www.m2pool.com")
|
||||||
|
private String titleUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文档内容链接",example = "https://www.m2pool.com")
|
||||||
|
private String articleUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "币种",example = "rxd")
|
||||||
|
private String coin;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ public class ManageDocuments {
|
||||||
|
|
||||||
private String updateUser;
|
private String updateUser;
|
||||||
|
|
||||||
|
private String coin;
|
||||||
|
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
private Integer childType;
|
private Integer childType;
|
||||||
|
@ -47,6 +49,11 @@ public class ManageDocuments {
|
||||||
|
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
private String titleUrl;
|
||||||
|
|
||||||
|
private String articleUrl;
|
||||||
|
|
||||||
|
|
||||||
private Boolean del;
|
private Boolean del;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,9 +93,9 @@ public class ManageBroadcastServiceImpl extends ServiceImpl<ManageBroadcastMappe
|
||||||
}else{
|
}else{
|
||||||
collect = list.stream().map(broadcast -> {
|
collect = list.stream().map(broadcast -> {
|
||||||
//如果英文为null,需要翻译并保存一下
|
//如果英文为null,需要翻译并保存一下
|
||||||
if("".equals(broadcast.getContentEn()) || "".equals(broadcast.getButtonContentEn())){
|
if("".equals(broadcast.getContentEn()) || ("".equals(broadcast.getButtonContentEn()) && "".equals(broadcast.getButtonContent()))){
|
||||||
broadcast.setContentEn(TranslateUtils.translate(broadcast.getContent(), "zh", "en"));
|
|
||||||
broadcast.setButtonContentEn(TranslateUtils.translate(broadcast.getButtonContent(), "zh", "en"));
|
broadcast.setButtonContentEn(TranslateUtils.translate(broadcast.getButtonContent(), "zh", "en"));
|
||||||
|
broadcast.setContentEn(TranslateUtils.translate(broadcast.getContent(), "zh", "en"));
|
||||||
manageBroadcastMapper.updateById(broadcast);
|
manageBroadcastMapper.updateById(broadcast);
|
||||||
}
|
}
|
||||||
return ManageBroadcastDto.builder()
|
return ManageBroadcastDto.builder()
|
||||||
|
@ -115,7 +115,6 @@ public class ManageBroadcastServiceImpl extends ServiceImpl<ManageBroadcastMappe
|
||||||
return R.success(collect);
|
return R.success(collect);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String SEPARATE = ",yKbjIAIgFpbdESYaE7A,";
|
|
||||||
/**
|
/**
|
||||||
* 新增广播信息
|
* 新增广播信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.m2pool.manage.service.impl;
|
package com.m2pool.manage.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
@ -20,6 +21,12 @@ import com.m2pool.manage.vo.ManageBaseVo;
|
||||||
import com.m2pool.manage.vo.ManageCatalogueVo;
|
import com.m2pool.manage.vo.ManageCatalogueVo;
|
||||||
import com.m2pool.manage.vo.ManageDocumentVo;
|
import com.m2pool.manage.vo.ManageDocumentVo;
|
||||||
import com.m2pool.manage.vo.ManageSearchDocumentVo;
|
import com.m2pool.manage.vo.ManageSearchDocumentVo;
|
||||||
|
import com.mongodb.client.result.DeleteResult;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
|
import org.springframework.data.mongodb.core.query.Update;
|
||||||
|
import org.springframework.data.mongodb.core.query.UpdateDefinition;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -34,6 +41,10 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
@Resource
|
@Resource
|
||||||
private ManageDocumentsMapper manageDocumentsMapper;
|
private ManageDocumentsMapper manageDocumentsMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource(name = "docMongoTemplate")
|
||||||
|
private MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<ManageDocumentDto> getListDataByPage(ManageSearchDocumentVo manageSearchDocumentVo) {
|
public TableDataInfo<ManageDocumentDto> getListDataByPage(ManageSearchDocumentVo manageSearchDocumentVo) {
|
||||||
PageHelper.startPage(manageSearchDocumentVo.getPageNum(), manageSearchDocumentVo.getPageSize());
|
PageHelper.startPage(manageSearchDocumentVo.getPageNum(), manageSearchDocumentVo.getPageSize());
|
||||||
|
@ -97,6 +108,9 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
.childType(manageDocumentVo.getChildType())
|
.childType(manageDocumentVo.getChildType())
|
||||||
.createUser(SecurityUtils.getUsername())
|
.createUser(SecurityUtils.getUsername())
|
||||||
.updateUser(SecurityUtils.getUsername())
|
.updateUser(SecurityUtils.getUsername())
|
||||||
|
.articleUrl(manageDocumentVo.getArticleUrl())
|
||||||
|
.titleUrl(manageDocumentVo.getTitleUrl())
|
||||||
|
.coin(manageDocumentVo.getCoin())
|
||||||
.build();
|
.build();
|
||||||
}else{
|
}else{
|
||||||
//中文转英文
|
//中文转英文
|
||||||
|
@ -109,11 +123,16 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
.titleEn(TranslateUtils.translate(manageDocumentVo.getTitle(), fromCountry, toCountry))
|
.titleEn(TranslateUtils.translate(manageDocumentVo.getTitle(), fromCountry, toCountry))
|
||||||
.subTitleEn(TranslateUtils.translate(manageDocumentVo.getSubTitle(), fromCountry, toCountry))
|
.subTitleEn(TranslateUtils.translate(manageDocumentVo.getSubTitle(), fromCountry, toCountry))
|
||||||
.childType(manageDocumentVo.getChildType())
|
.childType(manageDocumentVo.getChildType())
|
||||||
|
.articleUrl(manageDocumentVo.getArticleUrl())
|
||||||
|
.titleUrl(manageDocumentVo.getTitleUrl())
|
||||||
.createUser(SecurityUtils.getUsername())
|
.createUser(SecurityUtils.getUsername())
|
||||||
.updateUser(SecurityUtils.getUsername())
|
.updateUser(SecurityUtils.getUsername())
|
||||||
|
.coin(manageDocumentVo.getCoin())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
int insert = manageDocumentsMapper.insert(build);
|
int insert = manageDocumentsMapper.insert(build);
|
||||||
|
//存入mongodb 方便以后如果mysql查询限制时切换
|
||||||
|
mongoTemplate.save(build, "documents");
|
||||||
if (insert > 0){
|
if (insert > 0){
|
||||||
return R.success("添加文章成功");
|
return R.success("添加文章成功");
|
||||||
}
|
}
|
||||||
|
@ -123,6 +142,7 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
@Override
|
@Override
|
||||||
public R<String> deleteDocument(ManageBaseVo manageBaseVo) {
|
public R<String> deleteDocument(ManageBaseVo manageBaseVo) {
|
||||||
int delete = manageDocumentsMapper.deleteById(manageBaseVo.getId());
|
int delete = manageDocumentsMapper.deleteById(manageBaseVo.getId());
|
||||||
|
DeleteResult remove = mongoTemplate.remove(new Query(Criteria.where("id").is(manageBaseVo.getId())), "documents");
|
||||||
if (delete > 0){
|
if (delete > 0){
|
||||||
return R.success("删除文章成功");
|
return R.success("删除文章成功");
|
||||||
}
|
}
|
||||||
|
@ -134,6 +154,7 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
String fromCountry = CountryConstant.ZH;
|
String fromCountry = CountryConstant.ZH;
|
||||||
String toCountry = CountryConstant.EN;
|
String toCountry = CountryConstant.EN;
|
||||||
ManageDocuments build;
|
ManageDocuments build;
|
||||||
|
Update update = new Update();
|
||||||
//英文转中文
|
//英文转中文
|
||||||
if (CountryConstant.EN.equals(manageDocumentVo.getLang())){
|
if (CountryConstant.EN.equals(manageDocumentVo.getLang())){
|
||||||
build = ManageDocuments.builder()
|
build = ManageDocuments.builder()
|
||||||
|
@ -145,10 +166,23 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
.title(TranslateUtils.translate(manageDocumentVo.getTitle(), toCountry, fromCountry))
|
.title(TranslateUtils.translate(manageDocumentVo.getTitle(), toCountry, fromCountry))
|
||||||
.subTitle(TranslateUtils.translate(manageDocumentVo.getSubTitle(), toCountry, fromCountry))
|
.subTitle(TranslateUtils.translate(manageDocumentVo.getSubTitle(), toCountry, fromCountry))
|
||||||
.childType(manageDocumentVo.getChildType())
|
.childType(manageDocumentVo.getChildType())
|
||||||
|
.articleUrl(manageDocumentVo.getArticleUrl())
|
||||||
|
.titleUrl(manageDocumentVo.getTitleUrl())
|
||||||
.createUser(SecurityUtils.getUsername())
|
.createUser(SecurityUtils.getUsername())
|
||||||
.updateUser(SecurityUtils.getUsername())
|
.updateUser(SecurityUtils.getUsername())
|
||||||
.type(manageDocumentVo.getType())
|
.type(manageDocumentVo.getType())
|
||||||
|
.coin(manageDocumentVo.getCoin())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// 英文转中文
|
||||||
|
update.set("titleEn", manageDocumentVo.getTitle())
|
||||||
|
.set("subTitleEn", manageDocumentVo.getSubTitle())
|
||||||
|
.set("contentEn", manageDocumentVo.getContent())
|
||||||
|
.set("articleUrl", manageDocumentVo.getArticleUrl())
|
||||||
|
.set("titleUrl", manageDocumentVo.getTitleUrl())
|
||||||
|
.set("content", TranslateUtils.translate(manageDocumentVo.getContent(), toCountry, fromCountry))
|
||||||
|
.set("title", TranslateUtils.translate(manageDocumentVo.getTitle(), toCountry, fromCountry))
|
||||||
|
.set("subTitle", TranslateUtils.translate(manageDocumentVo.getSubTitle(), toCountry, fromCountry));
|
||||||
}else{
|
}else{
|
||||||
//中文转英文
|
//中文转英文
|
||||||
build = ManageDocuments.builder()
|
build = ManageDocuments.builder()
|
||||||
|
@ -159,13 +193,34 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
.contentEn(TranslateUtils.translate(manageDocumentVo.getContent(), fromCountry, toCountry))
|
.contentEn(TranslateUtils.translate(manageDocumentVo.getContent(), fromCountry, toCountry))
|
||||||
.titleEn(TranslateUtils.translate(manageDocumentVo.getTitle(), fromCountry, toCountry))
|
.titleEn(TranslateUtils.translate(manageDocumentVo.getTitle(), fromCountry, toCountry))
|
||||||
.subTitleEn(TranslateUtils.translate(manageDocumentVo.getSubTitle(), fromCountry, toCountry))
|
.subTitleEn(TranslateUtils.translate(manageDocumentVo.getSubTitle(), fromCountry, toCountry))
|
||||||
|
.articleUrl(manageDocumentVo.getArticleUrl())
|
||||||
|
.titleUrl(manageDocumentVo.getTitleUrl())
|
||||||
.childType(manageDocumentVo.getChildType())
|
.childType(manageDocumentVo.getChildType())
|
||||||
.createUser(SecurityUtils.getUsername())
|
.createUser(SecurityUtils.getUsername())
|
||||||
.updateUser(SecurityUtils.getUsername())
|
.updateUser(SecurityUtils.getUsername())
|
||||||
.type(manageDocumentVo.getType())
|
.type(manageDocumentVo.getType())
|
||||||
|
.coin(manageDocumentVo.getCoin())
|
||||||
.build();
|
.build();
|
||||||
|
// 中文转英文
|
||||||
|
update.set("title", manageDocumentVo.getTitle())
|
||||||
|
.set("subTitle", manageDocumentVo.getSubTitle())
|
||||||
|
.set("content", manageDocumentVo.getContent())
|
||||||
|
.set("articleUrl", manageDocumentVo.getArticleUrl())
|
||||||
|
.set("titleUrl", manageDocumentVo.getTitleUrl())
|
||||||
|
.set("contentEn", TranslateUtils.translate(manageDocumentVo.getContent(), fromCountry, toCountry))
|
||||||
|
.set("titleEn", TranslateUtils.translate(manageDocumentVo.getTitle(), fromCountry, toCountry))
|
||||||
|
.set("subTitleEn", TranslateUtils.translate(manageDocumentVo.getSubTitle(), fromCountry, toCountry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update.set("childType", manageDocumentVo.getChildType())
|
||||||
|
.set("createUser", SecurityUtils.getUsername())
|
||||||
|
.set("updateUser", SecurityUtils.getUsername())
|
||||||
|
.set("type", manageDocumentVo.getType());
|
||||||
|
|
||||||
|
Query query = new Query(Criteria.where("id").is(manageDocumentVo.getId()));
|
||||||
|
|
||||||
|
mongoTemplate.updateFirst(query, update, "documents");
|
||||||
|
|
||||||
int insert = manageDocumentsMapper.updateById(build);
|
int insert = manageDocumentsMapper.updateById(build);
|
||||||
if (insert > 0){
|
if (insert > 0){
|
||||||
return R.success("修改文章成功");
|
return R.success("修改文章成功");
|
||||||
|
@ -173,9 +228,23 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
return R.fail("修改文章失败");
|
return R.fail("修改文章失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<ManageDocumentDto> findDataInfo(ManageBaseVo manageBaseVo) {
|
public R<ManageDocumentDto> findDataInfo(ManageBaseVo manageBaseVo) {
|
||||||
ManageDocuments documents = this.getById(manageBaseVo.getId());
|
LambdaQueryWrapper<ManageDocuments> wrapper = new LambdaQueryWrapper<ManageDocuments>();
|
||||||
|
if (manageBaseVo.getId() != null) {
|
||||||
|
wrapper.eq(ManageDocuments::getId, manageBaseVo.getId());
|
||||||
|
}
|
||||||
|
if (manageBaseVo.getChildType() != null){
|
||||||
|
wrapper.eq(ManageDocuments::getChildType, manageBaseVo.getChildType());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ManageDocuments> manageDocuments = manageDocumentsMapper.selectList(wrapper);
|
||||||
|
if (manageDocuments.isEmpty()){
|
||||||
|
return R.fail("未找到该文章");
|
||||||
|
}
|
||||||
|
ManageDocuments documents = manageDocuments.get(0);
|
||||||
|
|
||||||
ManageDocumentDto build = null;
|
ManageDocumentDto build = null;
|
||||||
if(documents != null){
|
if(documents != null){
|
||||||
build = ManageDocumentDto.builder()
|
build = ManageDocumentDto.builder()
|
||||||
|
@ -183,11 +252,15 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||||
.title(documents.getTitle())
|
.title(documents.getTitle())
|
||||||
.subTitle(documents.getSubTitle())
|
.subTitle(documents.getSubTitle())
|
||||||
.content(documents.getContent())
|
.content(documents.getContent())
|
||||||
|
.articleUrl(documents.getArticleUrl())
|
||||||
|
.titleUrl(documents.getTitleUrl())
|
||||||
.createUser(documents.getCreateUser())
|
.createUser(documents.getCreateUser())
|
||||||
.updateUser(documents.getUpdateUser())
|
.updateUser(documents.getUpdateUser())
|
||||||
.updateTime(documents.getUpdateTime())
|
.updateTime(documents.getUpdateTime())
|
||||||
.createTime(documents.getCreateTime())
|
.createTime(documents.getCreateTime())
|
||||||
|
.childType(documents.getChildType())
|
||||||
.type(documents.getType())
|
.type(documents.getType())
|
||||||
|
.coin(documents.getCoin())
|
||||||
.build();
|
.build();
|
||||||
if (CountryConstant.EN.equals(manageBaseVo.getLang())){
|
if (CountryConstant.EN.equals(manageBaseVo.getLang())){
|
||||||
build.setTitle(documents.getTitleEn());
|
build.setTitle(documents.getTitleEn());
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.m2pool.manage.service.ManageWalletOutInService;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
|
@ -10,8 +10,14 @@ import java.util.Map;
|
||||||
public class TranslateUtils {
|
public class TranslateUtils {
|
||||||
private static final String TRANS_API_HOST = "https://fanyi-api.baidu.com/api/trans/vip/translate";
|
private static final String TRANS_API_HOST = "https://fanyi-api.baidu.com/api/trans/vip/translate";
|
||||||
|
|
||||||
private static String appid = "20250702002395339";
|
//private static String appid = "20250702002395339";
|
||||||
private static String securityKey ="yKbjIAIg_FpbdESYaE7A";
|
//private static String securityKey ="yKbjIAIg_FpbdESYaE7A";
|
||||||
|
|
||||||
|
|
||||||
|
private static String appid = "20250731002420396";
|
||||||
|
private static String securityKey ="fSFN5UNOV4tfm5oBDuin";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String translate(String query, String from, String to) {
|
public static String translate(String query, String from, String to) {
|
||||||
Map<String, String> params = buildParams(query, from, to);
|
Map<String, String> params = buildParams(query, from, to);
|
||||||
|
|
|
@ -25,4 +25,7 @@ public class ManageBaseVo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "语言",example = "zh")
|
@ApiModelProperty(value = "语言",example = "zh")
|
||||||
private String lang;
|
private String lang;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文档子类型",example = "0没有 1服务条款、2费率、3API文档")
|
||||||
|
private Integer childType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import lombok.NoArgsConstructor;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ApiModel(value = "ManageCatalogueVo",description = "文档目录请求对象")
|
@ApiModel(value = "ManageCatalogueVo",description = "文档目录请求对象")
|
||||||
public class ManageCatalogueVo extends PageVo{
|
public class ManageCatalogueVo extends PageVo{
|
||||||
@ApiModelProperty(value = "文档类型",example = "0其他 1服务条款 2api文档 3挖矿教程")
|
@ApiModelProperty(value = "文档类型",example = "1.挖矿教程 2.常见问题 3.公告中心 0.其他")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "语言",example = "zh")
|
@ApiModelProperty(value = "语言",example = "zh")
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.m2pool.manage.vo;
|
package com.m2pool.manage.vo;
|
||||||
|
|
||||||
import com.m2pool.common.core.web.Result.PageResult;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -32,7 +30,7 @@ public class ManageDocumentVo {
|
||||||
@ApiModelProperty(value = "内容",example = "文档内容")
|
@ApiModelProperty(value = "内容",example = "文档内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@ApiModelProperty(value = "文档类型",example = "0其他 1服务条款 2api文档 3挖矿教程")
|
@ApiModelProperty(value = "文档类型",example = "1.挖矿教程 2.常见问题 3.公告中心 0.其他")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "语言",example = "zh中文 en英文")
|
@ApiModelProperty(value = "语言",example = "zh中文 en英文")
|
||||||
|
@ -40,4 +38,15 @@ public class ManageDocumentVo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "文档子类型",example = "0没有 1服务条款、2费率、3API文档")
|
@ApiModelProperty(value = "文档子类型",example = "0没有 1服务条款、2费率、3API文档")
|
||||||
private Integer childType;
|
private Integer childType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文档标题链接",example = "https://www.m2pool.com")
|
||||||
|
private String titleUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文档内容链接",example = "https://www.m2pool.com")
|
||||||
|
private String articleUrl;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "币种",example = "rxd")
|
||||||
|
private String coin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,10 @@ SELECT
|
||||||
update_time as updateTime,
|
update_time as updateTime,
|
||||||
create_time as createTime,
|
create_time as createTime,
|
||||||
type,
|
type,
|
||||||
child_type as childType
|
child_type as childType,
|
||||||
|
article_url as articleUrl,
|
||||||
|
title_url as titleUrl,
|
||||||
|
coin
|
||||||
FROM
|
FROM
|
||||||
manage_documents
|
manage_documents
|
||||||
<where>
|
<where>
|
||||||
|
@ -64,7 +67,10 @@ FROM
|
||||||
update_time as updateTime,
|
update_time as updateTime,
|
||||||
create_time as createTime,
|
create_time as createTime,
|
||||||
type,
|
type,
|
||||||
child_type as childType
|
child_type as childType,
|
||||||
|
article_url as articleUrl,
|
||||||
|
title_url as titleUrl,
|
||||||
|
coin
|
||||||
FROM
|
FROM
|
||||||
manage_documents
|
manage_documents
|
||||||
<where>
|
<where>
|
||||||
|
@ -103,11 +109,20 @@ FROM
|
||||||
update_time as updateTime,
|
update_time as updateTime,
|
||||||
create_time as createTime,
|
create_time as createTime,
|
||||||
type,
|
type,
|
||||||
child_type as childType
|
child_type as childType,
|
||||||
|
article_url as articleUrl,
|
||||||
|
title_url as titleUrl,
|
||||||
|
coin
|
||||||
from
|
from
|
||||||
manage_documents
|
manage_documents
|
||||||
where
|
<where>
|
||||||
del = false and type = #{type} and child_type = #{childType}
|
del = false and child_type = #{childType}
|
||||||
|
<if test="type != null">
|
||||||
|
AND type = #{type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
|
||||||
order by id desc
|
order by id desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue