python tourism project

Display of small tourism projects

  • The project adopts Vant UI as the UI of the project. The rapid prototyping interface, Vant's official address:
    • https://vant-contrib.gitee.io/vant/#/zh-CN/home
  • The front-end page is formed by Vue cli, and the back-end relies on Django and uses Api communication to complete it quickly

Front page display

Main page

Search page

My page

Other pages

Back end page display

PDManORM modeling

  • system module
  • sight module
  • accounts module
  • order module

Relation diagram

API interface

accounts module interface

####User login api

  • Request URL (POST)
/account/user/api/login/
  • Request parameters
Parameter valuetypedescribe
usernameRequireduser name
passwordRequiredpassword
  • Return instance
{
    "user": {
        "nickname": "Li Si",
        "avatar": "http://localhost:8000/medias/avatar/202105/%E4%B8%BB%E4%BA%A7%E5%93%81.png",
        "username": "17083430700"
    },
    "profile": {
        "real_name": "ZRR",
        "sex": 1,
        "sex_display": "male"
    }
}

User logout api

  • Request URL (GET)
/account/user/api/logout/
  • Return status code status=201

User registration api

  • Request URL (POST)
/account/user/api/register/
  • Request parameters (verification code interface required)
Parameter valuetypedescribe
usernameRequiredcell-phone number
passwordRequiredpassword
nicknameRequirednickname
sms_codeRequiredVerification Code
  • Return instance
{
    "user": {
        "nickname": "Zhang San",
        "avatar": "",
        "username": "17083430701"
    },
    "profile": {
        "real_name": "",
        "sex": 1,
        "sex_display": "male"
    }
}

User details api

  • Request URL (GET)
/account/user/api/info/
  • Return instance
{
    "user": {
        "nickname": "Zhang San",
        "avatar": "",
        "username": "17083430701"
    },
    "profile": {
        "real_name": "",
        "sex": 1,
        "sex_display": "male"
    }
}

system module interface

Rotation map api

  • Request URL (GET)
/system/slider/list/
  • Return instance
{
    "meta": {},
    "objects": [
        {
            "id": 1,
            "img_url": "http://localhost:8000/medias/202105/slider/banner2.png",
            "target_url": null,
            "name": "Sinus doctor Temple"
        },
        {
            "id": 2,
            "img_url": "http://localhost:8000/medias/202105/slider/banner1.png",
            "target_url": null,
            "name": "Erlong mountain"
        },
        {
            "id": 3,
            "img_url": "http://localhost:8000/medias/202105/slider/banner3.png",
            "target_url": null,
            "name": "Juiwei mountain"
        }
    ]
}

smsCodeapi

  • Request URL (POST)
/system/send/sms/
  • Request parameters
Parameter valuetypedescribe
phone_numRequiredcell-phone number
  • Return instance
{
    "phone_num": "17083430701",
    "sms_code": 397702,
    "timeout": 300
}

sight module interface

Attraction list api

  • Request URL (GET)
/sight/sight/list/
  • Request parameters
Parameter valuetypedescribe
pageOptional fillingPage number
is_hotOptional fillingIs it popular
is_topOptional fillingSelect or not
nameOptional fillingname
  • Return instance
{
    "meta": {
        "total_count": 6,
        "page_count": 2,
        "current_page": 2
    },
    "objects": [
        {
            "id": 27,
            "name": "yingze park ",
            "main_img": "http://localhost:8000/medias/202105/sight/wKgE2l1bTouAHckxACFKt8kMMXs85.jpg",
            "score": 5.0,
            "city": "Taiyuan",
            "min_price": 10.0,
            "province": "Shanxi",
            "comment_count": 0
        }
    ]
}

redis list

  • Request URL (GET)
/sight/sight/list/cache/
  • Same as the attraction list api

Attraction details api

  • Request URL (GET)
/sight/sight/detail/<int:pk>/
  • Return instance
{
    "id": 1,
    "name": "Erlong mountain",
    "desc": "Erlong mountain",
    "img": "http://localhost:8000/medias/202105/sight/04f1842f6cea4753aebde62e9b680a97.jpg",
    "score": 5.0,
    "content": "<h1>Located in the northwest of Taiyuan, in the campus of Zhongbei University, the mountain is more than 100 meters high, with beautiful scenery, flowers blooming all over the mountain, and scenic spots such as beneficial foot path, love forest, pleasant platform, Longshan waterfall, love platform, corridor and large grass painting, which are built for work study students of Zhongbei University.</h1>\r\n\r\n<hr />\r\n<p><span class=\"marker\">traffic</span></p>\r\n\r\n<p>835 Zhongbei University Station</p>\r\n\r\n<p><span class=\"marker\">admission ticket</span></p>\r\n\r\n<p>Please consult the scenic spot for specific details</p>\r\n\r\n<p><span class=\"marker\">Opening Hours</span></p>\r\n\r\n<p>all day (1 January 1-12 Monday, March 31-Sunday)</p>\r\n\r\n<hr />\r\n<h2>Location of scenic spots</h2>\r\n\r\n<p>Shanglan village, Jiancaoping District, Taiyuan City, Shanxi Province (on the campus of Zhongbei University)</p>",
    "province": "Shanxi",
    "city": "Taiyuan",
    "area": "Pointed lawn",
    "town": "Shanglan Village",
    "min_price": 10.0,
    "comment_count": 1,
    "image_count": 1
}

Attraction comment list api

  • Request URL (GET)
/comment/list/<int:pk>/
  • Request parameters
Parameter valuetypedescribe
pageOptional fillingPage number
  • Return instance
{
    "meta": {
        "total_count": 1,
        "page_count": 1,
        "current_page": 1
    },
    "objects": [
        {
            "user": {
                "pk": 2,
                "nickname": "Li Si"
            },
            "pk": 2,
            "content": "Erlong mountain, also known as Lieshi mountain, is close to Fenhe River in the West. The terrain is dangerous. It is the north gate of Taiyuan. During the war of liberation, Yan Xishan's army built a large number of military facilities on Lieshi mountain. Now there are three blockhouses and one underground passage. Erlong mountain, in the campus of Zhongbei University in the northwest corner of Taiyuan, is a rare scenic spot relying on the campus. The mountain is not too high, but the scenery is beautiful, with flowers all over the mountain and many scenic spots. Erlong mountain scenic spot in Taiyuan is one of the few summer resorts in Taiyuan.",
            "love_count": 65,
            "score": 5.0,
            "is_public": 1,
            "images": [
                {
                    "img": "http://localhost:8000/medias/202105/file/c711f75cfc1f4f3d8c009bbb21919a2e.jpg",
                    "summary": "Erlongshan review"
                },
                {
                    "img": "http://localhost:8000/medias/202105/file/2427bc6964aa48b08ec3b6fc56de6552.jpg",
                    "summary": "Erlongshan review"
                },
                {
                    "img": "http://localhost:8000/medias/202105/file/019f654a568044a5ae091043923c378c.jpg",
                    "summary": "Erlongshan review"
                }
            ],
            "created_at": "2021-04-15"
        }
    ]
}

Ticket list api under scenic spots

  • Request URL (GET)
/ticket/list/<int:pk>/
  • Request parameters
Parameter valuetypedescribe
pageOptional fillingPage number
  • Return instance
{
    "meta": {
        "total_count": 1,
        "page_count": 1,
        "current_page": 1
    },
    "objects": [
        {
            "pk": 1,
            "name": "Erlong mountain ticket",
            "desc": "23:52 You can book tomorrow before tomorrow",
            "types": 11,
            "price": 10.0,
            "discount": 10.0,
            "total_stock": 100000,
            "remain_stock": 99976,
            "sell_price": 10.0
        }
    ]
}

####Scenic spot introduction api

  • Request URL (GET)
/sight/info/<int:pk>/
  • Return instance
{
    "pk": 1,
    "entry_explain": "<h1>Located in the northwest of Taiyuan, in the campus of Zhongbei University, the mountain is more than 100 meters high, with beautiful scenery, flowers blooming all over the mountain, and scenic spots such as beneficial foot path, love forest, pleasant platform, Longshan waterfall, love platform, corridor and large grass painting, which are built for work study students of Zhongbei University.</h1>\r\n\r\n<hr />\r\n<p>traffic</p>\r\n\r\n<p>835 Zhongbei University Station</p>\r\n\r\n<p>admission ticket</p>\r\n\r\n<p>Please consult the scenic spot for specific details</p>\r\n\r\n<p>Opening Hours</p>\r\n\r\n<p>all day (1 January 1-12 Monday, March 31-Sunday)</p>\r\n\r\n<hr />\r\n<h2>Location of scenic spots</h2>\r\n\r\n<p>Shanglan village, Jiancaoping District, Taiyuan City, Shanxi Province (on the campus of Zhongbei University)</p>",
    "play_way": "<h3>Erlong mountain, also known as Lieshi mountain, is close to Fenhe River in the West. The terrain is dangerous. It is the north gate of Taiyuan. During the war of liberation, Yan Xishan's army built a large number of military facilities on Lieshi mountain. Now there are three blockhouses and one underground passage. Erlong mountain, in the campus of Zhongbei University in the northwest corner of Taiyuan, is a rare scenic spot relying on the campus. The mountain is not too high, but the scenery is beautiful, with flowers all over the mountain and many scenic spots. Erlong mountain scenic spot in Taiyuan is one of the few summer resorts in Taiyuan.</h3>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/2340c93ebce0477b82788c24318edabb.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/719ec2d7ebce4ac88f286ea863e243d7.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/9a7d9bb6b64d427d871efb3619d8bfd9.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/0b7568fc46794e778ac4204cfff7c403.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/887b1678c5c84c11a0fd34439abdb8ba.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/fb1d4c4aa4f94fe48f6a5f59f35e4c8d.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/0f48ef1e3f94444d86a871eafa69f47e.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/019f654a568044a5ae091043923c378c.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/2427bc6964aa48b08ec3b6fc56de6552.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/2ffe0923eedc4765888ce1ff6cda71a4.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/20c36e99210f41e9a3706d05e4ea6cc8.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/ed7886c77b0b42e3b7d7c32fe60805ef.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/c711f75cfc1f4f3d8c009bbb21919a2e.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/04f1842f6cea4753aebde62e9b680a97.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/12e2e1a4def4490dae87237799a55ee8.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/10651892dc234bc7b63dab3263dccf85.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/7b0c11d676f749478e827ca7b35d54ac.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/2f47940515ed4d06bcf4ecc29bbcffc4.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/32920e45f036419fa09a7c9c51cfbbd3.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/bef9359ad2354ef88a49453c02ced182.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/e64328fb06cf40d1b9288924f4af3dc8.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/f2f1c116018d43e59c5ed55f6940be7a.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/232bf0fa1d0d475c9704e8c29dc41147.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>\r\n\r\n<p><img src=\"https://ss2.meipian.me/users/418550/6253aa30173e454bb78bb9f79756f191.jpg?imageView2/2/w/750/h/1400/q/80\" /></p>",
    "tips": "<h4><strong>Tips </strong></h4>\r\n\r\n<p>traffic</p>\r\n\r\n<p>835 Zhongbei University Station</p>\r\n\r\n<p>admission ticket</p>\r\n\r\n<p>Please consult the scenic spot for specific details</p>\r\n\r\n<p>Opening Hours</p>\r\n\r\n<p>all day (1 January 1-12 Monday, March 31-Sunday)</p>",
    "traffic": "<h2>Location of scenic spots</h2>\r\n\r\n<p>Shanglan village, Jiancaoping District, Taiyuan City, Shanxi Province (on the campus of Zhongbei University)</p>"
}

Scenic spot details picture list api

  • Request URL (GET)
/sight/image/list/<int:pk>
  • Request parameters
Parameter valuetypedescribe
pageOptional fillingPage number
  • Return instance
{
    "meta": {
        "total_count": 1,
        "page_count": 1,
        "current_page": 1
    },
    "objects": [
        {
            "image": "http://localhost:8000/medias/202105/file/2ffe0923eedc4765888ce1ff6cda71a4.jpg",
            "summary": "Erlong mountain Foundation"
        }
    ]
}

Ticket details api

  • Request URL (GET)
/sight/ticket/detail/<int:pk>
  • Return instance
{
    "pk": 1,
    "name": "Erlong mountain ticket",
    "desc": "23:52 You can book tomorrow before tomorrow",
    "types": 11,
    "price": 10.0,
    "sell_price": 10.0,
    "discount": 10.0,
    "expire_date": 7,
    "return_policy": "Contact administrator",
    "has_invoice": true,
    "entry_way": "SMS ticket exchange",
    "tips": "<div>Located in the northwest of Taiyuan, in the campus of Zhongbei University, the mountain is more than 100 meters high, with beautiful scenery, flowers blooming all over the mountain, and scenic spots such as beneficial foot path, love forest, pleasant platform, Longshan waterfall, love platform, corridor and large grass painting, which are built for work study students of Zhongbei University.</div>\r\n\r\n<hr />\r\n<p>traffic</p>\r\n\r\n<p>835 Zhongbei University Station</p>\r\n\r\n<p>admission ticket</p>\r\n\r\n<p>Please consult the scenic spot for specific details</p>\r\n\r\n<p>Opening Hours</p>\r\n\r\n<p>all day (1 January 1-12 Monday, March 31-Sunday)</p>\r\n\r\n<hr />\r\n<h2>Location of scenic spots</h2>\r\n\r\n<p>Shanglan village, Jiancaoping District, Taiyuan City, Shanxi Province (on the campus of Zhongbei University)</p>",
    "remark": "<p>There are no small here<span class=\"marker\">tips</span></p>"
}

order module interface

Order submission api

  • Request URL (POST)
/order/ticket/submit/
  • Request parameters
Parameter valuetypedescribe
ticket_idRequiredTicket ID
play_dateRequiredTravel time
to_userRequiredUser nickname
to_phoneRequiredUser mobile number
buy_countRequiredTotal purchase price
  • Return instance
{
    "sn": "202105171247379691779086"
}

####Order details api

  • Request URL (GET)
/order/order/detail/<int:sn>
  • Return instance
{
    "sn": "202105171247379691779086",
    "buy_count": 20,
    "buy_amount": 200.0,
    "types": 10,
    "status": 11,
    "created_at": "2021-05-17",
    "remark": null,
    "to_user": "Li Si",
    "to_area": "",
    "to_address": "",
    "to_phone": "17083430700",
    "express_type": null,
    "express_no": null,
    "items": [
        {
            "pk": 21,
            "flash_name": "Erlong mountain ticket",
            "flash_price": 10.0,
            "flash_img": "http://localhost:8000/medias/202105/sight/7b0c11d676f749478e827ca7b35d54ac.jpg",
            "flash_origin_price": 10.0,
            "flash_discount": 10.0,
            "count": 20,
            "amount": 200.0,
            "remark": "Travel time 2021-05-20",
            "object_id": 1,
            "app_label": "sight",
            "model": "ticket"
        }
    ]
}

Order list

  • Request URL (GET)
/order/order/list/
  • Request parameters
Parameter valuetypedescribe
pageOptional fillingdescribe
  • Return instance
{
    "meta": {
        "total_count": 1,
        "page_count": 1,
        "current_page": 1
    },
    "objects": [
        {
            "sn": "202105171247379691779086",
            "buy_amount": 200.0,
            "buy_count": 20,
            "types": 10,
            "status": 11,
            "remark": null,
            "created_at": "2021-05-17",
            "item_first": {
                "pk": 21,
                "flash_name": "Erlong mountain ticket",
                "flash_price": 10.0,
                "flash_img": "http://localhost:8000/medias/202105/sight/7b0c11d676f749478e827ca7b35d54ac.jpg",
                "flash_origin_price": 10.0,
                "flash_discount": 10.0,
                "count": 20,
                "amount": 200.0,
                "remark": "Travel time 2021-05-20",
                "object_id": 1,
                "app_label": "sight",
                "model": "ticket"
            }
        }
    ]
}

Global status Code

statusCodedescribe
4044004000The content you accessed does not exist or has been deleted
4004000000parameter format not correct
4054050000Form request method error
4014010000Please login
5005000000The server is busy, please try again later

Keywords: Python Django less Pycharm PostMan

Added by crazykid on Fri, 28 Jan 2022 20:12:31 +0200