当前位置:网站首页>Variable star --- article module (1)
Variable star --- article module (1)
2022-07-06 20:38:00 【mb61037a3723f67】
Catalog
One : Get article details :
1: Analysis of article detail table :
analysis : To return the content information of the article , Article table , Users of articles . These three kinds of information come from three tables . If User Table as the main table , You cannot query the information of the article , So only the article table can be used as the main table .

2: Enter the data in the article content table :
mysql -uroot -pmysql -D hm_topnews -h 192.168.44.128 < sql file name

3: Write ideas :
1: First get the parameters , Need to get user's id, as well as is_refresh, Determine whether the user is logged in , And get article_id, The article id, Because we need to according to the article id Query the linked table .
2: Logical processing : The article table is used as the main table , Joint user table and article content table , According to the article id, Query the title of the article , Author information of the article , The content of the article .
3: If the user has logged in , Check whether the user pays attention to the author of the article , Query whether the user has collected this article , And the user's attitude towards the author .
4: Build response returns : Convert the data related to the article into a dictionary and return .
app/resource/article/article.py
test — Return the default information when you are not logged in :
4: Pay attention to the author's implementation :
1: Code implementation :
2: Add fields to the database :6 User No 1 No. author :
3: test :
5: Collection relationship and attitude relationship :
1: Add the relationship between users and articles collection and the attitude relationship between users and articles in the database .

2: Code implementation :

Two : Focus on users :
1: Demand analysis :
1: To obtain parameters : User id, The author's id.
2: Business logic : According to the user id And the author id Query in the following table , Three relationships are known [ Focus on =1, No attention to =0, Pull black =2], If the data is queried in the database, it may be concerned or hacked , Send this follow interface request , It can only be attention , Therefore, modify the relationship to focus on the relationship , And modify the time of concern .
3: If there is no data in the database , Explain that I haven't paid attention to , Therefore, we need to add data to the database .
4: After clicking on the user's attention , The number of users' followers should be increased 1, The number of fans of the author is also increased by one .
2: Code implementation :
Interface code :
Routing code :
test :

3、 ... and : Cancel paying attention to the interface :
1: Interface code :
2: route :
3: test :

边栏推荐
- Comment faire une radio personnalisée
- [DSP] [Part 2] understand c6678 and create project
- Minimum cut edge set of undirected graph
- Maximum likelihood estimation and cross entropy loss
- Case ① | host security construction: best practice of 3 levels and 11 capabilities
- 永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
- OAI 5G NR+USRP B210安装搭建
- Tencent T4 architect, Android interview Foundation
- JS get browser system language
- Core principles of video games
猜你喜欢

5. Wireless in vivo nano network: top ten "feasible?" problem

Boder radius has four values, and boder radius exceeds four values

Use of OLED screen

Leetcode question 283 Move zero

How to upgrade high value-added links in the textile and clothing industry? APS to help
![[DIY]如何制作一款个性的收音机](/img/fc/a371322258131d1dc617ce18490baf.jpg)
[DIY]如何制作一款个性的收音机

逻辑是个好东西

01 basic introduction - concept nouns

Special topic of rotor position estimation of permanent magnet synchronous motor -- fundamental wave model and rotor position angle

RT thread I2C tutorial
随机推荐
B-jiege's tree (pressed tree DP)
[weekly pit] positive integer factorization prime factor + [solution] calculate the sum of prime numbers within 100
Initial experience of addresssanitizer Technology
8086指令码汇总表(表格)
Leetcode question 283 Move zero
永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
报错分析~csdn反弹shell报错
2022 nurse (primary) examination questions and new nurse (primary) examination questions
[DIY]自己设计微软MakeCode街机,官方开源软硬件
C language operators
Build your own application based on Google's open source tensorflow object detection API video object recognition system (IV)
Web security - payload
Learn to punch in Web
Mécanisme de fonctionnement et de mise à jour de [Widget Wechat]
use. Net drives the OLED display of Jetson nano
Crawler (14) - scrape redis distributed crawler (1) | detailed explanation
SSO single sign on
[DSP] [Part 1] start DSP learning
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
Rhcsa Road