python线上购物商城销售系统的设计与实现

这篇具有很好参考价值的文章主要介绍了python线上购物商城销售系统的设计与实现。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

文末获取资源,收藏关注不迷路

前言

随着网络和计算机技术的发展,各行各业出现了新的生机。各种办公软件和网站充斥到日常生活中,并在实践中不断的进步和发展。目前办公软件和网站技术已非常成熟,可以为用户提供更好的工作帮助。网上购物网近几年成为热门,对于商品的购买的途径最常用的有代购、自己去实地购买和网上购买。自己去实地购买一般适合有空闲时间的人们,代购虽然是大多数用户的最佳选择,但由于代购环节不透明而使大部分人们放弃。网上购买的使用量非常高,相对应的管理工作也增加。到目前为止,人们网上交易一般去淘宝、京东等平台。这类平台属于第三方平台需要大量的推广费用,造成商家成本增加而使很多的商家望而却步。
  本线上购物系统采用网上购物模式进行商品的销售,编程语言采用python语言,数据库为mysql,运行软件为Pycharm。本系统包括用户和管理员,用户可以在系统中查看商品信息进行购买,可以进行评价、收藏和管理订单信息;管理员可以管理网站的商品、商品的类型、订单信息。为了保证系统的健康和正向发展,管理员可以对注册用户的资料进行审核。本系统实现了商品的网上销售,减少员工的工作量,提高用户购买的效率和适应时代发展。

一、研究背景

如今的时代是信息化的时代,更种信息大爆炸。人们的基本工作生活中都离不开网络和计算机,现如今各类网站、管理系统、app都快速发展,为人们带来更便捷的生活体验。网站类的系统有宣传类网站、企业类网站、购物类网站,其中使用率最高也最贴近人们生活的是购物类网站,像淘宝、京东,用户量非常大;管理类系统有库存管理系统、会计管理系统、收银管理系统等,使用率也非常大;app类的有美团、拼多多等,都为人们的生活带来了便捷。
商品为每天的必须品,对于商品的购买人们一般都是去商店购买。这种方式需要大量的时间,在销售的高峰期时也有很多的用户排队。对于特定商品还需要大量的时间。这样的现象就导致了代购的出现,制假现象层出不穷,带来了社会不稳定因素。虽然现在也有正规的网上交易网站,但网站属于第三方,需要大量推广费用,增加商家成本。对于特定商品的购买还有一部分是采用自己去销售地,这类方式虽然质量保证,但要求人们拥有足够的时间和出行成本,也不是最优的解决办法。

二、研究意义

目前国家正处于高迅发展的时代,网络已发展到5G,使上网更加快速。网站反应缩短到1秒内,让更多的用户越来越依赖网站。人们对生活品质要求也越来越高,现在也有很多的企业、商家还采用传统的办公管理方式,这类方式对于管理小规模的事项非常便利,信息量少、工作内容少,统计简单。但随着要管理的事项越来越复杂,如果还采用传统的人工管理方式会带来更多的工作错误,使工作花费更多的时间,但实现的效果并不好。所以紧跟时代发展才可以保证更好的工作效率,体现更多的工作价值。
如今是网络和信息化的时候,所有的事务都可以由计算机、网络来管理。商品的销售同样可以实现。采用网上的购买系统可以实现24小时购买,商品的查询也更为方便,出错率也更低。计算机对于信息处理更为高效、准确,也就可以提高工作人员的工作效率,把单一重复性的工作交由计算机来处理,解放工作人员双手,提高工作热情。网上的购买系统可以使商品信息化,实现购买的自动化,用户自主下单,不需要工作人员,减少商家的销售成本,从而提高经济效益。

三、主要使用技术

使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
使用PyCharm 导入项目,修改配置,运行项目;
将项目中config.ini配置文件中的数据库配置改为自己的配置,然后运行;
运行成功后,在浏览器中输入:http://localhost:8080/项目名

本python+django+vue+Elementui+mysql系统可以定制,采用pycharm开发,基于web的B/S架构设计完成,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点,覆盖知识面大,非常适合作为计算机专业的同学参考资料进行学习.主要编程语言为python和mysql,框架是django,有代码视频讲解参考,包安装调试,包本地部署成功.

四、研究内容

为了系统可以实现用户的要求和工作人员的要求,去实际调查和参加销售工作,得出本系统的服务对象为需要商品的用户和商家的工作人员,本系统的基本信息为订单信息和商品信息,根据不同的使用对象设计不同的功能。管理员的功能为:
(1) 商品评价管理功能,查询商品评价和删除商品评价;
(2) 订单管理功能,审核用户的订单;
(3) 商品信息管理功能,调整和发布商品;
(4) 商品类型管理功能,可以管理商品的类型和添加、删除商品的类型;
(5) 会员管理功能,审核用户的注册信息;
(6) 个人中心管理功能,可以实现管理员信息的管理。
用户功能有:
(1) 用户注册功能,方便用户购买和评价使用;
(2) 用户登录功能,登录后才可以进行购买、收藏、评价;
(3) 商品信息功能,浏览商品进行购买;
(4) 订单管理功能,管理购买信息;
(5) 商品评价功能,可以发表自己的使用心得;
(6) 购物车功能,可以实现多种商品一起下单;
(7) 我的信息功能,可以修改自己的资料。
python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言
python设计购物平台代码,python,mysql,开发语言

五、核心代码

#coding:utf-8
__author__ = "ila"
import base64, copy, logging, os, time, xlrd
from django.http import JsonResponse
from django.apps import apps
from django.db.models.aggregates import Count,Sum
from .models import huiyuan
from util.codes import *
from util.auth import Auth
from util.common import Common
import util.message as mes
from django.db import connection
import random
from django.core.mail import send_mail
from django.conf import settings
from django.shortcuts import redirect

def huiyuan_register(request):
    if request.method in ["POST", "GET"]:
        msg = {'code': normal_code, "msg": mes.normal_code}
        req_dict = request.session.get("req_dict")


        error = huiyuan.createbyreq(huiyuan, huiyuan, req_dict)
        if error != None:
            msg['code'] = crud_error_code
            msg['msg'] = "用户已存在,请勿重复注册!"
        return JsonResponse(msg)

def huiyuan_login(request):
    if request.method in ["POST", "GET"]:
        msg = {'code': normal_code, "msg": mes.normal_code}
        req_dict = request.session.get("req_dict")

        datas = huiyuan.getbyparams(huiyuan, huiyuan, req_dict)
        if not datas:
            msg['code'] = password_error_code
            msg['msg'] = mes.password_error_code
            return JsonResponse(msg)
        try:
            __sfsh__= huiyuan.__sfsh__
        except:
            __sfsh__=None

        if  __sfsh__=='是':
            if datas[0].get('sfsh')=='否':
                msg['code']=other_code
                msg['msg'] = "账号已锁定,请联系管理员审核!"
                return JsonResponse(msg)
                
        req_dict['id'] = datas[0].get('id')
        return Auth.authenticate(Auth, huiyuan, req_dict)


def huiyuan_logout(request):
    if request.method in ["POST", "GET"]:
        msg = {
            "msg": "登出成功",
            "code": 0
        }

        return JsonResponse(msg)


def huiyuan_resetPass(request):
    '''
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code}

        req_dict = request.session.get("req_dict")

        columns=  huiyuan.getallcolumn( huiyuan, huiyuan)

        try:
            __loginUserColumn__= huiyuan.__loginUserColumn__
        except:
            __loginUserColumn__=None
        username=req_dict.get(list(req_dict.keys())[0])
        if __loginUserColumn__:
            username_str=__loginUserColumn__
        else:
            username_str=username
        if 'mima' in columns:
            password_str='mima'
        else:
            password_str='password'

        init_pwd = '123456'
        recordsParam = {}
        recordsParam[username_str] = req_dict.get("username")
        records=huiyuan.getbyparams(huiyuan, huiyuan, recordsParam)
        if len(records)<1:
            msg['code'] = 400
            msg['msg'] = '用户不存在'
            return JsonResponse(msg)

        eval('''huiyuan.objects.filter({}='{}').update({}='{}')'''.format(username_str,username,password_str,init_pwd))
        
        return JsonResponse(msg)



def huiyuan_session(request):
    '''
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code,"msg": mes.normal_code, "data": {}}

        req_dict={"id":request.session.get('params').get("id")}
        msg['data']  = huiyuan.getbyparams(huiyuan, huiyuan, req_dict)[0]

        return JsonResponse(msg)


def huiyuan_default(request):

    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code,"msg": mes.normal_code, "data": {}}
        req_dict = request.session.get("req_dict")
        req_dict.update({"isdefault":"是"})
        data=huiyuan.getbyparams(huiyuan, huiyuan, req_dict)
        if len(data)>0:
            msg['data']  = data[0]
        else:
            msg['data']  = {}
        return JsonResponse(msg)

def huiyuan_page(request):
    '''
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code,  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
        req_dict = request.session.get("req_dict")

        #获取全部列名
        columns=  huiyuan.getallcolumn( huiyuan, huiyuan)

        #当前登录用户所在表
        tablename = request.session.get("tablename")


            #authColumn=list(__authTables__.keys())[0]
            #authTable=__authTables__.get(authColumn)

            # if authTable==tablename:
                #params = request.session.get("params")
                #req_dict[authColumn]=params.get(authColumn)

        '''__authSeparate__此属性为真,params添加userid,后台只查询个人数据'''
        try:
            __authSeparate__=huiyuan.__authSeparate__
        except:
            __authSeparate__=None

        if __authSeparate__=="是":
            tablename=request.session.get("tablename")
            if tablename!="users" and 'userid' in columns:
                try:
                    req_dict['userid']=request.session.get("params").get("id")
                except:
                    pass

        #当项目属性hasMessage为”是”,生成系统自动生成留言板的表messages,同时该表的表属性hasMessage也被设置为”是”,字段包括userid(用户id),username(用户名),content(留言内容),reply(回复)
        #接口page需要区分权限,普通用户查看自己的留言和回复记录,管理员查看所有的留言和回复记录
        try:
            __hasMessage__=huiyuan.__hasMessage__
        except:
            __hasMessage__=None
        if  __hasMessage__=="是":
            tablename=request.session.get("tablename")
            if tablename!="users":
                req_dict["userid"]=request.session.get("params").get("id")



        # 判断当前表的表属性isAdmin,为真则是管理员表
        # 当表属性isAdmin=”是”,刷出来的用户表也是管理员,即page和list可以查看所有人的考试记录(同时应用于其他表)
        __isAdmin__ = None

        allModels = apps.get_app_config('main').get_models()
        for m in allModels:
            if m.__tablename__==tablename:

                try:
                    __isAdmin__ = m.__isAdmin__
                except:
                    __isAdmin__ = None
                break

        # 当前表也是有管理员权限的表
        if  __isAdmin__ == "是":
            if req_dict.get("userid"):
                del req_dict["userid"]

        else:
            #非管理员权限的表,判断当前表字段名是否有userid
            if tablename!="users" and 'huiyuan'[:7]!='discuss'and "userid" in huiyuan.getallcolumn(huiyuan,huiyuan):
                req_dict["userid"] = request.session.get("params").get("id")

        #当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
        try:
            __authTables__=huiyuan.__authTables__
        except:
            __authTables__=None

        if __authTables__!=None and  __authTables__!={}:
            try:
                del req_dict['userid']
            except:
                pass
            for authColumn,authTable in __authTables__.items():
                if authTable==tablename:
                    params = request.session.get("params")
                    req_dict[authColumn]=params.get(authColumn)
                    break
        msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
        msg['data']['pageSize']  =huiyuan.page(huiyuan, huiyuan, req_dict, request)

        return JsonResponse(msg)

def huiyuan_autoSort(request):
    '''
    .智能推荐功能(表属性:[intelRecom(是/否)],新增clicktime[前端不显示该字段]字段(调用info/detail接口的时候更新),按clicktime排序查询)
主要信息列表(如商品列表,新闻列表)中使用,显示最近点击的或最新添加的5条记录就行
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code,  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
        req_dict = request.session.get("req_dict")
        if "clicknum"  in huiyuan.getallcolumn(huiyuan,huiyuan):
            req_dict['sort']='clicknum'
        else:
            req_dict['sort']='clicktime'
        req_dict['order']='desc'
        msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
        msg['data']['pageSize']  = huiyuan.page(huiyuan,huiyuan, req_dict)

        return JsonResponse(msg)


def huiyuan_list(request):
    '''
    前台分页
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code,  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
        req_dict = request.session.get("req_dict")

        #获取全部列名
        columns=  huiyuan.getallcolumn( huiyuan, huiyuan)
        #表属性[foreEndList]前台list:和后台默认的list列表页相似,只是摆在前台,:指没有此页,:表示有此页(不需要登陆即可查看),前要登:表示有此页且需要登陆后才能查看
        try:
            __foreEndList__=huiyuan.__foreEndList__
        except:
            __foreEndList__=None

        if __foreEndList__=="前要登":
            tablename=request.session.get("tablename")
            if tablename!="users" and 'userid' in columns:
                try:
                    req_dict['userid']=request.session.get("params").get("id")
                except:
                    pass
        #forrEndListAuth
        try:
            __foreEndListAuth__=huiyuan.__foreEndListAuth__
        except:
            __foreEndListAuth__=None


        #authSeparate
        try:
            __authSeparate__=huiyuan.__authSeparate__
        except:
            __authSeparate__=None

        if __foreEndListAuth__ =="是" and __authSeparate__=="是":
            tablename=request.session.get("tablename")
            if tablename!="users":
                req_dict['userid']=request.session.get("params",{"id":0}).get("id")

        tablename = request.session.get("tablename")
        if tablename == "users" and req_dict.get("userid") != None:#判断是否存在userid列名
            del req_dict["userid"]
        else:
            __isAdmin__ = None

            allModels = apps.get_app_config('main').get_models()
            for m in allModels:
                if m.__tablename__==tablename:

                    try:
                        __isAdmin__ = m.__isAdmin__
                    except:
                        __isAdmin__ = None
                    break

            if __isAdmin__ == "是":
                if req_dict.get("userid"):
                    del req_dict["userid"]
            else:
                #非管理员权限的表,判断当前表字段名是否有userid
                if "userid" in columns:
                    try:
                        pass
                        # 本接口可以匿名访问,所以try判断是否为匿名
                        #req_dict['userid']=request.session.get("params").get("id")
                    except:
                            pass
        #当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的
        try:
            __authTables__=huiyuan.__authTables__
        except:
            __authTables__=None

        if __authTables__!=None and  __authTables__!={} and __foreEndListAuth__=="是":
            try:
                del req_dict['userid']
            except:
                pass
            for authColumn,authTable in __authTables__.items():
                if authTable==tablename:
                    params = request.session.get("params")
                    req_dict[authColumn]=params.get(authColumn)
                    break
        
        if huiyuan.__tablename__[:7]=="discuss":
            try:
                del req_dict['userid']
            except:
                pass


        msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
        msg['data']['pageSize']  = huiyuan.page(huiyuan, huiyuan, req_dict)

        return JsonResponse(msg)

def huiyuan_save(request):
    '''
    后台新增
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
        req_dict = request.session.get("req_dict")
        if 'clicktime' in req_dict.keys():
            del req_dict['clicktime']
        tablename=request.session.get("tablename")
        __isAdmin__ = None
        allModels = apps.get_app_config('main').get_models()
        for m in allModels:
            if m.__tablename__==tablename:

                try:
                    __isAdmin__ = m.__isAdmin__
                except:
                    __isAdmin__ = None
                break


        #获取全部列名
        columns=  huiyuan.getallcolumn( huiyuan, huiyuan)
        if tablename!='users' and req_dict.get("userid")!=None and 'userid' in columns  and __isAdmin__!='是':
            params=request.session.get("params")
            req_dict['userid']=params.get('id')


        error= huiyuan.createbyreq(huiyuan,huiyuan, req_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error

        return JsonResponse(msg)


def huiyuan_add(request):
    '''
    前台新增
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
        req_dict = request.session.get("req_dict")

        #获取全部列名
        columns=  huiyuan.getallcolumn( huiyuan, huiyuan)
        try:
            __authSeparate__=huiyuan.__authSeparate__
        except:
            __authSeparate__=None

        if __authSeparate__=="是":
            tablename=request.session.get("tablename")
            if tablename!="users" and 'userid' in columns:
                try:
                    req_dict['userid']=request.session.get("params").get("id")
                except:
                    pass

        try:
            __foreEndListAuth__=huiyuan.__foreEndListAuth__
        except:
            __foreEndListAuth__=None

        if __foreEndListAuth__ and __foreEndListAuth__!="否":
            tablename=request.session.get("tablename")
            if tablename!="users":
                req_dict['userid']=request.session.get("params").get("id")

        error= huiyuan.createbyreq(huiyuan,huiyuan, req_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return JsonResponse(msg)

def huiyuan_thumbsup(request,id_):
    '''
     点赞:表属性thumbsUp[/],刷表新增thumbsupnum赞和crazilynum踩字段,
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
        req_dict = request.session.get("req_dict")
        id_=int(id_)
        type_=int(req_dict.get("type",0))
        rets=huiyuan.getbyid(huiyuan,huiyuan,id_)

        update_dict={
        "id":id_,
        }
        if type_==1:#赞
            update_dict["thumbsupnum"]=int(rets[0].get('thumbsupnum'))+1
        elif type_==2:#踩
            update_dict["crazilynum"]=int(rets[0].get('crazilynum'))+1
        error = huiyuan.updatebyparams(huiyuan,huiyuan, update_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return JsonResponse(msg)


def huiyuan_info(request,id_):
    '''
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}

        data = huiyuan.getbyid(huiyuan,huiyuan, int(id_))
        if len(data)>0:
            msg['data']=data[0]
        #浏览点击次数
        try:
            __browseClick__= huiyuan.__browseClick__
        except:
            __browseClick__=None

        if __browseClick__=="是"  and  "clicknum"  in huiyuan.getallcolumn(huiyuan,huiyuan):
            try:
                clicknum=int(data[0].get("clicknum",0))+1
            except:
                clicknum=0+1
            click_dict={"id":int(id_),"clicknum":clicknum}
            ret=huiyuan.updatebyparams(huiyuan,huiyuan,click_dict)
            if ret!=None:
                msg['code'] = crud_error_code
                msg['msg'] = ret
        return JsonResponse(msg)

def huiyuan_detail(request,id_):
    '''
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}

        data =huiyuan.getbyid(huiyuan,huiyuan, int(id_))
        if len(data)>0:
            msg['data']=data[0]

        #浏览点击次数
        try:
            __browseClick__= huiyuan.__browseClick__
        except:
            __browseClick__=None

        if __browseClick__=="是"   and  "clicknum"  in huiyuan.getallcolumn(huiyuan,huiyuan):
            try:
                clicknum=int(data[0].get("clicknum",0))+1
            except:
                clicknum=0+1
            click_dict={"id":int(id_),"clicknum":clicknum}

            ret=huiyuan.updatebyparams(huiyuan,huiyuan,click_dict)
            if ret!=None:
                msg['code'] = crud_error_code
                msg['msg'] = retfo
        return JsonResponse(msg)


def huiyuan_update(request):
    '''
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
        req_dict = request.session.get("req_dict")
        if req_dict.get("mima") and req_dict.get("password"):
            if "mima" not  in huiyuan.getallcolumn(huiyuan,huiyuan) :
                del req_dict["mima"]
            if  "password" not  in huiyuan.getallcolumn(huiyuan,huiyuan) :
                del req_dict["password"]
        try:
            del req_dict["clicknum"]
        except:
            pass


        error = huiyuan.updatebyparams(huiyuan, huiyuan, req_dict)
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return JsonResponse(msg)


def huiyuan_delete(request):
    '''
    批量删除
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
        req_dict = request.session.get("req_dict")

        error=huiyuan.deletes(huiyuan,
            huiyuan,
             req_dict.get("ids")
        )
        if error!=None:
            msg['code'] = crud_error_code
            msg['msg'] = error
        return JsonResponse(msg)


def huiyuan_vote(request,id_):
    '''
    浏览点击次数(表属性[browseClick:/],点击字段(clicknum),调用info/detail接口的时候后端自动+1)、投票功能(表属性[vote:/],投票字段(votenum),调用vote接口后端votenum+1)
统计商品或新闻的点击次数;提供新闻的投票功能
    '''
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": mes.normal_code}


        data= huiyuan.getbyid(huiyuan, huiyuan, int(id_))
        for i in data:
            votenum=i.get('votenum')
            if votenum!=None:
                params={"id":int(id_),"votenum":votenum+1}
                error=huiyuan.updatebyparams(huiyuan,huiyuan,params)
                if error!=None:
                    msg['code'] = crud_error_code
                    msg['msg'] = error
        return JsonResponse(msg)

def huiyuan_importExcel(request):
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": "成功", "data": {}}

        excel_file = request.FILES.get("file", "")
        file_type = excel_file.name.split('.')[1]
        
        if file_type in ['xlsx', 'xls']:
            data = xlrd.open_workbook(filename=None, file_contents=excel_file.read())
            table = data.sheets()[0]
            rows = table.nrows
            
            try:
                for row in range(1, rows):
                    row_values = table.row_values(row)
                    req_dict = {}
                    huiyuan.createbyreq(huiyuan, huiyuan, req_dict)
                    
            except:
                pass
                
        else:
            msg.code = 500
            msg.msg = "文件类型错误"
                
        return JsonResponse(msg)

def huiyuan_sendemail(request):
    if request.method in ["POST", "GET"]:
        req_dict = request.session.get("req_dict")

        code = random.sample(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 4)
        to = []
        to.append(req_dict['email'])

        send_mail('用户注册', '您的注册验证码是【'+''.join(code)+'】,请不要把验证码泄漏给其他人,如非本人请勿操作。', 'yclw9@qq.com', to, fail_silently = False)

        cursor = connection.cursor()
        cursor.execute("insert into emailregistercode(email,role,code) values('"+req_dict['email']+"','用户','"+''.join(code)+"')")

        msg = {
            "msg": "发送成功",
            "code": 0
        }

        return JsonResponse(msg)

def huiyuan_autoSort2(request):
    
    if request.method in ["POST", "GET"]:
        req_dict = request.session.get("req_dict")
        cursor = connection.cursor()
        leixing = set()
        try:
            cursor.execute("select inteltype from storeup where userid = %d"%(request.session.get("params").get("id"))+" and tablename = 'huiyuan' order by addtime desc")
            rows = cursor.fetchall()
            for row in rows:
                for item in row:
                    if item != None:
                        leixing.add(item)
        except:
            leixing = set()
        
        L = []
        cursor.execute("select * from huiyuan where $intelRecomColumn in ('%s"%("','").join(leixing)+"') union all select * from huiyuan where $intelRecomColumn not in('%s"%("','").join(leixing)+"')")
        desc = cursor.description
        data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] 
        for online_dict in data_dict:
            for key in online_dict:
                if 'datetime.datetime' in str(type(online_dict[key])):
                    online_dict[key] = online_dict[key].strftime(
                        "%Y-%m-%d %H:%M:%S")
                else:
                    pass
            L.append(online_dict)


        return JsonResponse({"code": 0, "msg": '',  "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":5,"list": L[0:6]}})

def huiyuan_value(request, xColumnName, yColumnName, timeStatType):
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": "成功", "data": {}}
        
        where = ' where 1 = 1 '
        sql = ''
        if timeStatType == '日':
            sql = "SELECT DATE_FORMAT({0}, '%Y-%m-%d') {0}, sum({1}) total FROM huiyuan {2} GROUP BY DATE_FORMAT({0}, '%Y-%m-%d')".format(xColumnName, yColumnName, where, '%Y-%m-%d')

        if timeStatType == '月':
            sql = "SELECT DATE_FORMAT({0}, '%Y-%m') {0}, sum({1}) total FROM huiyuan {2} GROUP BY DATE_FORMAT({0}, '%Y-%m')".format(xColumnName, yColumnName, where, '%Y-%m')

        if timeStatType == '年':
            sql = "SELECT DATE_FORMAT({0}, '%Y') {0}, sum({1}) total FROM huiyuan {2} GROUP BY DATE_FORMAT({0}, '%Y')".format(xColumnName, yColumnName, where, '%Y')
        L = []
        cursor = connection.cursor()
        cursor.execute(sql)
        desc = cursor.description
        data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] 
        for online_dict in data_dict:
            for key in online_dict:
                if 'datetime.datetime' in str(type(online_dict[key])):
                    online_dict[key] = online_dict[key].strftime(
                        "%Y-%m-%d %H:%M:%S")
                else:
                    pass
            L.append(online_dict)
        msg['data'] = L

        return JsonResponse(msg)

def huiyuan_o_value(request, xColumnName, yColumnName):
    if request.method in ["POST", "GET"]:
        msg = {"code": normal_code, "msg": "成功", "data": {}}
        
        where = ' where 1 = 1 '
        
        sql = "SELECT {0}, sum({1}) AS total FROM huiyuan {2} GROUP BY {0}".format(xColumnName, yColumnName, where)
        L = []
        cursor = connection.cursor()
        cursor.execute(sql)
        desc = cursor.description
        data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] 
        for online_dict in data_dict:
            for key in online_dict:
                if 'datetime.datetime' in str(type(online_dict[key])):
                    online_dict[key] = online_dict[key].strftime(
                        "%Y-%m-%d %H:%M:%S")
                else:
                    pass
            L.append(online_dict)
        msg['data'] = L

        return JsonResponse(msg)




六、文章目录

摘 要 I
Abstract II
第1章 绪论 1
1.1课题研究背景 1
1.2课题现状与实现意义 1
1.3课题内容 2
1.4论文结构安排 2
第2章 系统分析 3
2.1系统使用相关技术分析 3
2.1.1Python语言介绍 3
2.1.2Mysql数据库介绍 3
2.1.3Django框架介绍 4
2.2系统可行性分析 4
2.2.1系统技术可行性分析 5
2.2.2系统经济可行性分析 5
2.2.3系统操作可行性分析 5
2.3系统需求分析 5
2.3.1传统销售系统优缺点分析 6
2.3.2本线上购物系统分析 6
2.4系统功能分析 6
2.5系统性能分析 7
2.6用例图 8
2.7系统业务流程 8
第3章 系统设计 12
3.1系统体系结构 12
3.2系统功能结构 12
3.3数据库设计 13
3.3.1ER图设计 13
3.3.2数据库表设计 15
第4章 系统实现 19
4.1系统登录功能的界面实现 19
4.2管理员个人中心功能的界面实现 20
4.3用户注册功能的界面实现 21
4.4管理员会员信息管理功能的界面实现 21
4.5管理员商品信息管理功能的界面实现 22
4.6管理员订单管理功能的界面实现 23
4.7管理员商品类型管理功能的界面实现 23
4.8用户在线购买与订单管理功能的界面实现 24
4.9用户在线充值功能的实现界面 26
第5章 系统测试 27
5.1系统测试的方法 27
5.2测试环境与测试条件 27
5.3实例测试表格 27
总 结 29
参考文献 30
致 谢 32文章来源地址https://www.toymoban.com/news/detail-796671.html

到了这里,关于python线上购物商城销售系统的设计与实现的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 基于微信小程序的美妆护肤品销售购物商城系统的设计与实现(源码+论文)_v_167

     摘 要 基于微信小程序的美妆护肤品销售系统划分了微信用户端和后台管理员端,其中微信用户端使用微信开发者工具开发和wxml、wxss技术,后台管理员端使用Eclipse,开发工具和ssh技术配合mysql数据库,可以在微信端上进行注册和登录,其中登录后的用户可以浏览商品、搜索

    2024年02月04日
    浏览(31)
  • 计算机毕业设计 jsp手机销售购物商城ssh 毕设

    4. 系统的实现 4.1 nbsp;前台系统的实现 4.1.1 nbsp;用户前台界面的实现 本系统网站的主界面设计结构采用了上左右的结构,上部分为主功能菜单区,主要是显示网站的主功能,左侧为用户注册、登录,公告浏览,商品查询,右部分为信息显示区,销售排行榜 主要是为方便用户提供

    2024年02月22日
    浏览(41)
  • 基于Node.js的线上零食铺微信小程序购物商城的设计与实现

    摘要 随着移动互联网的普及和消费者购物习惯的改变,线上购物商城逐渐成为人们日常生活中不可或缺的一部分。本文旨在设计并实现一个基于Node.js的线上零食铺微信小程序购物商城,以满足用户对便捷、快速、个性化购物体验的需求。本文首先分析了线上零食购物商城的

    2024年02月22日
    浏览(34)
  • 【python实战项目】基于python+django的网上购物商城系统的设计与实现

    精彩专栏推荐订阅:在 下方专栏👇🏻👇🏻👇🏻👇🏻 💖🔥 作者主页 :计算机毕设木哥🔥 💖 本项目是一个基于Python和Django框架开发的网上购物商城系统。它提供了一个在线购物平台,用户可以在该平台上浏览商品、下单购买、支付并管理他们的订单。管理员可以管理

    2024年01月16日
    浏览(51)
  • 基于python网上书城图书购物商城系统设计与实现(Django框架)

     博主介绍 :黄菊华老师《Vue.js入门与商城开发实战》《微信小程序商城开发》图书作者,CSDN博客专家,在线教育专家,CSDN钻石讲师;专注大学生毕业设计教育和辅导。 所有项目都配有从入门到精通的基础知识视频课程,免费 项目配有对应开发文档、开题报告、任务书、

    2024年02月22日
    浏览(43)
  • 基于Django在线鲜花水果购物商城系统设计与实现(Pycharm+Python+Mysql)

     博主介绍 :黄菊华老师《Vue.js入门与商城开发实战》《微信小程序商城开发》图书作者,CSDN博客专家,在线教育专家,CSDN钻石讲师;专注大学生毕业设计教育和辅导。 所有项目都配有从入门到精通的基础知识视频课程,学习后应对毕业设计答辩。 项目配有对应开发文档、

    2024年03月18日
    浏览(38)
  • 基于Python(Django框架)的毕业设计作品成品(50)手机数码商城购物网站系统设计与实现

    博主介绍: 《Vue.js入门与商城开发实战》《微信小程序商城开发》图书作者,CSDN博客专家,在线教育专家,CSDN钻石讲师;专注大学生毕业设计教育和辅导。 所有项目都配有从入门到精通的基础知识视频课程,免费 项目配有对应开发文档、开题报告、任务书、PPT、论文模版

    2024年02月08日
    浏览(36)
  • 基于python网上电脑在线电脑购物商城系统设计与实现(django框架)研究背景和意义、国内外现状

     博主介绍 :黄菊华老师《Vue.js入门与商城开发实战》《微信小程序商城开发》图书作者,CSDN博客专家,在线教育专家,CSDN钻石讲师;专注大学生毕业设计教育和辅导。 所有项目都配有从入门到精通的基础知识视频课程,免费 项目配有对应开发文档、开题报告、任务书、

    2024年01月25日
    浏览(41)
  • 【计算机毕业设计】基于微信小程序的线上水果店系统 水果销售系统

    毕设帮助、源码交流、技术解答,见文末 现如今,互联网的广泛普及与应用,标志着信息化的时代已经到来,管理信息化行业在生活中占据着越来越重要的地位,信息化的服务与管理,大大简化了传统的管理模式,很大程度上,改善了使得人们的生活水平和工作方式。简单的

    2024年02月12日
    浏览(32)
  • 基于SSM实现手机销售商城系统

    作者主页:编程指南针 作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师 主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助 文末获取源码    网络销售已经成为现在商品销售的一个主流趋势,传

    2024年02月09日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包