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

你可能感兴趣的文章
Python--Redis实战:第四章:数据安全与性能保障:第4节:复制
查看>>
python--基本代码规范
查看>>
Python--抽象类接口类
查看>>
PYTHON--欧拉习题二
查看>>
python--高级应用总结
查看>>
python-520表白代码,我看谁说程序员不懂浪漫,送你几套表白代码,一步到位
查看>>
Python-Asyncio TypeError:无法在‘;等待‘;表达式中使用对象DICT
查看>>
Python-AttributeError:‘;dict&39;对象没有属性‘;序列‘;
查看>>
Python-ldap:是否可以在不显式写入密码的情况下进行绑定?
查看>>
python出现 unknown encoding: idna 的处理方法
查看>>
Python出现 RuntimeError: dictionary changed size during iteration 的解决方法
查看>>
Python-numpy(2)数组的操作
查看>>
Python-Numpy的tile函数用法
查看>>
python-open函数
查看>>
Python-Pandas-将特定函数应用于给定级别-多索引数据框架
查看>>
python-queue队列通信
查看>>
python-ros No module named PyKDL
查看>>
python-social-auth 是否需要会话
查看>>
Python再获年度编程语言,微软或成最大赢家
查看>>
python-week5
查看>>