当前位置:网站首页>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 
边栏推荐
- 利用ELK 搭建日志分析系统(一)—— 组件介绍
- Iso8191 test is mentioned in as 3744.1. Are the two tests the same?
- 多项目设计开发·类库项目引入入门
- Another option for ERP upgrade, MES system
- How to write a software test report? Here comes the third party performance report template
- 抖音实战~关注博主
- 月赛补题
- 【Linux】【Mysql】ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘
- ELK 搭建日志分析系统 + Zipkin服务链路追踪整合
- 黑體輻射初探
猜你喜欢

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

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

Principle and Simulation of switching power supply buck circuit

Building a server monitoring platform with telegraf influxdb grafana

光伏板怎么申请ASTM E108阻燃测试?

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

美创入选“2022 CCIA中国网络安全竞争力50强”榜单

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

Several important physical concepts

Lingge leangoo agile Kanban tool adds the functions of exporting card documents and pasting shared brain map nodes
随机推荐
Using elk to build a log analysis system (I) -- component introduction
04 MongoDB各种查询操作 以及聚合操作总结
PostgreSQL implements batch update, deletion and insertion
Staggered and permutation combination formula
Une seule pile dans l'ordre inverse avec des fonctions récursives et des opérations de pile
Conversion between decimal and BCD codes in C language
What is the level 3 password complexity of ISO? How often is it replaced?
[MySQL] multi table connection query
Single responsibility principle
《性能之巅第2版》阅读笔记(二)--性能观察工具
How to learn a programming language systematically| Dark horse programmer
Meichuang data security management platform has obtained the evaluation certificate of "data security product capability verification plan" of the Institute
A summary of my recent situation in June 2022
Particle theory of light (photoelectric effect / Compton effect)
Uncover the mystery of SSL and learn how to protect data with SSL
11_ Deliberate practice and elaboration
Understanding and learning of parental delegation mechanism
11_刻意练习精讲
Learning notes of digital circuit (II)
2021年终总结及2022年展望