当前位置:网站首页>Tiktok actual battle ~ take off the blogger
Tiktok actual battle ~ take off the blogger
2022-06-28 04:12:00 【gblfy】


List of articles
One 、 Demand analysis
1. Take off flow chart

2. Brief description of customs clearance process
- 1. The front-end carries users ID And short video publishers ID Request back-end access interface
- 2. Judge whether we are friends
- 2.1. Non friend relationship , Delete your own related table records
- 2.2. Friendship , Erase the friendship between the two sides , Set non friend status , Update the database
- 3. I focus on total -1(redis)
- 4. The number of bloggers' fans -1(redis)
- 5. Delete my relationship with the short video blogger (redis)
Two 、 Source code combat
2.1. Take off ~ front end
// Cancel the attention
cancelFollow(vlogerId) {
var me = this;
var userId = getApp().getUserInfoSession().id;
var serverUrl = app.globalData.serverUrl;
uni.request({
method: "POST",
header: {
headerUserId: userId,
headerUserToken: app.getUserSessionToken()
},
url: serverUrl + "/fans/cancel?myId=" + userId + "&vlogerId=" + vlogerId,
success(result) {
if (result.data.status == 200) {
me.reFreshList(vlogerId, false);
} else {
uni.showToast({
title: result.data.msg,
icon: "none",
duration: 3000
});
}
}
});
},
2.2. Take off ~ Back end
/**
* Take off
*
* @param myId My users ID
* @param vlogerId Video publisher ID
* @return
*/
@PostMapping("cancel")
public GraceJSONResult cancel(@RequestParam String myId,
@RequestParam String vlogerId) {
// Delete the execution of the business
fansService.doCancel(myId, vlogerId);
// Blogger fans -1, My attention -1
// My total number of concerns
redis.decrement(REDIS_MY_FOLLOWS_COUNTS + ":" + myId, 1);
// The total number of bloggers' fans
redis.decrement(REDIS_MY_FANS_COUNTS + ":" + vlogerId, 1);
// My relationship with bloggers , rely on redis, Do not store databases , avoid db Performance bottlenecks
redis.del(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + myId + ":" + vlogerId);
return GraceJSONResult.ok();
}
/** * Take off * * @param myId My users ID * @param vlogerId Video publisher ID * @return */
@Transactional
@Override
public void doCancel(String myId, String vlogerId) {
// Judge whether we are friends , If it is , You need to cancel the relationship between the two sides
Fans fan = queryFansRelationship(myId, vlogerId);
if (fan != null && fan.getIsFanFriendOfMine() == YesOrNo.YES.type) {
// Erase the friendship between the two sides , Delete your own relationship
Fans pendingFan = queryFansRelationship(vlogerId, myId);
pendingFan.setIsFanFriendOfMine(YesOrNo.NO.type);
fansMapper.updateByPrimaryKeySelective(pendingFan);
}
// Delete your own related table records
fansMapper.delete(fan);
}
3、 ... and 、5217 Actual combat of customs clearance
3.1. Data analysis before customs clearance
Tail number ~0009
Focus on :1
fans :2
Tail number ~5217
Focus on :3
fans :2



3.2. account number 5217 Take off
Tail number ~0009
Focus on :1
fans :1 -> from 2 Turned into 1
Tail number ~5217
Focus on :2 -> from 3 Turned into 2
fans :2
The piece of data I am concerned about has been deleted , Blogger and I are not friends anymore 
Four 、 account number 0009 Actual combat of customs clearance
4.1. account number 0009 Take off
Tail number ~0009
Focus on :0 from 1 Turned into 0
fans :1
Tail number ~5217
Focus on :2 -> from 3 Turned into 2
fans :1 -> from 2 Turned into 1

4.2. Data changes
0009 The information about the account has also been deleted 
边栏推荐
- 【小程序实战系列】电商平台源码及功能实现
- MSC 307(88) (2010 FTPC Code) Part 9床上用品试验
- Multi project design and development · introduction to class library project
- 使用tensorboard进行loss可视化
- 《性能之巅第2版》阅读笔记(二)--CPU监测
- 单一职责原则
- Sorting from one stack to another
- 品达通用权限系统(Day 5~Day 6)
- A preliminary study of blackbody radiation
- 02 MongoDB数据类型、重要概念以及shell常用指令
猜你喜欢

Pychart shares third-party modules among different projects

first. Net core MVC project

02 MongoDB数据类型、重要概念以及shell常用指令

机器学习入门笔记

English语法_形容词/副词3级-比较级_常用短语

领歌leangoo敏捷看板工具新增导出卡片文档和粘贴共享脑图节点功能

sqlserver 数据库之事物使用入门 案例

ambari SSLError: Failed to connect. Please check openssl library versions.

Learning about DC-DC step-down chip of sy8120i (12V reduced to 3.3V)

关于 SY8120I 的DC-DC的降压芯片的学习(12V降至3.3V)
随机推荐
C语言十进制与BCD码的相互转换
Arrangement of basic electrical knowledge (I)
[small program practice series] e-commerce platform source code and function implementation
Tiktok practice ~ pay attention to bloggers
English grammar_ Adjective / adverb Level 3 - Comparative
After launching the MES system, these changes have taken place in the enterprise
Market competitiveness of robot programming education
leetcode - 329. 矩阵中的最长递增路径
Pinda general permission system (day 5~day 6)
Building a server monitoring platform with telegraf influxdb grafana
01 MongoDB的概述、应用场景、下载方式、连接方式和发展历史等
歐洲家具EN 597-1 跟EN 597-2兩個阻燃標准一樣嗎?
01 overview, application scenarios, Download methods, connection methods and development history of mongodb
软件测试报告怎么编写?第三方性能报告范文模板来了
Learning notes of digital circuit (II)
第一章 Bash 入门
指针链表
MSc 307 (88) (2010 FTPC code) Part 9 bedding test
2021 year end summary and 2022 outlook
ELK 搭建日志分析系统 + Zipkin服务链路追踪整合