当前位置:网站首页>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 
边栏推荐
- 【小程序实战系列】电商平台源码及功能实现
- Meichuang data security management platform has obtained the evaluation certificate of "data security product capability verification plan" of the Institute
- Detailed explanation of iptables firewall rules and firewalld firewall rules
- Introversion, lying flat and midlife crisis
- 美创入选“2022 CCIA中国网络安全竞争力50强”榜单
- Genicam gentl standard ver1.5 (2)
- How the uni app automatically switches the requested address according to the environment
- Lingge leangoo agile Kanban tool adds the functions of exporting card documents and pasting shared brain map nodes
- 【Linux】【Mysql】ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘
- 指针链表
猜你喜欢

Web APIs DOM event foundation dark horse programmer

Reading notes of top performance version 2 (II) -- CPU monitoring

歐洲家具EN 597-1 跟EN 597-2兩個阻燃標准一樣嗎?

Chapter 14 AC-DC power supply front stage circuit note I

Building a server monitoring platform with telegraf influxdb grafana

第一个.net core MVC项目

《性能之巅第2版》阅读笔记(二)--性能观察工具

La norme européenne en 597 - 1 pour les meubles est - elle la même que les deux normes en 597 - 2 pour les ignifuges?

Reading notes of top performance version 2 (II) -- Performance observation tool

Detailed explanation of KVM common commands
随机推荐
05 mongodb summary of various column operations
MSC 307(88) (2010 FTPC Code) Part 9床上用品试验
Uncertainty principle
Analyzing the comprehensive application ability of educational robot
Notes to friendship chain
美创入选“2022 CCIA中国网络安全竞争力50强”榜单
第一章 Bash 入门
ELK 搭建日志分析系统 + Zipkin服务链路追踪整合
A summary of my recent situation in June 2022
僅用遞歸函數和棧操作逆序一個棧
Lingge leangoo agile Kanban tool adds the functions of exporting card documents and pasting shared brain map nodes
Principle and Simulation of switching power supply buck circuit
第一个.net core MVC项目
Open the field of maker education and creation
Une seule pile dans l'ordre inverse avec des fonctions récursives et des opérations de pile
视频爆炸时代,谁在支撑视频生态网高速运行?
MSC 307(88) (2010 FTPC Code) Part 5低播焰测试
由两个栈组成的队列
Chapter 1 Introduction to bash
02 MongoDB数据类型、重要概念以及shell常用指令