E-commerce projects from December 1, 2020 to December 11, 2020

Time:2021-2-25

Work content on December 11, 2020

Complete the logical analysis and implementation of receiving address

1. Display and cache information of provinces and cities

  • Three level interaction of provincial and urban areas

    The core is to store the information of provinces, cities and counties in a table, and use self association to query data

    • Prepare information model and user address model of province and city

      Use Vue to locally update the data of province, city and county. When the page is loaded, the province information is loaded asynchronously. When the province ID changes, the city information is queried. When the city ID changes, the district / county information is queried
    • Cache the information of provinces, cities and counties, because the data is relatively unchanged, so the cache improves the running speed

      Using Django’s own cache module, it is very simple to implement

2. Add back end logic of address

  • Design interface and definition (only login users are allowed)
  • Define user address model, operate user address data, and add default address field to user class model
  • Logic implementation
  • Accept JSON data, organize and respond to JSON data

3. Display the back end logic of address

  • Interface design and definition
  • Query all user address information and return.

4. Modify the back end logic of address

  • Interface design and definition
  • Query address and update

5. Delete the back end logic of address

  • Interface design and definition: logical deletion, design is_ Deleted field, pseudo deleted
  • Query address, and pseudo delete

6. Set the default address and modify the back-end logic of the address title

  • Interface design and definition:
  • Query address, set default address and modify address title

summary

  1. I’m still not familiar with the usage of Vue. When modifying the front-end page, the progress is always very slow

  2. Today, for a bug, because when serializing JSON data, I wrote a wrong word and checked it for an hour. It’s really careless.

    Work content on December 5, 2020

    Complete user center information rendering and mailbox verification

  3. Analysis of user centered logic

  • Analysis of user basic information logic

    The core is to add email to the user model_ Active field to confirm whether it is activated

    • Query and render user basic information

      It can be used directly request.user Access to login user information, use login verification to ensure login user information

2. User center front end logic

  • Receive user information from the back end and transfer it to vue.js And rendering, so that the format code is convenient and unified
  • Front end check mailbox format
  • The front end sends a request to the corresponding interface of the back end and sends a confirmation email to the user’s mailbox
  • Select the presentation information according to the email activation status

3. Back end logic

  • Modify user model: add email_ Active field, and migration
  • Configure Django send mail configuration
  • Send email to verify email: use cell to send email asynchronously to improve response speed

    Setting the retrial mechanism in cell

  • Generate mailbox to confirm the connection: use itsdangerous to realize the signature and set the expiration time
  • Mailbox confirm connection verification: use itsdangerous to extract user information and verify

summary

  1. I’m not very familiar with some advanced uses of celery, so I need to strengthen my study, such as the working mode of celery, etc.

  2. Third party login is basically similar to QQ login, you can add all kinds of third party login according to the situation in the future

    Work content on December 4, 2020

    Complete the third party QQ login

  3. Read QQ development documents

  • Developer application

    • QQ application: need domain name to pass the record

    • Website docking QQ landing steps: the official documents are detailed

2. Achieve QQ login

  • Apply for appid and appkey
  • Get authorization code: get the code by processing the callback URL
  • Access through authorization code_ token
  • Through access_ Token to get openid

    You can get and modify QQ user information through OpenAPI interface

3. Back end implementation

  • Define QQ login class model: in the future, it is used to determine whether the user has been bound to the mall user, and it needs to be associated with the user class user
  • Use the third-party QQ login tool: because QQ has no SDK, it uses the online third-party toolkit, qqlogintool, to realize QQ login
  • Oauth2. Authentication, get openid
  • Is openid bound

    1. Binding status: directly keep the status for the user and return to the home page or previous page

2. There is no binding. If the user exists, it is directly associated. If it does not exist, it is created and associated

summary

  1. QQ development documents to watch carefully, the details are inside.

  2. Third party login is basically similar to QQ login, you can add all kinds of third party login according to the situation in the future

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Practice analysis of rust built-in trait: partialeq and EQ

Abstract:Rust uses traits in many places, from simple operator overloading to subtle features like send and sync. This article is shared from Huawei cloud community《Analysis of rust built-in trait: partialeq and EQ》Author: debugzhang Rust uses traits in many places, from simple operator overloading to subtle features like send and sync. Some traits can be automatically […]