update m2pool 注销账号删除api,只读页,挖矿账号等信息实现
This commit is contained in:
@@ -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();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ import com.m2pool.system.api.model.LoginUser;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -560,7 +561,6 @@ public class SysLoginService {
|
|||||||
remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);
|
remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public R<?> closeAccount(CloseAccountVo closeAccountVo){
|
public R<?> closeAccount(CloseAccountVo closeAccountVo){
|
||||||
String email = closeAccountVo.getUserEmail();
|
String email = closeAccountVo.getUserEmail();
|
||||||
String emailCode = closeAccountVo.getECode();
|
String emailCode = closeAccountVo.getECode();
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.m2pool.pool.controller;
|
package com.m2pool.pool.controller;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.m2pool.common.core.Result.R;
|
||||||
import com.m2pool.common.core.utils.StringUtils;
|
import com.m2pool.common.core.utils.StringUtils;
|
||||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||||
import com.m2pool.common.core.web.controller.BaseController;
|
import com.m2pool.common.core.web.controller.BaseController;
|
||||||
import com.m2pool.common.core.web.page.TableDataInfo;
|
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.common.security.annotation.RequiresLogin;
|
||||||
import com.m2pool.pool.dto.UserApiDto;
|
import com.m2pool.pool.dto.UserApiDto;
|
||||||
import com.m2pool.pool.service.GoogleAuthService;
|
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.service.UserMinserService;
|
||||||
import com.m2pool.pool.vo.*;
|
import com.m2pool.pool.vo.*;
|
||||||
import com.m2pool.system.api.RemoteUserService;
|
import com.m2pool.system.api.RemoteUserService;
|
||||||
|
import com.m2pool.system.api.entity.CloseAccountVo;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -243,4 +246,12 @@ public class UserController extends BaseController {
|
|||||||
return umService.deleteApi(vo);
|
return umService.deleteApi(vo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@InnerAuth
|
||||||
|
@PostMapping("/deleteUserDataAndPutTemporaryTable")
|
||||||
|
@ApiOperation(value = "用户注销--删除用户(邮箱)对应相关信息并存入临时表")
|
||||||
|
public R<?> deleteUserDataAndPutTemporaryTable(){
|
||||||
|
return umService.deleteUserDataAndPutTemporaryTable();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.m2pool.pool.dto.*;
|
|||||||
import com.m2pool.pool.entity.M2File;
|
import com.m2pool.pool.entity.M2File;
|
||||||
import com.m2pool.pool.entity.Ticket;
|
import com.m2pool.pool.entity.Ticket;
|
||||||
import com.m2pool.pool.vo.*;
|
import com.m2pool.pool.vo.*;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -154,5 +155,32 @@ public interface TicketMapper {
|
|||||||
*/
|
*/
|
||||||
public boolean insertRespon(@Param("vo") ResponTicketVo vo, @Param("name") String name);
|
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);
|
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;
|
package com.m2pool.pool.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.m2pool.common.core.Result.R;
|
||||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||||
import com.m2pool.pool.dto.UserApiDto;
|
import com.m2pool.pool.dto.UserApiDto;
|
||||||
import com.m2pool.pool.vo.*;
|
import com.m2pool.pool.vo.*;
|
||||||
@@ -57,4 +58,10 @@ public interface UserMinserService {
|
|||||||
//public AjaxResult getMinerPower(MinerVo com.m2pool.chat.vo);
|
//public AjaxResult getMinerPower(MinerVo com.m2pool.chat.vo);
|
||||||
//
|
//
|
||||||
//public AjaxResult getMinerPowerDistribution(MinerVo com.m2pool.chat.vo);
|
//public AjaxResult getMinerPowerDistribution(MinerVo com.m2pool.chat.vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户注销--删除用户(邮箱)对应相关信息并存入临时表
|
||||||
|
* return
|
||||||
|
*/
|
||||||
|
R<?> deleteUserDataAndPutTemporaryTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.m2pool.pool.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.m2pool.common.core.Result.R;
|
||||||
import com.m2pool.common.core.constant.CacheConstants;
|
import com.m2pool.common.core.constant.CacheConstants;
|
||||||
import com.m2pool.common.core.text.Convert;
|
import com.m2pool.common.core.text.Convert;
|
||||||
import com.m2pool.common.core.utils.ServletUtils;
|
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.PoolAmount;
|
||||||
import com.m2pool.pool.enums.Pools;
|
import com.m2pool.pool.enums.Pools;
|
||||||
import com.m2pool.pool.mapper.GoogleAuthMapper;
|
import com.m2pool.pool.mapper.GoogleAuthMapper;
|
||||||
|
import com.m2pool.pool.mapper.TicketMapper;
|
||||||
import com.m2pool.pool.mapper.UserAccountMapper;
|
import com.m2pool.pool.mapper.UserAccountMapper;
|
||||||
import com.m2pool.pool.service.UserMinserService;
|
import com.m2pool.pool.service.UserMinserService;
|
||||||
import com.m2pool.pool.utils.EnumUtils;
|
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.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import sun.net.util.IPAddressUtil;
|
import sun.net.util.IPAddressUtil;
|
||||||
|
|
||||||
@@ -56,7 +59,8 @@ public class UserMinerServiceImpl implements UserMinserService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoogleAuthMapper googleAuthMapper;
|
private GoogleAuthMapper googleAuthMapper;
|
||||||
|
@Autowired
|
||||||
|
private TicketMapper ticketMapper;
|
||||||
|
|
||||||
@Value("${myenv.domain}")
|
@Value("${myenv.domain}")
|
||||||
private String 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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,4 +289,50 @@
|
|||||||
#{vo.url},#{vo.fileName},#{vo.userName},#{vo.fileType},sysdate()
|
#{vo.url},#{vo.fileName},#{vo.userName},#{vo.fileType},sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</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>
|
</mapper>
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getAccountByUserAndMinerAccount" resultType="com.m2pool.pool.dto.UserAccountDto">
|
<select id="getAccountByUserAndMinerAccount" resultType="com.m2pool.pool.dto.UserAccountDto">
|
||||||
select
|
select
|
||||||
`user`,
|
`user`,
|
||||||
@@ -331,6 +332,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and status = 0
|
and status = 0
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ public class SysUserController extends BaseController {
|
|||||||
return R.success(list);
|
return R.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@InnerAuth
|
||||||
@PostMapping("/closeAccount")
|
@PostMapping("/closeAccount")
|
||||||
@ApiOperation(value = "用户注销")
|
@ApiOperation(value = "用户注销")
|
||||||
public AjaxResult closeAccount(@RequestBody SysUser sysUser){
|
public AjaxResult closeAccount(@RequestBody SysUser sysUser){
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.m2pool.system.service.impl;
|
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.constant.UserConstants;
|
||||||
import com.m2pool.common.core.exception.ServiceException;
|
import com.m2pool.common.core.exception.ServiceException;
|
||||||
import com.m2pool.common.core.utils.GoogleAuthenticator;
|
import com.m2pool.common.core.utils.GoogleAuthenticator;
|
||||||
@@ -8,6 +9,8 @@ import com.m2pool.common.core.utils.StringUtils;
|
|||||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||||
import com.m2pool.common.datascope.annotation.DataScope;
|
import com.m2pool.common.datascope.annotation.DataScope;
|
||||||
import com.m2pool.common.security.utils.SecurityUtils;
|
import com.m2pool.common.security.utils.SecurityUtils;
|
||||||
|
import com.m2pool.system.api.RemotePoolService;
|
||||||
|
import com.m2pool.system.api.RemoteUserService;
|
||||||
import com.m2pool.system.api.entity.*;
|
import com.m2pool.system.api.entity.*;
|
||||||
import com.m2pool.system.entity.GoogleInfo;
|
import com.m2pool.system.entity.GoogleInfo;
|
||||||
import com.m2pool.system.entity.SysUserRole;
|
import com.m2pool.system.entity.SysUserRole;
|
||||||
@@ -23,6 +26,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -53,6 +57,9 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysUserLevelMapper userLevelMapper;
|
private SysUserLevelMapper userLevelMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RemotePoolService remotePoolService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
@@ -442,8 +449,15 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public boolean closeAccount(SysUser sysUser) {
|
public boolean closeAccount(SysUser sysUser) {
|
||||||
|
//删除用户相关信息
|
||||||
|
R<Boolean> booleanR = remotePoolService.deleteUserDataAndPutTemporaryTable();
|
||||||
|
if (R.FAIL == booleanR.getCode()){
|
||||||
|
throw new ServiceException("服务器请求失败请稍后再试");
|
||||||
|
}
|
||||||
return userMapper.closeUser(sysUser);
|
return userMapper.closeUser(sysUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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