Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
confucianzuoyuan committed Nov 19, 2018
2 parents 84e0699 + da1c342 commit 96a4f5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bookstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2965,10 +2965,10 @@ def order(request, page):
for order in order_li:
# 根据订单id查询订单商品信息
order_id = order.order_id
order_books_li = OrderGoods.objects.filter(order_id=order_id)
order_books_li = OrderBooks.objects.filter(order_id=order_id)

# 计算商品的小计
# order_books ->OrderGoods实例对象
# order_books ->OrderBooks实例对象
for order_books in order_books_li:
count = order_books.count
price = order_books.price
Expand Down Expand Up @@ -3046,7 +3046,7 @@ def order(request, page):
<tbody>
<tr>
<td width="55%">
{# 遍历出来的order_books是一个OrderGoods对象 #}
{# 遍历出来的order_books是一个OrderBooks对象 #}
{% for order_books in order.order_books_li %}
<ul class="order_book_list clearfix">
<li class="col01"><img src="{% static order_books.books.image %}"></li>
Expand Down
7 changes: 6 additions & 1 deletion bookstore/书城项目介绍.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,9 @@ xadmin模块,配合权限管理来给公司不同的部门分配权限。
2. 写增删改查时,无论写sql语句还是orm语句,尽量多考虑性能问题,避免写出耗时过长的查询。
3. 多考虑缓存策略。对redis的各种使用。
4. 要多写代码,来者不拒,尽量成为一名全栈。
5. 和产品要详细的讨论清楚需求,避免后期返工。
5. 和产品要详细的讨论清楚需求,避免后期返工。

# 难题

1. 当今网站的瓶颈在于数据库,所以做好缓存策略至关重要,瓶颈不在语言,要把经常被访问的热点数据,放在缓存中。
2. 面对高并发场景,例如秒杀,使用队列将海量请求缓存下来,避免对数据库造成太大的压力。

0 comments on commit 96a4f5a

Please sign in to comment.