当前位置:网站首页>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 
边栏推荐
- Backtracking maze problem
- Zipkin service link tracking
- GCD maximum common divisor
- 《性能之巅第2版》阅读笔记(二)--性能观察工具
- ambari SSLError: Failed to connect. Please check openssl library versions.
- Web APIs DOM event foundation dark horse programmer
- 抖音实战~取关博主
- In the era of video explosion, who is supporting the high-speed operation of video ecological network?
- Conversion between decimal and BCD codes in C language
- Pointer linked list
猜你喜欢

English grammar_ Adjective / adverb Level 3 - Comparative_ Useful Expressions

Introduction to multi project development, basic design class library project use

Arrangement of basic electrical knowledge (I)

Are the two flame retardant standards of European furniture en 597-1 and en 597-2 the same?

Market competitiveness of robot programming education

欧洲家具EN 597-1 跟EN 597-2两个阻燃标准一样吗?

Meichuang was selected into the list of "2022 CCIA top 50 Chinese network security competitiveness"

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

多项目设计开发·类库项目引入入门

Principle and Simulation of switching power supply buck circuit
随机推荐
@Transactional失效的几种场景
Two methods of shell script parameter passing based on arm5718
窗帘做EN 1101易燃性测试过程是怎么样的?
Detailed explanation of KVM common commands
Reading notes of top performance version 2 (II) -- Performance observation tool
Problems with cat and dog queues
What is the process of en 1101 flammability test for curtains?
【小程序实战系列】电商平台源码及功能实现
Introduction to SQLSERVER database
设计一个有getMin功能的栈
gcd最大公约数
领歌leangoo敏捷看板工具新增导出卡片文档和粘贴共享脑图节点功能
2022年6月对自己近况的一次总结
由两个栈组成的队列
Genicam gentl standard ver1.5 (2)
欧洲家具EN 597-1 跟EN 597-2两个阻燃标准一样吗?
Secouer le son et se battre ~ prêter attention au blogueur
Zipkin 服务链路追踪
05 MongoDB对列的各种操作总结
Several important physical concepts