当前位置:网站首页>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();
}
边栏推荐
- Gbase Nantah General Motors appears at the 6th World Intelligence Conference
- 【高并发基础】MySQL索引优化
- Vc2010 compilation qt5.6.3 prompt cvtres: fatal error cvt1107:
- R language ggplot2 visualization: the patchwork package horizontally combines a ggplot2 visualization result and a plot function visualization result to form a final result graph, aligns the two visua
- 麻烦问一下,我数据库中写入占99%查询很少,用按量付费模式还是预留模式比较好?
- Visual Studio 2010 compilation qt5.6.3
- Etcd可视化工具:Kstone简介(一)
- The world has embraced Web3.0 one after another, and many countries have clearly begun to seize the initiative
- How can the digital intelligent supply chain management platform of the smart Park optimize process management and drive the development of the park to increase speed and quality?
- 字节跳动数据平台技术揭秘:基于ClickHouse的复杂查询实现与优化
猜你喜欢
In depth learning foundation summary
【高并发基础】MySQL 不同事务隔离级别下的并发隐患及解决方案
MIPS assembly language learning -02- logic judgment - foreground input
VS2013 帮助文档中没有 win32/com
Qt5.5.1 configuring msvc2010 compiler and WinDbg debugger
Lecturer solicitation order | Apache dolphin scheduler meetup sharing guests, looking forward to your topic and voice!
Openharmony - detailed source code of Kernel Object Events
SAP mts/ato/mto/eto topic 9: front and back desk operation in m+m mode, strategy 50, preparation of raw materials and semi-finished products in advance
A new 25K byte from the Department showed me what the ceiling is
【Spock】处理 Non-ASCII characters in an identifier
随机推荐
机器学习之深度学习卷积神经网络,实现基于CNN网络的手写字体识别
扩充C盘(将D盘的内存分给C盘)
Visual Studio 2019软件安装包和安装教程
不要使用短路逻辑编写 stl sorter 多条件比较
NFT质押LP流动性挖矿系统开发详情
Flutter简单实现多语言国际化
字节跳动数据平台技术揭秘:基于ClickHouse的复杂查询实现与优化
Navicat 15 for MySQL
Talking about open source - Linus and Jim talk about open source in China
Application of mongodb in Tencent retail premium code
Soliciting articles and contributions - building a blog environment with a lightweight application server
Web worker poll request
使用openpyxl操作Excel
Focus on the 35 year old Kan: fear is because you don't have the ability to match your age
有哪些好用的供应商管理系统
SaaS application management platform solution in the education industry: help enterprises realize the integration of operation and management
【高并发基础】MySQL索引优化
深度学习基础汇总
Among US private server setup
北京有哪些牛逼的中小型公司?