博客
关于我
抖音后端自动批量关注点赞(供学习参考使用)含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/

你可能感兴趣的文章
none 和 host 网络的适用场景 - 每天5分钟玩转 Docker 容器技术(31)
查看>>
None还可以是函数定义可选参数的一个默认值,设置成默认值时实参在调用该函数时可以不输入与None绑定的元素...
查看>>
NoNodeAvailableException None of the configured nodes are available异常
查看>>
Vue.js 学习总结(16)—— 为什么 :deep、/deep/、>>> 样式能穿透到子组件
查看>>
nopcommerce商城系统--文档整理
查看>>
NOPI读取Excel
查看>>
NoSQL&MongoDB
查看>>
NoSQL介绍
查看>>
NoSQL数据库概述
查看>>
Notadd —— 基于 nest.js 的微服务开发框架
查看>>
NOTE:rfc5766-turn-server
查看>>
Notepad ++ 安装与配置教程(非常详细)从零基础入门到精通,看完这一篇就够了
查看>>
Notepad++在线和离线安装JSON格式化插件
查看>>
notepad++最详情汇总
查看>>
notepad++正则表达式替换字符串详解
查看>>
notepad如何自动对齐_notepad++怎么自动排版
查看>>
Notes on Paul Irish's "Things I learned from the jQuery source" casts
查看>>
Notification 使用详解(很全
查看>>
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
查看>>
NotImplementedError: Could not run torchvision::nms
查看>>