当前位置:网站首页>Tiktok actual battle ~ list of bloggers I follow, follow and check
Tiktok actual battle ~ list of bloggers I follow, follow and check
2022-06-28 16:01:00 【gblfy】


List of articles
One 、 Focus on modules
1. Focus on the flow chart
Not yet , Coming soon !
2. Focus on the process brief
Not yet , Coming soon !
Two 、 The front end pays attention to the relevant
2.1. Check the list of bloggers I follow
// Check the list of bloggers I follow
queryMyFollowList(page) {
var me = this;
// if (page == 0) {
// me.followsList = [];
// }
page = page + 1;
var userId = getApp().getUserInfoSession().id;
var serverUrl = app.globalData.serverUrl;
uni.request({
method: "GET",
header: {
headerUserId: userId,
headerUserToken: app.getUserSessionToken()
},
url: serverUrl + "/fans/queryMyFollows?myId=" + userId + "&page=" + page + "&pageSize=10",
success(result) {
if (result.data.status == 200) {
var followsList = result.data.data.rows;
var totalPage = result.data.data.total;
me.followsList = me.followsList.concat(followsList);
me.page = page;
me.totalPage = totalPage;
}
}
});
},
2.2. Cancel the attention
// 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. Pay attention to me
// Pay attention to me
followMe(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/follow?myId=" + userId + "&vlogerId=" + vlogerId,
success(result) {
if (result.data.status == 200) {
me.reFreshList(vlogerId, true);
} else {
uni.showToast({
title: result.data.msg,
icon: "none",
duration: 3000
});
}
}
});
},
2.4. Slide up the paged fan list
<template>
<view class="page">
<view class="line"></view>
<scroll-view scroll-y="true" @scrolltolower="pagingFollowsList()">
<view
class="user-wrapper"
v-for="(f, index) in followsList"
:key="index">
<view class="user-info">
<image class="face" :src="f.face" style="align-self: center;"></image>
<text class="user-name" style="align-self: center;">{
{
f.nickname}}</text>
</view>
<view v-if="!f.followed" class="operator-wrapper" style="width: 140rpx; height: 60rpx;display: flex;flex-direction: row;justify-content: center;background-color: #ef274d;border-radius: 10px;align-self: center;">
<text class="operator-words" style="align-self: center;color: #FFFFFF;" @click="followMe(f.vlogerId)"> Focus on </text>
</view>
<view v-if="f.followed" class="operator-wrapper" style="width: 140rpx; height: 60rpx;display: flex;flex-direction: row;justify-content: center;background-color: #ef274d;border-radius: 10px;align-self: center;border-width: 1px;border-color: #ef274d;background-color: #181b27;">
<text class="operator-words" style="align-self: center;color: #ef274d;" @click="cancelFollow(f.vlogerId)"> Take off </text>
</view>
</view>
</scroll-view>
</view>
</template>
// Slide up the paged fan list
pagingFollowsList() {
// this.followsList = this.followsList.concat(this.followsList);
if (this.page >= this.totalPage) {
return;
}
this.queryMyFollowList(this.page);
}
2.5. Status refresh
// Focus on / Closed list Reset status refresh settings
reFreshList(vlogerId, status) {
var me = this;
var followsList = me.followsList;
for (var i = 0 ; i < followsList.length ; i ++) {
var vloger = followsList[i];
if (vloger.vlogerId == vlogerId) {
vloger.followed = status;
followsList.splice(i,1, vloger);
}
}
me.followsList = followsList;
},
3、 ... and 、 The back-end pays attention to relevant
3.1. Check the list of bloggers I follow
/**
* Check the list of bloggers I follow
*
* @param myId My users ID
* @param page Current page
* @param pageSize How many are displayed on each page
* @return
*/
@GetMapping("queryMyFollows")
public GraceJSONResult queryMyFollows(@RequestParam String myId,
@RequestParam Integer page,
@RequestParam Integer pageSize) {
return GraceJSONResult.ok(
fansService.queryMyFollows(
myId,
page,
pageSize));
}
@Override
public PagedGridResult queryMyFollows(String myId,
Integer page,
Integer pageSize) {
Map<String, Object> map = new HashMap<>();
map.put("myId", myId);
PageHelper.startPage(page, pageSize);
List<VlogerVO> list = fansMapperCustom.queryMyFollows(map);
return setterPagedGrid(list, page);
}
<select id="queryMyFollows" resultType="com.gblfy.vo.VlogerVO" parameterType="map">
SELECT
u.id as vlogerId,
u.nickname as nickname,
u.face as face
FROM
fans f
LEFT JOIN
users u
ON
f.vloger_id = u.id
WHERE
f.fan_id = #{paramMap.myId}
ORDER BY
u.nickname
ASC
</select>
3.2. Take off
/**
* 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();
}
3.3. Focus on
/**
* Focus on
*
* @param myId My users ID
* @param vlogerId Video publisher ID
* @return
*/
@PostMapping("follow")
public GraceJSONResult follow(@RequestParam String myId,
@RequestParam String vlogerId) {
// Whether two id Can't be empty
if (StringUtils.isBlank(myId) || StringUtils.isBlank(vlogerId)) {
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_ERROR);
}
// Judge the current user , You can't pay attention to yourself
if (myId.equalsIgnoreCase(vlogerId)) {
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_RESPONSE_NO_INFO);
}
// Whether two id Whether the corresponding user exists
Users vloger = userService.getUser(vlogerId);
Users myInfo = userService.getUser(myId);
// fixme: Two users id Judgment after database query , It's good to separate ? It's better to combine and judge ?
if (myInfo == null || vloger == null) {
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_RESPONSE_NO_INFO);
}
// Saving fans relates to the database
fansService.doFollow(myId, vlogerId);
// Blogger fans +1, My attention +1
// My total number of concerns
redis.increment(REDIS_MY_FOLLOWS_COUNTS + ":" + myId, 1);
// The total number of bloggers' fans
redis.increment(REDIS_MY_FANS_COUNTS + ":" + vlogerId, 1);
// My relationship with bloggers , rely on redis, Do not store databases , avoid db Performance bottlenecks
redis.set(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + myId + ":" + vlogerId, "1");
return GraceJSONResult.ok();
}
边栏推荐
- 隆重推出 Qodana:您最爱的 CI 的代码质量平台
- 一个bug肝一周...忍不住提了issue
- wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe-Module
- Validate palindrome string
- VC2010 编绎Qt5.6.3 提示 CVTRES : fatal error CVT1107:
- 请问下大家有遇到过这种设置的主健和数据库一致的错误吗?
- 字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
- 全球陆续拥抱Web3.0,多国已明确开始抢占先机
- No win32/com in vs2013 help document
- Soliciting articles and contributions - building a blog environment with a lightweight application server
猜你喜欢

S2b2c system website solution for kitchen and bathroom electrical appliance industry: create s2b2c platform Omni channel commercial system

What useful supplier management systems are available

Flutter简单实现多语言国际化

Practice of curve replacing CEPH in Netease cloud music

Talking about open source - Linus and Jim talk about open source in China
![The k-th element in the array [heap row + actual time complexity of heap building]](/img/69/bcafdcb09ffbf87246a03bcb9367aa.png)
The k-th element in the array [heap row + actual time complexity of heap building]

征文投稿丨使用轻量应用服务器搭建博客环境
![[leetcode] 13. Roman numeral to integer](/img/3c/7c57d0c407f5302115f69f44b473c5.png)
[leetcode] 13. Roman numeral to integer

Innovation and upgrading of supply chain system driven management mode in petrochemical industry and strengthening internal management of enterprises

3. caller service call - dapr
随机推荐
不要使用短路逻辑编写 stl sorter 多条件比较
S2b2c system website solution for kitchen and bathroom electrical appliance industry: create s2b2c platform Omni channel commercial system
一个bug肝一周...忍不住提了issue
Visual Studio 2019软件安装包和安装教程
The past and present life of distributed cap theorem
wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe-Module
Focus on the 35 year old Kan: fear is because you don't have the ability to match your age
R language ggplot2 visualization: use the patchwork package (directly use the plus sign +) to horizontally combine a ggplot2 visualization result and a piece of text content to form a final result gra
Grand launch of qodana: your favorite CI code quality platform
Among US private server setup
No win32/com in vs2013 help document
Visual studio 2019 software installation package and installation tutorial
Solution to JSON parsing problem using curl for Tron API signature broadcast and json Problem record of the loads method
What! 一条命令搞定监控?
NFT质押LP流动性挖矿系统开发详情
PostgreSQL 存储结构浅析
关注35岁的坎:畏惧是因为你没有匹配这个年纪该有的能力
Deep learning convolutional neural network of machine learning to realize handwritten font recognition based on CNN network
among us私服搭建
3. caller service call - dapr