博客
关于我
抖音后端自动批量关注点赞(供学习参考使用)含java源码及数据库文件
阅读量:274 次
发布时间:2019-02-26

本文共 4226 字,大约阅读时间需要 14 分钟。

后端开发项目文档

登录接口

提供基于用户名密码的登录功能,支持状态管理和权限控制。

@PostMapping("/login")@ResponseBodypublic R login(String username, String password) {    String encodedPassword = CryptoUtil.encode64("100", password);    try {        SecurityUtils.getSubject().login(new UsernamePasswordToken(username, encodedPassword));        SecurityUtils.getSubject().getSession().setTimeout(-1000L);    } catch (AuthenticationException e) {        logger.info("登录失败");        return R.error();    }    return R.ok();}

##公告列表功能支持分页查询公告信息,根据创建时间降序排列。

@GetMapping("/getList")@ResponseBodypublic LayuiTable getList(int page, int limit) {    Page DYNoticePage = new Page(page, limit);    QueryWrapper queryWrapper = new QueryWrapper();    queryWrapper.orderByDesc("gmt_create");    IPage DYNoticeIPage = DYNoticeMapper.selectPage(DYNoticePage, queryWrapper);    return new LayuiTable(0, "", DYNoticeIPage.getTotal(), DYNoticeIPage.getRecords());}

邀请码管理

支持邀请码的增删查改,根据邀请码ID检查存在性。

@PostMapping("/addData")public R addData(String codeId, String codeSign) {    QueryWrapper queryWrapper = new QueryWrapper();    queryWrapper.eq("code_id", codeId);    int count = InvitationCodeMapper.count(queryWrapper);    if (count > 0) {        return R.error();    }    InvitationCode invitationCode = new InvitationCode();    invitationCode.setCodeId(codeId)        .setCodeSign(codeSign)        .setCodeStatus(false)        .setCreateTime(new Date());    boolean saveResult = InvitationCodeMapper.save(invitationCode);    return saveResult ? R.ok() : R.error();}

手机号管理

支持手机号的增删查改,包括手机号状态(锁定/解锁)和文件导入功能。

@PostMapping("/uploadData")@Transactionalpublic R uploadData(String filePath) throws IOException {    BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(filePath)), "UTF-8"));    List
phoneMangerList = new ArrayList<>(); while ((String line = reader.readLine()) != null) { String phone = line.trim(); if (phone.length() != 11) { return R.error().message("手机号格式错误"); } QueryWrapper queryWrapper = new QueryWrapper(); queryWrapper.eq("phone", phone); int count = PhoneMangerMapper.count(queryWrapper); if (count > 0) { return R.error().message("手机号已存在"); } PhoneManger phoneManger = new PhoneManger() .setPhone(phone) .setGmtCreate(new Date()); phoneMangerList.add(phoneManger); } PhoneMangerMapper.saveBatch(phoneMangerList); return R.ok();}

任务管理

支持任务的创建、修改、删除以及关注任务的确认。

@PostMapping("/confirmTask")@Transactionalpublic R confirmTask(String taskData) throws Exception {    UserManger userManger = (UserManger) SecurityUtils.getSubject().getPrincipal();    if (userManger == null) {        return R.error().message("请重新登录");    }    List
orderTaskList = JSONObject.parseArray(taskData, OrderTask.class); for (OrderTask orderTask : orderTaskList) { if (orderTask.getStatus() == 0 || orderTask.getStatus() == 1) { return R.error().message("任务已执行或正在执行中"); } String[] numSplit = orderTask.getNumSplit(); Integer[] numArray = Convert.toIntArray(numSplit); List
uniqueUrls = Arrays.stream(numArray) .mapToObj(num -> orderTask.getVisitUrl()) .filter(url -> num > 0) .distinct() .collect(Collectors.toList()); List
taskListList = new ArrayList<>(); for (String url : uniqueUrls) { TaskList taskList = new TaskList(); taskList.setTaskId(orderTask.getTaskId()) .setTaskName(orderTask.getTaskName()) .setNeedNum(numArray[numSplit.indexOf(url)]) .setTaskType("关注任务") .setTaskUrl(url) .setTaskStatue(1); taskListList.add(taskList); } TaskListMapper.save(taskListList); OrderTask orderTaskUpdate = new OrderTask(); orderTaskUpdate.setConfirmUser(userManger.getUserName()) .setTaskId(orderTask.getTaskId()) .setConfirmDate(new Date()) .setStatus(0); OrderTaskMapper.updateById(orderTaskUpdate); } return R.ok();}

其他功能

包括文件上传、数据删除、锁定解锁操作以及批量导入手机号等功能。

以上功能模块支持分页查询、数据增删改查等操作,确保系统高效稳定运行。

转载地址:http://ylsz.baihongyu.com/

你可能感兴趣的文章
npm—小记
查看>>
NPM使用前设置和升级
查看>>
npm入门,这篇就够了
查看>>
npm切换到淘宝源
查看>>
npm前端包管理工具简介---npm工作笔记001
查看>>
npm升级以及使用淘宝npm镜像
查看>>
npm发布自己的组件UI包(详细步骤,图文并茂)
查看>>
npm和yarn清理缓存命令
查看>>
npm和yarn的使用对比
查看>>
npm学习(十一)之package-lock.json
查看>>
npm安装crypto-js 如何安装crypto-js, python爬虫安装加解密插件 找不到模块crypto-js python报错解决丢失crypto-js模块
查看>>
npm报错Cannot find module ‘webpack‘ Require stack
查看>>
npm报错Failed at the node-sass@4.14.1 postinstall script
查看>>
npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
查看>>
npm的安装和更新---npm工作笔记002
查看>>
npm的常用配置项---npm工作笔记004
查看>>
npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
查看>>
npm编译报错You may need an additional loader to handle the result of these loaders
查看>>
npm设置淘宝镜像、升级等
查看>>
npm配置安装最新淘宝镜像,旧镜像会errror
查看>>