Compare commits
7 Commits
b210b114d5
...
261cbe38d2
| Author | SHA1 | Date | |
|---|---|---|---|
| 261cbe38d2 | |||
| dccbb10512 | |||
| 89bf55b4ce | |||
| 5bd7f61c55 | |||
| c791d4fc17 | |||
| d5af03e5a4 | |||
| 1e7c2099bf |
@@ -0,0 +1,25 @@
|
||||
package com.m2pool.system.api;
|
||||
|
||||
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.common.core.constant.ServiceNameConstants;
|
||||
import com.m2pool.system.api.entity.SysUser;
|
||||
import com.m2pool.system.api.factory.RemotePoolFallbackFactory;
|
||||
import com.m2pool.system.api.factory.RemoteUserFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @Description 矿池服务
|
||||
* @Date 2026/1/5 10:15
|
||||
* @Author yyb
|
||||
*/
|
||||
@FeignClient(contextId = "remotePoolService",value = ServiceNameConstants.POOL_SERVICE,fallbackFactory = RemotePoolFallbackFactory.class)
|
||||
public interface RemotePoolService {
|
||||
|
||||
@PostMapping("/user/deleteUserDataAndPutTemporaryTable")
|
||||
R<Boolean> deleteUserDataAndPutTemporaryTable();
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.m2pool.system.api;
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.common.core.constant.SecurityConstants;
|
||||
import com.m2pool.common.core.constant.ServiceNameConstants;
|
||||
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||
import com.m2pool.system.api.entity.SysUser;
|
||||
import com.m2pool.system.api.entity.SysUserLeveDate;
|
||||
import com.m2pool.system.api.factory.RemoteUserFallbackFactory;
|
||||
@@ -82,7 +83,7 @@ public interface RemoteUserService {
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/user/profile/checkGoogleCode")
|
||||
public R<Boolean> checkGoogleCode(@RequestBody Long code, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
public R<Boolean> checkGoogleCode(@RequestBody CloseAccountVo closeAccountVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取客服列表
|
||||
@@ -92,4 +93,12 @@ public interface RemoteUserService {
|
||||
@GetMapping("/user/getCSList")
|
||||
public R<List<SysUser>> getCSList();
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/user/closeAccount")
|
||||
R<Boolean> closeAccount(@RequestBody SysUser sysUser);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.m2pool.system.api.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CloseAccountVo {
|
||||
|
||||
@Email
|
||||
private String userEmail;
|
||||
|
||||
/**
|
||||
* 谷歌验证器验证码
|
||||
*/
|
||||
@ApiModelProperty(value = "谷歌验证码",required = true)
|
||||
public long gCode;
|
||||
|
||||
/**
|
||||
* 邮箱验证码
|
||||
*/
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "邮箱验证码",required = true)
|
||||
public String eCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.m2pool.system.api.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description 用户矿机在离线的数量
|
||||
* @Date 2024/6/12 16:13
|
||||
* @Author dy
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EmailTemplateEntity implements Serializable {
|
||||
|
||||
/** 邮箱 */
|
||||
private String email;
|
||||
|
||||
/** 主题 */
|
||||
private String subject;
|
||||
|
||||
/** 模版名称 */
|
||||
private String templateName;
|
||||
|
||||
/** 填充到模版的数据 */
|
||||
private Map<String,Object> data;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.m2pool.system.api.factory;
|
||||
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.system.api.RemotePoolService;
|
||||
import com.m2pool.system.api.RemoteUserService;
|
||||
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||
import com.m2pool.system.api.entity.SysUser;
|
||||
import com.m2pool.system.api.entity.SysUserLeveDate;
|
||||
import com.m2pool.system.api.model.LoginUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 矿池服务
|
||||
* @Date 2026/1/5 10:17
|
||||
* @Author yyb
|
||||
*/
|
||||
@Component
|
||||
public class RemotePoolFallbackFactory implements FallbackFactory<RemotePoolService> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemotePoolFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemotePoolService create(Throwable cause) {
|
||||
log.error("矿池服务调用失败:{}",cause.getMessage());
|
||||
return new RemotePoolService(){
|
||||
@Override
|
||||
public R<Boolean> deleteUserDataAndPutTemporaryTable() {
|
||||
return R.fail("注销账户失败," + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.m2pool.system.api.factory;
|
||||
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.system.api.RemoteUserService;
|
||||
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||
import com.m2pool.system.api.entity.SysUser;
|
||||
import com.m2pool.system.api.entity.SysUserLeveDate;
|
||||
import com.m2pool.system.api.model.LoginUser;
|
||||
@@ -60,7 +61,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> checkGoogleCode(Long code, String source) {
|
||||
public R<Boolean> checkGoogleCode(CloseAccountVo closeAccountVo, String source) {
|
||||
return R.fail("谷歌验证器校验失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@@ -69,6 +70,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||
return R.fail("客服列表获取失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> closeAccount(SysUser sysUser) {
|
||||
return R.fail("注销用户失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<artifactId>m2pool-auth</artifactId>
|
||||
|
||||
<description>认证模块:登录认证、权限鉴定等</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
@@ -71,6 +70,19 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.m2pool</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.m2pool.auth;
|
||||
|
||||
import com.m2pool.common.security.annotation.EnableCustomConfig;
|
||||
import com.m2pool.common.security.annotation.EnableM2PoolFeignClients;
|
||||
import com.m2pool.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableM2PoolFeignClients
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
public class M2PoolAuthApplication{
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.m2pool.common.security.annotation.RequiresLogin;
|
||||
import com.m2pool.common.security.auth.AuthUtil;
|
||||
import com.m2pool.common.security.service.TokenService;
|
||||
import com.m2pool.common.security.utils.SecurityUtils;
|
||||
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||
import com.m2pool.system.api.entity.EmailTemplateEntity;
|
||||
import com.m2pool.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -86,6 +87,10 @@ public class TokenController {
|
||||
return maliService.resetPwdCode(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("updatePwdCode")
|
||||
public R<?> updatePwdCode()
|
||||
{
|
||||
@@ -93,6 +98,29 @@ public class TokenController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注销账户
|
||||
* @param closeAccountVo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/closeAccount")
|
||||
@ApiOperation(value = "用户注销")
|
||||
public R<?> closeAccount(@RequestBody @Valid CloseAccountVo closeAccountVo){
|
||||
return sysLoginService.closeAccount(closeAccountVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送注销账户邮件
|
||||
* @param emailCodeVo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/sendCloseAccount")
|
||||
@ApiOperation(value = "发送注销用户邮箱验证码")
|
||||
public R<?> sendCloseAccount(@RequestBody @Valid GetLoginEmailCodeEntity emailCodeVo){
|
||||
return maliService.sendCloseAccount(emailCodeVo);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("hello")
|
||||
public R<?> hello()
|
||||
{
|
||||
|
||||
@@ -4,6 +4,9 @@ import com.m2pool.auth.entity.GetEmailCodeEntity;
|
||||
import com.m2pool.auth.entity.GetLoginEmailCodeEntity;
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.system.api.entity.EmailTemplateEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
@@ -73,4 +76,19 @@ public interface MailService {
|
||||
|
||||
public R<?> updatePwdCode();
|
||||
|
||||
|
||||
/**
|
||||
* 账号注销验证码
|
||||
* @param emailCodeVo
|
||||
* @return
|
||||
*/
|
||||
R<?> sendCloseAccount(GetLoginEmailCodeEntity emailCodeVo);
|
||||
|
||||
|
||||
/**
|
||||
* 账号注销邮箱验证码 消息格式设置
|
||||
* @param to
|
||||
* @param code
|
||||
*/
|
||||
void sendCloseAccountMailMessage(String to, String code);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.m2pool.auth.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||
import com.m2pool.auth.entity.*;
|
||||
import com.m2pool.common.core.RedisTransKey;
|
||||
import com.m2pool.common.core.Result.R;
|
||||
@@ -12,6 +11,7 @@ import com.m2pool.common.core.enums.UserStatus;
|
||||
import com.m2pool.common.core.exception.ServiceException;
|
||||
import com.m2pool.common.core.text.Convert;
|
||||
import com.m2pool.common.core.utils.DateUtils;
|
||||
import com.m2pool.common.core.utils.GoogleAuthenticator;
|
||||
import com.m2pool.common.core.utils.ServletUtils;
|
||||
import com.m2pool.common.core.utils.StringUtils;
|
||||
import com.m2pool.common.core.utils.ip.IpUtils;
|
||||
@@ -22,16 +22,15 @@ import com.m2pool.common.security.service.TokenService;
|
||||
import com.m2pool.common.security.utils.SecurityUtils;
|
||||
import com.m2pool.system.api.RemoteLogService;
|
||||
import com.m2pool.system.api.RemoteUserService;
|
||||
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||
import com.m2pool.system.api.entity.SysLogininfor;
|
||||
import com.m2pool.system.api.entity.SysUser;
|
||||
import com.m2pool.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -562,5 +561,55 @@ public class SysLoginService {
|
||||
remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);
|
||||
}
|
||||
|
||||
public R<?> closeAccount(CloseAccountVo closeAccountVo){
|
||||
String email = closeAccountVo.getUserEmail();
|
||||
String emailCode = closeAccountVo.getECode();
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isBlank(email))
|
||||
{
|
||||
recordLogininfor(email, Constants.LOGIN_FAIL, "邮箱必须填写");
|
||||
throw new ServiceException("邮箱必须填写");
|
||||
}
|
||||
if(!StringUtils.isBlank(email)){
|
||||
if(!email.matches(EMAIL_REGEX)){
|
||||
throw new ServiceException("邮箱格式错误");
|
||||
}
|
||||
}else {
|
||||
throw new ServiceException("邮箱为必填项");
|
||||
}
|
||||
String closeAccountKey = RedisTransKey.getCloseAccountKey(email);
|
||||
System.out.println("redis 的 key"+closeAccountKey);
|
||||
//校验谷歌验证码和邮箱验证码
|
||||
if(redisService.hasKey(closeAccountKey)){
|
||||
Object o = redisService.getCacheObject(closeAccountKey);//user:emailCode:email
|
||||
EmailCodeEntity emailCodeEntity = JSON.parseObject(JSON.toJSONString(o), EmailCodeEntity.class);
|
||||
//验证验证码
|
||||
if(emailCode.equals(emailCodeEntity.getEmailCode())){
|
||||
//不做处理 进入后续登录流程
|
||||
}else {
|
||||
throw new ServiceException("验证码错误");
|
||||
}
|
||||
}else {
|
||||
throw new ServiceException("验证码未获取或已过期,请重新获取验证码");
|
||||
}
|
||||
R<Boolean> booleanR1 = remoteUserService.checkGoogleCode(closeAccountVo, SecurityConstants.INNER);
|
||||
System.out.println("谷歌验证码"+booleanR1);
|
||||
//if(booleanR1 == null || !booleanR1.getData()){
|
||||
// throw new ServiceException("谷歌验证码错误");
|
||||
//}
|
||||
|
||||
R<LoginUser> userInfo = remoteUserService.getUserInfo(SecurityUtils.getUsername(), SecurityConstants.INNER);
|
||||
if (R.FAIL == userInfo.getCode()) {
|
||||
throw new ServiceException("服务器请求失败请稍后再试");
|
||||
}
|
||||
SysUser sysUser = userInfo.getData().getSysUser();
|
||||
sysUser.setDelFlag("2");
|
||||
|
||||
R<Boolean> booleanR = remoteUserService.closeAccount(sysUser);
|
||||
if (R.FAIL == booleanR.getCode()) {
|
||||
throw new ServiceException("服务器请求失败请稍后再试");
|
||||
}
|
||||
return booleanR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -556,4 +556,62 @@ public class MaliServiceImpl implements MailService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> sendCloseAccount(GetLoginEmailCodeEntity emailCodeVo) {
|
||||
String email = SecurityUtils.getUsername();
|
||||
if(StringUtils.isBlank(email)){
|
||||
return R.fail("token解析失败");
|
||||
}
|
||||
//通过邮箱获取用户
|
||||
R<LoginUser> userByEmail = remoteUserService.getUserInfo(email, SecurityConstants.INNER);
|
||||
|
||||
if(StringUtils.isNull(userByEmail.getData())){
|
||||
return R.fail("token解析异常");
|
||||
}
|
||||
|
||||
//判断用户是不是恶意刷邮箱,在规定时间内进行的
|
||||
String closeAccountKey = RedisTransKey.getCloseAccountKey(email);
|
||||
System.out.println("redis 的 key"+closeAccountKey);
|
||||
if (redisService.hasKey(closeAccountKey)) {
|
||||
|
||||
Object o = redisService.getCacheObject(closeAccountKey);//user:updatePwdCode:email
|
||||
|
||||
EmailCodeEntity emailCodeEntity = JSON.parseObject(JSON.toJSONString(o), EmailCodeEntity.class);
|
||||
if (emailCodeEntity.getTimes() >= 5) {
|
||||
return R.fail("请求次数过多,请10分钟后再试");
|
||||
} else {
|
||||
//这里就不去判断两次绑定的邮箱是不是一样的了,不排除第一次输入错了邮箱的情况
|
||||
String emailCode = CodeUtils.creatCode(6);
|
||||
emailCodeEntity.setEmailCode(emailCode);
|
||||
emailCodeEntity.setTimes(emailCodeEntity.getTimes() + 1);
|
||||
long overTime = redisService.getExpire(closeAccountKey);
|
||||
redisService.setCacheObject(closeAccountKey, emailCodeEntity, overTime, TimeUnit.SECONDS
|
||||
);
|
||||
sendCloseAccountMailMessage(email, emailCodeEntity.getEmailCode());
|
||||
}
|
||||
} else {
|
||||
String emailCode = CodeUtils.creatCode(6);
|
||||
// 最多允许用户在10分钟内发送2次的邮箱验证
|
||||
// 0s倒计时后用户可以再发送验证码,但是间隔在10分钟内只能再发送1次
|
||||
EmailCodeEntity emailCodeEntity = new EmailCodeEntity(
|
||||
email, emailCode,1
|
||||
);
|
||||
//设置失效时间10分钟
|
||||
redisService.setCacheObject(closeAccountKey, emailCodeEntity,
|
||||
10L, TimeUnit.MINUTES
|
||||
);
|
||||
sendCloseAccountMailMessage(email, emailCodeEntity.getEmailCode());
|
||||
}
|
||||
return R.success("请求成功,注销账户邮箱验证码发送成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCloseAccountMailMessage(String to, String code) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("code",code);
|
||||
content.put("text","You are logging out of the user account. If this is not done by you, please ignore it. The verification code is valid for 10 minutes.");
|
||||
EmailTemplateEntity entity = new EmailTemplateEntity(to,"Change password, email verification code","emailCode-en",content);
|
||||
sendHtmlMailMessage(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ server:
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant-path-matcher
|
||||
#邮箱基本配置
|
||||
mail:
|
||||
# 配置在limit_time内,用户可以发送limit次验证码
|
||||
|
||||
@@ -15,6 +15,7 @@ public class RedisTransKey {
|
||||
public static final String RedisAddCreditEmailCodeName="addCreditEmailCode";
|
||||
public static final String RedisResetPwdCodeName="restPwdCode";
|
||||
public static final String RedisUpdatePwdCodeName="updatePwdCode";
|
||||
public static final String RedisCloseAccountName="closeAccount";
|
||||
|
||||
public static String setEmailKey(String key){
|
||||
return RedisNameSpace+":"+RedisEmailCodeName+":"+key;
|
||||
@@ -39,6 +40,10 @@ public class RedisTransKey {
|
||||
return RedisNameSpace+":"+RedisAddCreditEmailCodeName+":"+key;
|
||||
}
|
||||
|
||||
public static String setCloseAccountKey(String key){
|
||||
return RedisNameSpace+":"+RedisCloseAccountName+":"+key;
|
||||
}
|
||||
|
||||
public static String getEmailKey(String key){return setEmailKey(key);}
|
||||
public static String getRootKey(String key){return setRootKey(key);}
|
||||
public static String getTokenKey(String key){return setTokenKey(key);}
|
||||
@@ -47,4 +52,8 @@ public class RedisTransKey {
|
||||
public static String getUpdatePwdKey(String key){return setUpdatePwdKey(key);}
|
||||
public static String getAddCreditEmailKey(String key){return setAddCreditEmailKey(key);}
|
||||
|
||||
public static String getCloseAccountKey(String key){return setCloseAccountKey(key);}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.m2pool.common.datasource.annotation;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 矿池数据库(只读)
|
||||
*/
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@DS("mining")
|
||||
public @interface MiningDB {
|
||||
}
|
||||
@@ -5,11 +5,19 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
@@ -19,13 +27,21 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
* @Date 2024/6/13 09:58
|
||||
* @Author dy
|
||||
*/
|
||||
@RefreshScope
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
|
||||
@Value("${spring.redis.host}")
|
||||
private String host;
|
||||
@Value("${spring.redis.port}")
|
||||
private int port;
|
||||
@Value("${spring.redis.database:0}")
|
||||
private int database = 0;
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
|
||||
public RedisTemplate<Object, Object> redisTemplate(@Qualifier("redisConnectionFactory0") RedisConnectionFactory connectionFactory)
|
||||
{
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
@@ -50,6 +66,45 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean(name = "redisTemplate7")
|
||||
public RedisTemplate<Object, Object> redisTemplate7(@Qualifier("redisConnectionFactory7") RedisConnectionFactory redisConnectionFactory0) {
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(redisConnectionFactory0);
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
template.setValueSerializer(new StringRedisSerializer());
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 7号 数据库 - >
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public RedisConnectionFactory redisConnectionFactory7() {
|
||||
LettuceConnectionFactory factory = new LettuceConnectionFactory();
|
||||
factory.setHostName(host);
|
||||
factory.setPort(port);
|
||||
factory.setDatabase(7);
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认 数据库
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@Primary //添加@Primary默认使用的库
|
||||
public RedisConnectionFactory redisConnectionFactory0() {
|
||||
LettuceConnectionFactory factory = new LettuceConnectionFactory();
|
||||
factory.setHostName(host);
|
||||
factory.setPort(port);
|
||||
factory.setDatabase(database);
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
public DefaultRedisScript<Long> limitScript()
|
||||
{
|
||||
@@ -62,6 +117,8 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||
return redisScript;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 限流脚本
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.m2pool.common.redis.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.redis.core.BoundSetOperations;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@@ -21,8 +22,14 @@ import java.util.concurrent.TimeUnit;
|
||||
public class RedisService {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("redisTemplate")
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("redisTemplate7")
|
||||
private RedisTemplate redisTemplate7;
|
||||
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
@@ -34,6 +41,7 @@ public class RedisService {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
@@ -47,6 +55,12 @@ public class RedisService {
|
||||
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setCacheObject7(final String key, final T value, final Long timeout, final TimeUnit timeUnit)
|
||||
{
|
||||
redisTemplate7.opsForValue().set(key, value, timeout, timeUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置有效时间
|
||||
*
|
||||
@@ -118,6 +132,12 @@ public class RedisService {
|
||||
return operation.get(key);
|
||||
}
|
||||
|
||||
public <T> T getCacheObject7(final String key)
|
||||
{
|
||||
ValueOperations<String, T> operation = redisTemplate7.opsForValue();
|
||||
return operation.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有数字类型转换为BigDecimal
|
||||
* @param key 缓存键值
|
||||
@@ -153,6 +173,7 @@ public class RedisService {
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除集合对象
|
||||
*
|
||||
|
||||
@@ -179,5 +179,5 @@ public class GlobalExceptionHandler {
|
||||
log.error("请求地址'{}',发生SQL异常.", requestURI, e);
|
||||
return AjaxResult.error(HttpStatus.ERROR, "数据库异常!");
|
||||
}
|
||||
//todo 根据业务需求增加异常
|
||||
//todo 根据业务需求增加异常
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ public class HeaderInterceptor implements AsyncHandlerInterceptor {
|
||||
SecurityContextHolder.setUserKey(ServletUtils.getHeader(request,SecurityConstants.USER_KEY));
|
||||
|
||||
//开发环境
|
||||
String authorization = request.getHeader("Authorization");
|
||||
String userName = JwtUtils.getUserName(authorization);
|
||||
SecurityContextHolder.setUserName(userName);
|
||||
//String authorization = request.getHeader("Authorization");
|
||||
//String userName = JwtUtils.getUserName(authorization);
|
||||
//SecurityContextHolder.setUserName(userName);
|
||||
|
||||
String token = SecurityUtils.getToken();
|
||||
if(StringUtils.isNotEmpty(token)){
|
||||
|
||||
@@ -78,7 +78,7 @@ public class WebsocketChannelInterceptor implements ChannelInterceptor {
|
||||
//获取链接建立时的请求头信息
|
||||
StompHeaderAccessor accessor = StompHeaderAccessor.wrap(message);
|
||||
if (accessor.getCommand() == StompCommand.CONNECT ) {
|
||||
System.out.println("yyb-开始链接"+new Date());
|
||||
System.out.println("开始链接"+new Date());
|
||||
StompHeaderAccessor mha = MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class);
|
||||
if(mha == null){
|
||||
throw new MessageDeliveryException(ExceptionEnum.fromCode(ExceptionEnum.SET_PRINCIPAL_FAIL));
|
||||
@@ -92,7 +92,7 @@ public class WebsocketChannelInterceptor implements ChannelInterceptor {
|
||||
ipLimit(accessor,type,email);
|
||||
//链接请求头中用户信息存入stomp中
|
||||
mha.setUser(new StompPrincipal(email,type,true));
|
||||
System.out.println("yyb-链接成功"+new Date());
|
||||
System.out.println("链接成功"+new Date());
|
||||
}
|
||||
if (accessor.getCommand() == StompCommand.SUBSCRIBE) {
|
||||
LOGGER.info("------------websocket subscribe message");
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.m2pool.file.service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
* 接口
|
||||
*
|
||||
* @author dy
|
||||
*/
|
||||
|
||||
@@ -59,6 +59,6 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result<String> handleException(Exception e) {
|
||||
return Result.fail("系统异常,请稍后再试: " + e.getMessage());
|
||||
return Result.fail("系统异常,请稍后再试!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ import static com.m2pool.lease.constant.RabbitmqConstant.PAY_AUTO_QUEUE;
|
||||
@EnableScheduling
|
||||
public class OrderAndPayTask {
|
||||
|
||||
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.m2pool.pool.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.common.core.utils.StringUtils;
|
||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||
import com.m2pool.common.core.web.controller.BaseController;
|
||||
import com.m2pool.common.core.web.page.TableDataInfo;
|
||||
import com.m2pool.common.security.annotation.InnerAuth;
|
||||
import com.m2pool.common.security.annotation.RequiresLogin;
|
||||
import com.m2pool.pool.dto.UserApiDto;
|
||||
import com.m2pool.pool.service.GoogleAuthService;
|
||||
@@ -12,6 +14,7 @@ import com.m2pool.pool.service.MinerAccountService;
|
||||
import com.m2pool.pool.service.UserMinserService;
|
||||
import com.m2pool.pool.vo.*;
|
||||
import com.m2pool.system.api.RemoteUserService;
|
||||
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -243,4 +246,12 @@ public class UserController extends BaseController {
|
||||
return umService.deleteApi(vo);
|
||||
|
||||
}
|
||||
|
||||
@InnerAuth
|
||||
@PostMapping("/deleteUserDataAndPutTemporaryTable")
|
||||
@ApiOperation(value = "用户注销--删除用户(邮箱)对应相关信息并存入临时表")
|
||||
public R<?> deleteUserDataAndPutTemporaryTable(){
|
||||
return umService.deleteUserDataAndPutTemporaryTable();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ public interface PoolMapper {
|
||||
public List<PowerLineDto> getHourPoolPowerList(@Param("table") String table);
|
||||
public List<PowerLineDto> getHourNetPowerList(@Param("table") String table);
|
||||
|
||||
BigDecimal getCurrentCoinPrice(@Param("table") String table);
|
||||
|
||||
public List<BlockInfoDto> getGRSBlockInfoList();
|
||||
|
||||
public List<BlockInfoDto> getMonaBlockInfoList();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.m2pool.pool.dto.*;
|
||||
import com.m2pool.pool.entity.M2File;
|
||||
import com.m2pool.pool.entity.Ticket;
|
||||
import com.m2pool.pool.vo.*;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -154,5 +155,32 @@ public interface TicketMapper {
|
||||
*/
|
||||
public boolean insertRespon(@Param("vo") ResponTicketVo vo, @Param("name") String name);
|
||||
|
||||
/**
|
||||
* 将ticket表数据写入ticket_temporary临时表
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public boolean insertTicketToTemporary(@Param("list") List<Integer> list);
|
||||
|
||||
/**
|
||||
* 将ticket_supplement表数据写入ticket_supplement_temporary临时表
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public boolean insertTicketSupplementToTemporary(@Param("list") List<Integer> list);
|
||||
|
||||
/**
|
||||
* 删除ticket表数据
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteTicket(@Param("email") String email);
|
||||
|
||||
/**
|
||||
* 删除ticket_supplement表数据
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteTicketSupplement(@Param("email") String email);
|
||||
|
||||
}
|
||||
|
||||
@@ -111,4 +111,48 @@ public interface UserAccountMapper {
|
||||
|
||||
|
||||
List<UserAccountDto> getUserMinerByUserEmail(@Param("email") String email);
|
||||
|
||||
/**
|
||||
* 逻辑删除用户挖矿账户,将status改为11
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
boolean deleteUserAccount(@Param("username") String username);
|
||||
|
||||
/**
|
||||
* 删除用户账户余额,先根据username查询user_miner_account的id,然后根据这些id匹配ma_id删除
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
boolean deleteUserBalance(@Param("username") String username);
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户只读页面
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean deleteReadOnlyPage(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 将用户只读页面数据写入临时表
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean insertReadOnlyPageToTemporary(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 将用户API数据写入临时表
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean insertApiToTemporary(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 删除用户API
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean deleteApi(@Param("ids") List<Long> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.m2pool.pool.service;
|
||||
|
||||
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||
import com.m2pool.pool.dto.UserApiDto;
|
||||
import com.m2pool.pool.vo.*;
|
||||
@@ -57,4 +58,10 @@ public interface UserMinserService {
|
||||
//public AjaxResult getMinerPower(MinerVo com.m2pool.chat.vo);
|
||||
//
|
||||
//public AjaxResult getMinerPowerDistribution(MinerVo com.m2pool.chat.vo);
|
||||
|
||||
/**
|
||||
* 用户注销--删除用户(邮箱)对应相关信息并存入临时表
|
||||
* return
|
||||
*/
|
||||
R<?> deleteUserDataAndPutTemporaryTable();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ import com.m2pool.pool.utils.EnumUtils;
|
||||
import com.m2pool.pool.utils.NodeRpc;
|
||||
import com.m2pool.pool.utils.PowerUnitUtils;
|
||||
import com.m2pool.pool.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -33,7 +36,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -41,6 +43,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2024/6/14 14:29
|
||||
* @Author dy
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PoolServiceImpl implements PoolService {
|
||||
|
||||
@@ -182,6 +185,7 @@ public class PoolServiceImpl implements PoolService {
|
||||
public AjaxResult getPoolPower(CoinVo vo) {
|
||||
|
||||
Pools pool = (Pools) EnumUtils.get(Pools.class, vo.getCoin());
|
||||
|
||||
if(StringUtils.isNull(pool)){
|
||||
return AjaxResult.error("参数错误,未能根据当前参数获取到数据");
|
||||
}
|
||||
@@ -189,13 +193,12 @@ public class PoolServiceImpl implements PoolService {
|
||||
if(StringUtils.isBlank(vo.getInterval())){
|
||||
return AjaxResult.error("缺失参数:interval");
|
||||
}
|
||||
|
||||
PageHelper.clearPage();
|
||||
List<PowerLineDto> priceList = poolMapper.getHourPoolPowerList(pool.getCoin());
|
||||
|
||||
int scale = PoolProfitScale.getScaleByCoin(pool.getCoin());
|
||||
PowerLineDto powerLineDto = priceList.stream()
|
||||
.filter(e -> e.getDate().after(DateUtils.toDate(LocalDateTime.now().toLocalDate().atStartOfDay())))
|
||||
.max(Comparator.comparing(PowerLineDto::getPrice)).orElse(new PowerLineDto());
|
||||
|
||||
BigDecimal currentCoinPrice = poolMapper.getCurrentCoinPrice(pool.getCoin());
|
||||
|
||||
if("1h".equals(vo.getInterval()) || "rt".equals(vo.getInterval())){
|
||||
// 获取当前日期
|
||||
@@ -221,19 +224,17 @@ public class PoolServiceImpl implements PoolService {
|
||||
//数据补零
|
||||
list = fillMissingOnlineData(list,oneDayAgo,currentDate,powerUnit.getUnit(),30);
|
||||
//通过全网算力接口 获取到的时间段价格补充到矿池算力接口的价格中
|
||||
list.stream().forEach(e -> priceList.stream().anyMatch(p ->{
|
||||
list.forEach(e -> priceList.stream().anyMatch(p ->{
|
||||
if( p.getDate().equals(e.getDate())){
|
||||
e.setPrice(p.getPrice());
|
||||
}
|
||||
return false;
|
||||
}));
|
||||
|
||||
List<PowerLineDto> collect = list.stream().peek(e -> {
|
||||
if (e.getPrice() == 0) {
|
||||
e.setPrice(powerLineDto.getPrice());
|
||||
e.setPrice(currentCoinPrice.doubleValue());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return AjaxResult.success(collect);
|
||||
}else if ("1d".equals(vo.getInterval())){
|
||||
|
||||
@@ -268,7 +269,7 @@ public class PoolServiceImpl implements PoolService {
|
||||
list = changeUnit(powerUnit, list, pool,BigDecimal.valueOf(1000 * 1000));
|
||||
|
||||
list = fillMissingOnlineData(list,oneMonthAgo,currentDate,powerUnit.getUnit(),24*60);
|
||||
list.stream().forEach(e -> priceList.stream().anyMatch(p ->{
|
||||
list.forEach(e -> priceList.stream().anyMatch(p ->{
|
||||
if( p.getDate().equals(e.getDate())){
|
||||
e.setPrice(p.getPrice());
|
||||
}
|
||||
@@ -276,7 +277,7 @@ public class PoolServiceImpl implements PoolService {
|
||||
}));
|
||||
List<PowerLineDto> collect = list.stream().peek(e -> {
|
||||
if (e.getPrice() == 0) {
|
||||
e.setPrice(powerLineDto.getPrice());
|
||||
e.setPrice(currentCoinPrice.doubleValue());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
return AjaxResult.success(collect);
|
||||
@@ -423,7 +424,7 @@ public class PoolServiceImpl implements PoolService {
|
||||
List<PowerLineDto> list = poolMapper.getHourNetPowerList(pool.getCoin());
|
||||
|
||||
PowerLineDto powerLineDto = list.stream()
|
||||
.max(Comparator.comparing(PowerLineDto::getPrice)).orElse(new PowerLineDto());
|
||||
.max(Comparator.comparing(PowerLineDto::getDate)).orElse(new PowerLineDto());
|
||||
|
||||
list = list.stream().peek(e -> {
|
||||
if (e.getPrice() == 0) {
|
||||
@@ -541,7 +542,7 @@ public class PoolServiceImpl implements PoolService {
|
||||
}
|
||||
else {
|
||||
BlockInfo info = redisService.getCacheObject(pool.getCoin() + "_block");
|
||||
System.out.println("yyb-redis key"+ pool.getCoin() + "_block" +"查询结果"+ info);
|
||||
System.out.println("redis key"+ pool.getCoin() + "_block" +"查询结果"+ info);
|
||||
if(StringUtils.isNull(info)){
|
||||
if(!"enx".equals(pool.getCoin()) && !"alph".equals(pool.getCoin())){
|
||||
//
|
||||
@@ -736,7 +737,7 @@ public class PoolServiceImpl implements PoolService {
|
||||
|
||||
|
||||
List<MinerDataDto> list = poolMapper.getHourMinerDataList(vo.getCoin()+"_mhsv2",nowStr);
|
||||
if(list.size() > 0){
|
||||
if(!list.isEmpty()){
|
||||
List<MinerDataDto> offlineList = new ArrayList<>();
|
||||
list.stream().forEach(e -> {
|
||||
if(StringUtils.isNotNull(e.getMhs())){
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.m2pool.pool.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.common.core.constant.CacheConstants;
|
||||
import com.m2pool.common.core.text.Convert;
|
||||
import com.m2pool.common.core.utils.ServletUtils;
|
||||
@@ -18,6 +19,7 @@ import com.m2pool.pool.entity.*;
|
||||
import com.m2pool.pool.enums.PoolAmount;
|
||||
import com.m2pool.pool.enums.Pools;
|
||||
import com.m2pool.pool.mapper.GoogleAuthMapper;
|
||||
import com.m2pool.pool.mapper.TicketMapper;
|
||||
import com.m2pool.pool.mapper.UserAccountMapper;
|
||||
import com.m2pool.pool.service.UserMinserService;
|
||||
import com.m2pool.pool.utils.EnumUtils;
|
||||
@@ -29,6 +31,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import sun.net.util.IPAddressUtil;
|
||||
|
||||
@@ -56,7 +59,8 @@ public class UserMinerServiceImpl implements UserMinserService {
|
||||
|
||||
@Autowired
|
||||
private GoogleAuthMapper googleAuthMapper;
|
||||
|
||||
@Autowired
|
||||
private TicketMapper ticketMapper;
|
||||
|
||||
@Value("${myenv.domain}")
|
||||
private String domain;
|
||||
@@ -760,4 +764,40 @@ public class UserMinerServiceImpl implements UserMinserService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public R<?> deleteUserDataAndPutTemporaryTable() {
|
||||
String username = SecurityUtils.getUsername();
|
||||
//删除挖矿账户
|
||||
uaMapper.deleteUserAccount(username);
|
||||
uaMapper.deleteUserBalance(username);
|
||||
//删除只读页面
|
||||
List<UserReadOnlyPageInfo> readOnlyPagelist = uaMapper.getPageListByUser(username);
|
||||
List<Long> readOnlyPageIds = readOnlyPagelist.stream().map(UserReadOnlyPageInfo::getId).collect(Collectors.toList());
|
||||
if (!readOnlyPageIds.isEmpty()){
|
||||
uaMapper.insertReadOnlyPageToTemporary(readOnlyPageIds);
|
||||
uaMapper.deleteReadOnlyPage(readOnlyPageIds);
|
||||
}
|
||||
|
||||
//删除API
|
||||
List<UserApi> apiList = uaMapper.getAPIListByUser(username);
|
||||
List<Long> apiIds = apiList.stream().map(UserApi::getId).collect(Collectors.toList());
|
||||
if (!apiIds.isEmpty()){
|
||||
uaMapper.insertApiToTemporary(apiIds);
|
||||
uaMapper.deleteApi(apiIds);
|
||||
}
|
||||
|
||||
//删除工单 + 工单补充内容
|
||||
List<PrivateTicketListDto> ticketList = ticketMapper.getPrivateTicketList(new PrivateTicketListVo(), username);
|
||||
List<Integer> ticketIds = ticketList.stream().map(PrivateTicketListDto::getId).collect(Collectors.toList());
|
||||
if (!ticketIds.isEmpty()) {
|
||||
ticketMapper.insertTicketToTemporary(ticketIds);
|
||||
ticketMapper.insertTicketSupplementToTemporary(ticketIds);
|
||||
|
||||
ticketMapper.deleteTicketSupplement(username);
|
||||
ticketMapper.deleteTicket(username);
|
||||
}
|
||||
return R.success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ public class NodeRpc{
|
||||
JSONObject jsonObject = JSON.parseObject(result);
|
||||
JSONObject jsonObject1 = JSON.parseObject(result1);
|
||||
BigDecimal netPower = jsonObject1.getBigDecimal("networkhashps");
|
||||
System.out.println("yyb-全网算力grs"+netPower);
|
||||
System.out.println("全网算力grs"+netPower);
|
||||
long height = jsonObject.getLongValue("height");
|
||||
blockInfo.setHeight(height);
|
||||
|
||||
@@ -589,7 +589,7 @@ public class NodeRpc{
|
||||
|
||||
BigDecimal difficulty = jsonObject.getBigDecimal("difficulty");
|
||||
BigDecimal netPower = jsonObject1.getBigDecimal("networkhashps");
|
||||
System.out.println("yyb-全网算力mona"+netPower);
|
||||
System.out.println("全网算力mona"+netPower);
|
||||
if(StringUtils.isNotNull(difficulty)){
|
||||
blockInfo.setDifficulty(difficulty.setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
//NodeConstant constant = (NodeConstant) EnumUtils.get(NodeConstant.class, coin);
|
||||
@@ -669,7 +669,7 @@ public class NodeRpc{
|
||||
|
||||
BigDecimal difficulty = jsonObject.getBigDecimal("difficulty");
|
||||
BigDecimal netPower = jsonObject1.getBigDecimal("networkhashps");
|
||||
System.out.println("yyb-全网算力rxd"+netPower);
|
||||
System.out.println("全网算力rxd"+netPower);
|
||||
if(StringUtils.isNotNull(difficulty)){
|
||||
blockInfo.setDifficulty(difficulty.setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
//NodeConstant constant = (NodeConstant) EnumUtils.get(NodeConstant.class, coin);
|
||||
@@ -1039,7 +1039,6 @@ public class NodeRpc{
|
||||
qBlockInfo.setPower(qNetwork);
|
||||
map.put("dgbq",qBlockInfo);
|
||||
}
|
||||
System.out.println("存储的数据"+map);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,3 +75,8 @@ myenv:
|
||||
path: /var/www/html/web_test
|
||||
img: /img
|
||||
filepath: /home/ubuntu/web
|
||||
|
||||
#mybatis:
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
|
||||
@@ -62,13 +62,13 @@
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
|
||||
|
||||
|
||||
</configuration>
|
||||
|
||||
@@ -375,11 +375,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="getHourPoolPowerList" resultType="com.m2pool.pool.dto.PowerLineDto">
|
||||
select
|
||||
p.date `date`,
|
||||
COALESCE(p.value,0) price,
|
||||
COALESCE(np.value,0) pv
|
||||
COALESCE(p.value,0) price
|
||||
from
|
||||
${table}_price p
|
||||
left join ${table}_net_power np on p.date = np.date
|
||||
where p.date >= DATE_SUB(NOW(), INTERVAL 35 DAY)
|
||||
</select>
|
||||
|
||||
<select id="getHourNetPowerList" resultType="com.m2pool.pool.dto.PowerLineDto">
|
||||
@@ -1048,6 +1047,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{i.user}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getCurrentCoinPrice" resultType="java.math.BigDecimal">
|
||||
select `value` from ${table}_price order by id DESC LIMIT 1;
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
||||
@@ -289,4 +289,50 @@
|
||||
#{vo.url},#{vo.fileName},#{vo.userName},#{vo.fileType},sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 将ticket表数据写入ticket_temporary临时表 -->
|
||||
<insert id="insertTicketToTemporary">
|
||||
INSERT INTO ticket_temporary (
|
||||
id, email, `desc`, create_time, status, update_time
|
||||
)
|
||||
SELECT
|
||||
id, email, `desc`, create_time, status, update_time
|
||||
FROM
|
||||
ticket
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 将ticket_supplement表数据写入ticket_supplement_temporary临时表 -->
|
||||
<insert id="insertTicketSupplementToTemporary">
|
||||
INSERT INTO ticket_supplement_temporary (
|
||||
id, ticket_id, content, files, video_file, image_file, audio_file, create_time
|
||||
)
|
||||
SELECT
|
||||
id, ticket_id, content, files, video_file, image_file, audio_file, create_time
|
||||
FROM
|
||||
ticket_supplement
|
||||
WHERE
|
||||
ticket_id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 删除ticket_supplement表数据 -->
|
||||
<delete id="deleteTicketSupplement">
|
||||
DELETE FROM ticket_supplement
|
||||
WHERE
|
||||
ticket_id IN (SELECT id FROM ticket WHERE email = #{email})
|
||||
</delete>
|
||||
|
||||
<!-- 删除ticket表数据 -->
|
||||
<delete id="deleteTicket">
|
||||
DELETE FROM ticket
|
||||
WHERE
|
||||
email = #{email}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
@@ -143,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
<select id="getAccountByUserAndMinerAccount" resultType="com.m2pool.pool.dto.UserAccountDto">
|
||||
select
|
||||
`user`,
|
||||
@@ -331,6 +332,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and status = 0
|
||||
</select>
|
||||
|
||||
<!-- 逻辑删除用户挖矿账户,将status改为11 -->
|
||||
<update id="deleteUserAccount">
|
||||
UPDATE user_miner_account
|
||||
SET status = 11
|
||||
WHERE `user` = #{username}
|
||||
</update>
|
||||
|
||||
<!-- 删除用户账户余额,先根据username查询user_miner_account的id,然后根据这些id匹配ma_id删除 -->
|
||||
<update id="deleteUserBalance">
|
||||
UPDATE user_account_balance
|
||||
SET status = 99
|
||||
WHERE ma_id IN (
|
||||
SELECT id FROM user_miner_account WHERE `user` = #{username}
|
||||
)
|
||||
</update>
|
||||
|
||||
<delete id="deleteReadOnlyPage">
|
||||
DELETE FROM user_page_info
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 将用户只读页面数据写入临时表 -->
|
||||
<insert id="insertReadOnlyPageToTemporary">
|
||||
INSERT INTO user_page_info_temporary (
|
||||
id, `user`, account, coin, url_key, config, remark, create_time, update_time, lang
|
||||
)
|
||||
SELECT
|
||||
id, `user`, account, coin, url_key, config, remark, create_time, update_time, lang
|
||||
FROM
|
||||
user_page_info
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 将用户API数据写入临时表 -->
|
||||
<insert id="insertApiToTemporary">
|
||||
INSERT INTO user_api_temporary (
|
||||
id, `user`, api_key, api_ip, perms
|
||||
)
|
||||
SELECT
|
||||
id, `user`, api_key, api_ip, perms
|
||||
FROM
|
||||
user_api
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 删除用户API -->
|
||||
<delete id="deleteApi">
|
||||
DELETE FROM user_api
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.m2pool.common.security.annotation.InnerAuth;
|
||||
import com.m2pool.common.security.annotation.RequiresLogin;
|
||||
import com.m2pool.common.security.service.TokenService;
|
||||
import com.m2pool.common.security.utils.SecurityUtils;
|
||||
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||
import com.m2pool.system.api.entity.SysRole;
|
||||
import com.m2pool.system.api.entity.SysUser;
|
||||
import com.m2pool.system.api.entity.SysUserLeveDate;
|
||||
@@ -200,8 +201,8 @@ public class SysProfileController extends BaseController
|
||||
@InnerAuth
|
||||
@ApiOperation(value = "谷歌安全验证码验证")
|
||||
@PostMapping("/checkGoogleCode")
|
||||
public R<Boolean> checkGoogleCode(@RequestBody Long code){
|
||||
return R.success(userService.checkGoogleCode(code));
|
||||
public R<Boolean> checkGoogleCode(@RequestBody CloseAccountVo closeAccountVo){
|
||||
return R.success(userService.checkGoogleCode(closeAccountVo.getGCode(),closeAccountVo.getUserEmail()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.m2pool.system.controller;
|
||||
|
||||
import com.alibaba.druid.support.json.JSONUtils;
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.common.core.constant.UserConstants;
|
||||
import com.m2pool.common.core.utils.DateUtils;
|
||||
import com.m2pool.common.core.utils.StringUtils;
|
||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||
import com.m2pool.common.core.web.controller.BaseController;
|
||||
import com.m2pool.common.log.annotation.Log;
|
||||
import com.m2pool.common.log.enums.BusinessType;
|
||||
import com.m2pool.common.security.annotation.InnerAuth;
|
||||
import com.m2pool.common.security.annotation.RequiresLogin;
|
||||
import com.m2pool.common.security.annotation.RequiresPermissions;
|
||||
import com.m2pool.common.security.utils.SecurityUtils;
|
||||
import com.m2pool.system.api.entity.SysRole;
|
||||
@@ -62,6 +63,7 @@ public class SysUserController extends BaseController {
|
||||
|
||||
SysUser user = userService.selectUserByEmail(account);
|
||||
|
||||
System.out.println("用户信息"+ user);
|
||||
if (StringUtils.isNull(user))
|
||||
{
|
||||
return R.fail("邮箱未被注册");
|
||||
@@ -237,4 +239,11 @@ public class SysUserController extends BaseController {
|
||||
}
|
||||
return R.success(list);
|
||||
}
|
||||
|
||||
@InnerAuth
|
||||
@PostMapping("/closeAccount")
|
||||
@ApiOperation(value = "用户注销")
|
||||
public AjaxResult closeAccount(@RequestBody SysUser sysUser){
|
||||
return toAjax(userService.closeAccount(sysUser));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,4 +135,12 @@ public interface SysUserMapper {
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> getCSList();
|
||||
|
||||
|
||||
/**
|
||||
* 关闭用户
|
||||
* @param closeAccountVo
|
||||
* @return
|
||||
*/
|
||||
boolean closeUser(SysUser sysUser);
|
||||
}
|
||||
|
||||
@@ -166,11 +166,18 @@ public interface SysUserService {
|
||||
* @return 结果
|
||||
* @param code
|
||||
*/
|
||||
public boolean checkGoogleCode(Long code);
|
||||
public boolean checkGoogleCode(long code,String username);
|
||||
|
||||
/**
|
||||
* 查询所有聊天客服
|
||||
* @return 结果
|
||||
*/
|
||||
public List<SysUser> getCSList();
|
||||
|
||||
|
||||
/**
|
||||
* 注销用户
|
||||
* @return 结果
|
||||
*/
|
||||
boolean closeAccount(SysUser sysUser);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.m2pool.system.service.impl;
|
||||
|
||||
import com.m2pool.common.core.Result.R;
|
||||
import com.m2pool.common.core.constant.UserConstants;
|
||||
import com.m2pool.common.core.exception.ServiceException;
|
||||
import com.m2pool.common.core.utils.GoogleAuthenticator;
|
||||
@@ -8,9 +9,9 @@ import com.m2pool.common.core.utils.StringUtils;
|
||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||
import com.m2pool.common.datascope.annotation.DataScope;
|
||||
import com.m2pool.common.security.utils.SecurityUtils;
|
||||
import com.m2pool.system.api.entity.SysRole;
|
||||
import com.m2pool.system.api.entity.SysUser;
|
||||
import com.m2pool.system.api.entity.SysUserLeveDate;
|
||||
import com.m2pool.system.api.RemotePoolService;
|
||||
import com.m2pool.system.api.RemoteUserService;
|
||||
import com.m2pool.system.api.entity.*;
|
||||
import com.m2pool.system.entity.GoogleInfo;
|
||||
import com.m2pool.system.entity.SysUserRole;
|
||||
import com.m2pool.system.mapper.SysRoleMapper;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -55,6 +57,9 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Autowired
|
||||
private SysUserLevelMapper userLevelMapper;
|
||||
|
||||
@Resource
|
||||
private RemotePoolService remotePoolService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
@@ -383,9 +388,9 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkGoogleCode(Long code) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
public boolean checkGoogleCode(long code,String username) {
|
||||
|
||||
System.out.println("用户名:"+username);
|
||||
//谷歌验证码校验
|
||||
GoogleInfo info = userMapper.getGoogleInfoByEmail(username);
|
||||
if(StringUtils.isNull(info)){
|
||||
@@ -405,7 +410,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
if(GoogleAuthenticator.checkCode(info.getSecret(), code, System.currentTimeMillis())){
|
||||
return true;
|
||||
}else {
|
||||
throw new ServiceException("验证码错误");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,4 +450,14 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean closeAccount(SysUser sysUser) {
|
||||
//删除用户相关信息
|
||||
R<Boolean> booleanR = remotePoolService.deleteUserDataAndPutTemporaryTable();
|
||||
if (R.FAIL == booleanR.getCode()){
|
||||
throw new ServiceException("服务器请求失败请稍后再试");
|
||||
}
|
||||
return userMapper.closeUser(sysUser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,12 +90,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName}
|
||||
where u.user_name = #{userName} AND u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.email = #{email}
|
||||
where u.email = #{email} and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultType="int">
|
||||
select count(1) from sys_user where user_name = #{userName} limit 1
|
||||
select count(1) from sys_user where user_name = #{userName} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} limit 1
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkEmailExist" parameterType="String" resultType="string">
|
||||
@@ -207,5 +207,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="resetPwdByEmail" parameterType="com.m2pool.system.api.entity.SysUser">
|
||||
update sys_user set password = #{password} where email = #{email}
|
||||
</update>
|
||||
<update id="closeUser">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
56
m2pool_update.sql
Normal file
56
m2pool_update.sql
Normal file
@@ -0,0 +1,56 @@
|
||||
USE `pool`
|
||||
|
||||
-- 挖矿用户表及对应的收款信息表 新增修改时间
|
||||
ALTER TABLE user_miner_account ADD COLUMN `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';
|
||||
ALTER TABLE user_account_balance ADD COLUMN `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';
|
||||
|
||||
|
||||
CREATE TABLE `ticket_temporary` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`email` varchar(320) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '联系邮箱',
|
||||
`desc` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '问题描述',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`status` int NOT NULL DEFAULT '0' COMMENT '工单状态',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新日期',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=COMPACT COMMENT='工单---删除临时存储表';
|
||||
|
||||
|
||||
CREATE TABLE `ticket_supplement_temporary` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`ticket_id` bigint NOT NULL,
|
||||
`content` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '',
|
||||
`files` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`video_file` varchar(360) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`image_file` varchar(360) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`audio_file` varchar(360) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=COMPACT COMMENT='工单补充内容---删除临时存储表';
|
||||
|
||||
|
||||
CREATE TABLE `user_page_info_temporary` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`user` varchar(200) NOT NULL,
|
||||
`account` varchar(30) NOT NULL,
|
||||
`coin` varchar(30) NOT NULL,
|
||||
`url_key` varchar(80) NOT NULL,
|
||||
`config` varchar(50) NOT NULL,
|
||||
`remark` varchar(200) DEFAULT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime DEFAULT NULL,
|
||||
`lang` varchar(2) DEFAULT 'zh',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `url_key` (`url_key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='用户只读页面---删除临时存储表';
|
||||
|
||||
|
||||
CREATE TABLE `user_api_temporary` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`user` varchar(280) NOT NULL COMMENT '网站用户名,即邮箱',
|
||||
`api_key` varchar(350) NOT NULL COMMENT 'api_key',
|
||||
`api_ip` varchar(150) NOT NULL COMMENT '绑定ip',
|
||||
`perms` varchar(50) NOT NULL COMMENT '权限',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `api_key` (`api_key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='用户API---删除临时存储表';
|
||||
Reference in New Issue
Block a user