当前位置: 首页>>代码示例>>Python>>正文


Python MethodUtil.md5方法代码示例

本文整理汇总了Python中base.utils.MethodUtil.md5方法的典型用法代码示例。如果您正苦于以下问题:Python MethodUtil.md5方法的具体用法?Python MethodUtil.md5怎么用?Python MethodUtil.md5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在base.utils.MethodUtil的用法示例。


在下文中一共展示了MethodUtil.md5方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_pwd

# 需要导入模块: from base.utils import MethodUtil [as 别名]
# 或者: from base.utils.MethodUtil import md5 [as 别名]
def update_pwd(request):
    rs = {}
    ucode = request.POST.get('ucode')
    passwd = request.POST.get('passwd')
    try:
        user = BasUser.objects.get(ucode=ucode)
        user.password =  mtu.md5(passwd)
        user.save()
        rs["status"] = "0"
    except Exception as e:
        rs["status"] = "1"
        print(e)
    return HttpResponse(json.dumps(rs))
开发者ID:KGPython,项目名称:scm,代码行数:15,代码来源:views.py

示例2: uppwd

# 需要导入模块: from base.utils import MethodUtil [as 别名]
# 或者: from base.utils.MethodUtil import md5 [as 别名]
def uppwd(request):
    data = {}
    flag = mtu.getReqVal(request,"flag")
    #修改
    if flag=="1":
        user = request.session.get("s_user",None)
        ucode = user["ucode"]
    elif flag=="2":
        ucode = mtu.getReqVal(request,"ucode")

    data["result"] = "1"
    try:
        newPwd = mtu.getReqVal(request,"newPwd","")
        pwd = mtu.md5(newPwd)
        BasUser.objects.filter(ucode=ucode).update(password=pwd)

        data["result"] = "0"
    except Exception as e:
        print(e)

    return HttpResponse(json.dumps(data))
开发者ID:KGPython,项目名称:scm,代码行数:23,代码来源:views.py

示例3: index

# 需要导入模块: from base.utils import MethodUtil [as 别名]
# 或者: from base.utils.MethodUtil import md5 [as 别名]
def index(request):
    grpcode = request.session.get('s_grpcode','')
    utype = request.session.get("s_utype")
    page = mtu.getReqVal(request,"page","1")

    action = mtu.getReqVal(request,"action")

    nm = mtu.getReqVal(request,"nm")
    ucode = mtu.getReqVal(request,"ucode")
    pwd = mtu.getReqVal(request,"pwd")
    dept = mtu.getReqVal(request,"dept")
    status = mtu.getReqVal(request,"status")
    remark = mtu.getReqVal(request,"remark")

    user = BasUser()
    if action!="new":
        try:
            user = BasUser.objects.get(ucode=ucode)
        except:
           user = None

        if action == "save":
            if not user:
                user = BasUser()
                user.ucode = ucode
                user.budate = datetime.date.today()

            user.password = mtu.md5(pwd)
            user.nm = nm
            user.dept = dept
            user.utype = utype
            user.status = status
            user.remark = remark
            user.grpcode = grpcode
            user.save()

            ke = BasKe()
            ke.kbcode = user.ucode
            ke.kbname = user.nm
            ke.save()
        elif action == "del":
            try:
                ke = BasKe.objects.get(kbcode=ucode)
                if ke:
                    ke.delete()
            except Exception as e:
               print(e)
            if user:
                user.delete()
            user = BasUser()

    retUserList = BasUser.objects.values('ucode','nm','password','dept','depttype','utype','status','grpcode').filter(grpcode=grpcode)
    paginator = Paginator(retUserList,LIMIT)
    try:
        retUserList = paginator.page(int(page))
    except Exception as e:
        print(e)
        retUserList = []

    pageCount = paginator.num_pages
    pageList = []
    for index in range(1,pageCount+1):
        pageList.append(index)
    usertype = (str(utype),Constants.USER_TYPE.get(utype))

    rs = {}
    rs["page"] = page
    rs["usertype"] = usertype
    rs["retUserList"] = retUserList
    rs["pageList"] = pageList
    rs["grpcode"] = grpcode
    rs["user"] = user
    return render(request,'admin/sysConf_retail_admin.html',rs)
开发者ID:KGPython,项目名称:scm,代码行数:75,代码来源:views.py

示例4: login

# 需要导入模块: from base.utils import MethodUtil [as 别名]
# 或者: from base.utils.MethodUtil import md5 [as 别名]
def login(request):
    ucode = mtu.getReqVal(request,"ucode","")
    password = mtu.getReqVal(request,"password","")
    vcode = mtu.getReqVal(request,"vcode","")
    try:
        olduser = request.session.get("s_user",default=None)
        vcode2 = request.session["s_vcode"]
    except:
        olduser = []
        vcode2 = ""

    response_data = {}
    try:
        #判断是否过期:过期后不显示业务菜单,只显示首页、退出,提醒已经过期。
        if not olduser:
            if vcode==vcode2:
                #查询用户信息
                user = BasUser.objects.get(ucode=ucode)
                if user:
                    upwd = user.password
                    password = mtu.md5(password)
                    if upwd==password:
                        request.session["s_user"] = user.toDict()
                        request.session["s_ucode"] = user.ucode
                        request.session["s_uname"] = user.nm
                        request.session["s_utype"] = user.utype
                        request.session["menu_type"] = user.utype
                        #根据grpcode查询grpname:
                        #   如果utype==2,登录用户为供应商则grpname为供应商名称
                        #   如果utype==1,登录用户为零售商则grpname为零售商名称
                        if user.utype == "2":    #供应商
                            grpcode = findGrpCodeBySuppCode(user.grpcode)
                            request.session["s_grpcode"] = grpcode
                            try:
                                fee =  BasFee.objects.get(suppcode=user.grpcode,grpcode=grpcode,ucode=ucode)
                                request.session["s_fee"] = fee.toDict()
                            except Exception as e:
                                print(e)
                                request.session["s_fee"] = {"status":"N"}
                            request.session["s_suppcode"] = user.grpcode

                            supp = findGrpNameByCode(user.grpcode,user.utype)
                            request.session["s_suppname"] = supp.chnm
                            request.session["s_contracttype"] = supp.contracttype
                            request.session["s_paytypeid"] = supp.paytypeid
                            request.session["s_bank"] = supp.bank
                            request.session["s_accountno"] = supp.accountno

                            grp = findGrpNameByCode(grpcode,"1")
                            request.session["s_grpname"] = grp.grpnm

                            response_data['homeurl'] = Constants.URL_SUPPLIER_HOME

                        else:    #零售商
                            request.session["s_grpcode"] = user.grpcode

                            grp = findGrpNameByCode(user.grpcode,user.utype)
                            request.session["s_grpname"] = grp.grpnm
                            request.session["s_fee"] = {}
                            response_data['homeurl'] = Constants.URL_RETAILER_HOME

                        request.session["homeurl"] = response_data['homeurl']
                        #查询角色,多个角色用“,”分割
                        urs = findRoleByUcode(user.ucode)
                        if urs:
                            urole = urs[0]
                            #查询菜单权限
                            purlist = findPurByRcode(urs[2])
                            request.session["s_rcodes"] = urs[1]
                            request.session["isadmin"] = urs[3]
                            request.session["s_urole"] = urole
                            request.session["s_umenu"] = getMenu(purlist)
                            response_data['status'] = "0"

                            #添加登录日志
                            if user.utype=="2":
                                lastlandtime = datetime.date.today().strftime("%Y-%m-%d")
                                slist = BasSuppLand.objects.filter(suppcode=user.grpcode,lastlandtime__gte="{lastlandtime} 00:00:00".format(lastlandtime=lastlandtime)).values("landcs")
                                if slist and slist[0]:
                                    sland = slist[0]
                                    landcs=sland["landcs"]+1
                                    BasSuppLand.objects.filter(suppcode=user.grpcode,lastlandtime__gte="{lastlandtime} 00:00:00".format(lastlandtime=lastlandtime)).update(landcs=landcs,lastlandtime=datetime.datetime.today())
                                else:
                                    fee =  request.session.get("s_fee")
                                    if fee:
                                        status = fee["status"]
                                    else:
                                        status = "N"
                                    suppname =  request.session.get("s_suppname")
                                    lastLand = BasSuppLand.objects.values("allcs").latest("allcs")
                                    if lastLand:
                                        allcs = lastLand["allcs"]+1
                                    else:
                                        allcs = 1

                                    bs =  BasSuppLand()
                                    bs.grpcode = "00069"
                                    bs.utype = "2"
                                    bs.suppcode = user.grpcode
                                    bs.landcs = 1
#.........这里部分代码省略.........
开发者ID:KGPython,项目名称:scm,代码行数:103,代码来源:views.py


注:本文中的base.utils.MethodUtil.md5方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。