Esempio n. 1
0
def find_password_by_phone(request):
    if request.method == 'POST':
        phone = request.POST.get('phone', '')
        newpassword = request.POST.get('newpassword1', '')
        myverifyCode = request.POST.get('verifyCode', '')  #获取表单的验证码

        mTools = Tools()
        #验证码验证
        verifyCode = mTools.getSession(request,
                                       'findingByPhoneVerifyCode')  #获取会话的验证码
        if myverifyCode != verifyCode:
            context = {'wrong_verifyCode': True}
            return render(request, "forgetPassword.html", context)

        result_code = mFind_password.findPWByPhone(
            phone, newpassword)  #调用这个函数来帮忙用户找回密码
        if result_code == 0:
            context = {'no_user': True}
            return render(request, "forgetPassword.html", context)

        elif result_code == 666:
            context = {'success': True}
            return render(request, "forgetPassword.html",
                          context)  #重置成功,转向成功重置密码界面
    else:
        return render(request, "forgetPassword.html")
Esempio n. 2
0
def find_password_by_email(request):
    if request.method == 'POST':
        mTools = Tools()

        email = request.POST.get('email', '')
        newpassword = request.POST.get('newpassword1', '')
        newpassword2 = request.POST.get('newpassword2', '')
        myverifyCode = request.POST.get('verifyCode', '')  #获取表单的验证码

        #验证码验证
        verifyCode = mTools.getSession(request,
                                       'findingByEmailVerifyCode')  #获取会话的验证码
        if myverifyCode != verifyCode:
            context = {'wrong_verifyCode': True}
            return render(request, "setting.html", context)

        result_code = mFind_password.findPWByEmail(
            email, newpassword)  #调用这个函数来帮忙用户找回密码
        if result_code == 0:
            context = {'no_user': True}
            return render(request, "setting.html", context)
        elif result_code == 666:
            context = {'success': True}
            return render(request, "setting.html", context)  #重置成功,转向成功重置密码界面
    else:
        return render(request, "setting.html")
Esempio n. 3
0
def home_page_post(request):
    mTools = Tools()
    user_id = mTools.getSession(
        request,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if request.method == "POST":
        collection_id = request.POST.get("collectionId", None)
        exceed_collection_id = request.POST.get("exceedCollectionId", None)

        if collection_id is not None:
            result_code = mPersonal_center.deleteValidTimeCar(
                collection_id, user_id)
            if result_code == 0:  #有效期 -- 页面撤销失败
                return HttpResponse("0")
            elif result_code == 666:  #撤销成功
                return HttpResponse("1")

        if exceed_collection_id is not None:  #过期车源页面 --- 删除记录
            result_code = mPersonal_center.deleteInalidTimeCar(
                exceed_collection_id)
            if result_code == 0:  #删除信息失败
                return HttpResponse("0")
            elif result_code == 666:
                return HttpResponse("1")

        return HttpResponse("0")
    else:
        return handler404(request)
Esempio n. 4
0
def publish(req):
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':  #提交
        publish_info = getFormData(req)  #获取表单数据
        req.session['publish_info'] = publish_info  #建立一个会话,传递数据

        context = {"is_login": True, 'source_detail_list': publish_info}
        return render(req, "publish.html", context)

    else:
        #先检查该用户是否具备发布车的权限a
        #try:
        #    user=audit_table.objects.get(phone=current_user_phone_number)
        #    if user.license != 1 or user.IDcard != 1:
        #        return HttpResponseRedirect('/publish_car/no_permisson/')
        #except:
        #    return HttpResponseRedirect('/publish_car/no_permisson/')

        #从导航栏“发布车源”进入的
        contact = mPublish_car.getPublishPeople(user_id)
        if contact == 0:
            return handler500(req)
        else:
            context = {"is_login": True, "contact": contact}  #传递联系人
            return render(req, "publish.html", context)
Esempio n. 5
0
def login(req):
    if req.method == "POST":
        #获取表单用户名和其密码
        user_name = req.POST.get('userName', '')
        password = req.POST.get('password', '')

        mTools = Tools()
        user_ip = mTools.get_client_ip(req)  #获取用户的IP
        result = mLogin.login(
            user_ip, user_name, password
        )  #返回0表示验证失败,返回1表示手机号或者密码有错;返回登录活动记录表的id表示登录成功,返回404表示登录被限制
        if result == 0:
            return handler500(req)
        elif result == 1:  #返回1表示手机号或者密码有错
            return HttpResponse('0')
        elif result == 404:
            return render(req, 'limit.html', status=404)
        else:  #验证成功
            try:
                wei_xin_users = weiXinUser.objects.filter(
                    openid=global_from_user)
                if not wei_xin_users:  #没有通过用户OpenID和系统用户进行绑定
                    wei_xin_user = weiXinUser.objects.create(
                        openid=global_from_user, phone=user_name)  #绑定微信用户和系统用户
            except:
                return HttpResponse('0')

            return HttpResponse('1')
    else:
        return render(req, 'weixin/login.html')
Esempio n. 6
0
def login(req):
    if req.method == "POST":
        #获取表单用户名和其密码
        user_name = req.POST.get('userName', '')
        password = req.POST.get('password', '')

        mTools = Tools()
        user_ip = mTools.get_client_ip(req)  #获取用户的IP
        result = mLogin.login(user_ip, user_name, password)
        if result == 0:
            return handler500(req)
        elif result == 1:  #返回1表示手机号或者密码有错
            return HttpResponse('0')
        elif result == 404:  #登录时,错误次数超过6次,锁住IP,返回404
            return HttpResponse('2')
        else:  #验证成功
            try:
                wei_xin_users = weiXinUser.objects.filter(phone=result)
                if not wei_xin_users:  #没有通过用户OpenID和系统用户进行绑定
                    #绑定微信用户和系统用户
                    user = weiXinUser.objects.create(phone=result)
                    return HttpResponse(user.id)
                return HttpResponse('#')
            except:
                return HttpResponse('0')
    else:
        return render(req, 'weixin/login.html')
Esempio n. 7
0
def my_demand(req):
    mTools = Tools()
    user_id = mTools.getSession(req,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    brand_list = ["路虎", "法拉利", "劳斯莱斯"]
    car_series_list = ["SUV", "中规车", "越野车"]

    if req.method == 'GET':
        record_list = mMy_demands.searchMyDemands(user_id) #调用这个函数来查询我的需求
        if record_list == 0:
            return handler500(req) #查询我的需求失败

        context = {"is_login": True,
               "demand_list": record_list,
               "brand_list": brand_list,
               "car_series_list": car_series_list}
        return render(req, "myDemand.html", context)

    else:
        actionType = req.POST.get('actionType',None)
        demandId = req.POST.get('demandId',None)
        if actionType is not None:
           if actionType == '0':
               if demandId is not None:
                  return delete_demand(req, demandId) #删除我的需求
               else:
                   return HttpResponse('0')
           elif actionType == '1':
               return update_record(req, user_id) #修改我的需求
        else:
           return handler404(req)  #404 请求错误
Esempio n. 8
0
def change_password(request):
    mTools = Tools()
    current_user_phone_number = mTools.getSession(request,'current_user_phone_number')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if current_user_phone_number is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    if request.method == 'POST':
        if 'saveButton' in request.POST:
            oldPassword = request.POST.get('oldPassword', '')
            newPassword = request.POST.get('newPassword', '')
            againPassword = request.POST.get('againPassword', '')

            #
            email = request.POST.get('email', '') #邮箱
            #
            result_code = mChange_password.changePassword(current_user_phone_number,oldPassword,newPassword,email) #调用这个函数处理用户旧密码验证以及旧密码修改
            if result_code == 0:
                return handler500(request) #数据库更新出错
            elif result_code == 1:
               context = {"is_login": True,'oldpassword_is_wrong':True,'phone':current_user_phone_number}
               return render(request, "setting.html", context)
            elif result_code == 666:
               context = {"is_login": True,'phone':current_user_phone_number,'changepwd_success':True,'picture':'images/temp/5.jpg'}
               return render(request, "setting.html", context)

    else:
         context = {"is_login": True,'phone':current_user_phone_number}
         return render(request, "setting.html", context)
Esempio n. 9
0
def personal_center(req):
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'GET':
        merchant_material = mPersonal_center.getMyInfo(user_id)
        if merchant_material == 0:
            return handler500(req)  #查询失败
        elif merchant_material == 404:
            context = {"is_login": True}
            return render(req, 'to_completeMaterial.html', context)
            #return HttpResponseRedirect('/completeMaterial/')
        else:
            merchant_id = merchant_material.get('id')
            publish_info = valid_time_publish(req, merchant_id)
            exceed_publish = invalid_time_publish(req, merchant_id)
            context = {
                "is_login": True,
                'merchant_material': merchant_material,
                'publish_info': publish_info,
                'exceed_publish': exceed_publish
            }
            return render(req, 'homePage.html', context)
    else:
        return handler404(req)
Esempio n. 10
0
def index(req):
        """
        is_login: 判断用户是否已经登陆
        brand_list: 汽车品牌列表
        car_series_list: 车系
        info_total: 当天发布的车源信息记录总数
        matched_total: 找到车源的客户总数
        """
        # get请求
        if req.method == 'GET':
              publish_num = mFirst_page.getPublishNum() #返回今天发布的车的数量
              if publish_num == -1:
                  return handler500(req)
              deal_num = mFirst_page.getDealNum() #返回成交量
              if deal_num == -1:
                  return handler500(req)

              mTools = Tools()
              user_id = mTools.getSession(req, 'user_id')
              if user_id is None:
                  flag = False
                  #req.session['login_from'] = req.META.get('HTTP_REFERER', '/') #记住来源的url,如果没有则设置为首页('/')
              else:
                  flag = True

              context = {"is_login": flag,
                  "brand_list": const.brand_list,
                  "car_series_list": const.car_series_list,
                  "info_total": publish_num,
                  "matched_total": deal_num}
              return render(req, "index.html", context)
        else:
            return handler404(req)
Esempio n. 11
0
def change_phone(request):
    mTools = Tools()
    current_user_phone_number = mTools.getSession(request,'current_user_phone_number')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if current_user_phone_number is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    if request.method == 'POST':
        oldPhone = request.POST.get('oldPhoneNumber', '')
        newPhone = request.POST.get('newPhoneNumber', '')
        password = request.POST.get('password', '')
        myverifyCode = request.POST.get('verifyCode','') #获取表单的验证码

        #验证码验证
        verifyCode = mTools.getSession(request,'changePhoneVerifyCode') #获取会话的验证码
        if myverifyCode != verifyCode: #验证码不对
             return HttpResponse('0')

        result_code = mChange_phone.changePhone(oldPhone,password,newPhone) #调用这个函数处理用户旧密码验证以及旧密码修改
        if result_code == 0:
            return handler500(request) #数据库更新出错
        elif result_code == 1:
            context = {"is_login": True,'oldpassword_is_wrong':True,'phone':current_user_phone_number}
            return render(request, "setting.html", context)
        elif result_code == 666:
            context = {"is_login": True,'phone':current_user_phone_number,'success':True,'picture':'images/temp/5.jpg'}
            return render(request, "setting.html", context)

    else:
         context = {"is_login": True,'phone':current_user_phone_number}
         return render(request, "setting.html", context)
Esempio n. 12
0
def delete_message(req):
    '''
    删除我的消息
    :param req:
    :param operation_id:
    :return:
    '''
    mTools = Tools()
    current_user_phone_number = mTools.getSession(
        req,
        'phone')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if current_user_phone_number is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':
        operation_id = req.POST.get('id', None)
        result_code = mMy_message.DeleteMyMessage(operation_id)

        if result_code == 0:
            return HttpResponse("0")
            #return handler500(req) #数据库删除失败
        elif result_code == 666:
            return HttpResponse("1")
            #context = {"is_login": True}
            #return render(req, "myDemand.html", context)
    else:
        return handler404(req)  #404 请求错误
Esempio n. 13
0
def search_from_my_demand(req):
    #从‘我的需求’那里传递过来的(也就是说从记录我的需求的记录表里面获取的)
    mTools = Tools()
    user_id = mTools.getSession(req,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'GET':
        operation_id = req.GET.get('operation_id',0)
        result = mKeyword_search.getDataFromMyDemands(operation_id, user_id) #根据用户的需求的记录id和其电话号码来查询
        if result == 0:
           return handler500(req)
        else:
           condition = result

        cars_infos = mKeyword_search.OneWordGetData(condition)
        if cars_infos == 0:
            return handler500(req)
        else:
            deleteAllSession(req)
            length_cars_infos = len(cars_infos)
            req.session['search_datas'] = cars_infos
            req.session['length_search_datas'] = length_cars_infos
        return HttpResponseRedirect("/search/")
    else:
        return handler404(req)
Esempio n. 14
0
def search(req):
    """
    如果有GET请求,返回搜索结果。
    """
    if req.method == "GET":
        flag = False
        mTools=Tools()
        user_id = mTools.getSession(req,'user_id')
        if user_id is not None:
            flag = True

        final = get_result_search(req)
        data = final.get('data','')
        time_sorting_type = final.get('time_sorting_type','up')
        price_sorting_type = final.get('price_sorting_type','up')

        result_list_piece = data.get('results','')
        allPage = data.get('allPage','1') #总页数
        curPage = data.get('curPage','1')  #获取处理后的当前页数

        cars_infos_piece = mKeyword_search.getCarDataInArray(result_list_piece) #查询车的信息
        search_conditions = returnConditionsFromSession(req) #返回用户的搜索条件
        context = {"is_login": flag,
                "allPage":allPage,
                "curPage":curPage,
                "time_sorting_type":time_sorting_type,
                "price_sorting_type":price_sorting_type,
               "result_list": cars_infos_piece,
               "search_conditions":search_conditions}
        return render(req, "search.html", context)
    else:
        return handler404(req)
Esempio n. 15
0
def verify_invitation_code(req):
    if req.method == 'POST':
        #获得表单数据
        invitationCode = req.POST.get('invitationCode', '')

        mTools = Tools()
        user_ip = mTools.get_client_ip(req)  #获取用户的IP
        phones = mInvite_code.mangageInviteCode(
            invitationCode,
            user_ip)  #返回1表示邀请码过期,返回2表示邀请码不存在或者有错,返回3表示邀请码不能为空,返回404表示登录被限制
        if phones == 0:
            return handler500(req)
        elif phones == 1:  #邀请码过期
            return HttpResponse('0')
        elif phones == 2:  #邀请码不存在或者有错
            return HttpResponse('0')
        elif phones == 3:  #邀请码不能为空
            return HttpResponse('0')
        elif phones == 404:
            #return render(req, 'limit.html', status=404)
            return HttpResponse('错误次数过多,稍后重试')
        else:  #邀请码验证成功
            req.session["phones"] = phones  #建立一个会话,传递找到的符合条件的电话号码
            return HttpResponse('1')
    else:
        return handler404(req)  #404 请求错误
Esempio n. 16
0
def setting(request):
    mTools = Tools()
    user_id = mTools.getSession(request,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    context = {"is_login": True}
    return render(request, "setting.html", context)
Esempio n. 17
0
def setting_post(request):
    """
    验证输入的数据是否正确。如果正确返回1,否则返回0。
    """
    mTools = Tools()
    user_id = mTools.getSession(request,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    if request.method == "POST":
        old_password = request.POST.get("oldPassword",None)
        new_password = request.POST.get("newPassword",None)
        old_phone_number = request.POST.get("oldPhoneNumber",None)
        new_phone_number = request.POST.get("newPhoneNumber",None)
        current_password = request.POST.get("currentPassword",None)
        newPhoneNumberExist = request.POST.get("newPhoneNumberExist",None)

        # TODO:验证其中一项信息
        if old_password is not None:
           result_code = mChange_password.checkPassword(user_id, old_password)
           if result_code == 666:
              return HttpResponse("1")
           elif result_code == 0:
              return handler500(request)

        if new_password is not None:
            result_code = mChange_password.changePassword(user_id, new_password)
            if result_code == 666:
                return HttpResponse("1")

        #修改AI手机
        if current_password is not None:
           result_code = mChange_password.checkPassword(user_id, current_password)
           if result_code == 666:
            return HttpResponse("1")

        if old_phone_number is not None:
            result_code = mChange_phone.checkPhone(old_phone_number)
            if result_code == 666:
               return HttpResponse("1")

        if newPhoneNumberExist is not None:
            result_code = mChange_phone.newPhoneIsExist(newPhoneNumberExist)
            if result_code == 666: #查询到存在该手机号
               return HttpResponse("2") #该手机号已经被注册

        if new_phone_number is not None:
            result_code = mChange_phone.changePhone(user_id, new_phone_number)
            if result_code == 666:
               request.session['phone'] = new_phone_number
               return HttpResponse("1")

        return HttpResponse("0")
    else:
        return handler404(request)
Esempio n. 18
0
def verify_code_post(request, verify_code):
    mTools = Tools()
    if request.method == "POST":
        #验证码验证
        verifyCode = mTools.getSession(request,
                                       'findingByPhoneVerifyCode')  #获取会话的验证码
        if verify_code != verifyCode:  #验证码不对
            return HttpResponse('0')
        else:
            return HttpResponse("1")
    else:
        return handler404(request)  #404 请求错误
Esempio n. 19
0
def modify_demand(req,operation_id):
    mTools = Tools()
    user_id = mTools.getSession(req,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
      return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':
       record_list = mModify_demands.getRecord(operation_id, user_id) #调用这个函数来获取用户要修改的需求
       if record_list == 0:
           return handler500(req) #查询失败
       else:
          return HttpResponse('1')
    else:
        return handler404(req) #404 请求错误
Esempio n. 20
0
def save_search_record(req):
    mTools = Tools()
    if req.method == 'POST':
       user_id = mTools.getSession(req,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
       if user_id is None:
           return HttpResponseRedirect('/sessionExceedTime/')

       condition = postMethodGetParams(req) #获取post请求的用户保存的数据
       result_code = mKeyword_search.saveSearchRecord(user_id, condition) #调用这个函数来处理用户保存的需求
       if result_code == 666: #保存搜索条件成功
           return HttpResponse('1')
       elif result_code == 0:
           return HttpResponse('0')
    else:
       return handler404(req) #404 请求错误
Esempio n. 21
0
def go_back(req):
    #返回修改
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':
        publish_info = mTools.getSession(req, 'publish_info')  #从会话中取出数据
        context = {"is_login": True, 'each_car_info': publish_info}
        return render(req, "publish.html", context)
    else:
        return handler404(req)  #404 请求错误
Esempio n. 22
0
def DangagePermission(req):
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':
        if 'complete_info' in req.POST:  #完善资料
            return HttpResponseRedirect('/complete_info/')
        if 'go_car_home' in req.POST:  #返回车源列表
            return HttpResponseRedirect('/search/')
    else:
        context = {"is_login": True}
        return render(req, "permisson.html", context)
Esempio n. 23
0
def send_phone_verify_code_post(request, phone):
    # TODO:向手机号发送验证码
    mTools = Tools()
    if request.method == "POST":
        verifyCode = mSend_verify_code.getVerifyCode()

        result = mSend_verify_code.sendVerifyCode(phone, verifyCode)
        if result == True:  #成功发送验证码
            request.session[
                'findingByPhoneVerifyCode'] = verifyCode  #将验证码保存到session中
            return HttpResponse("1")
        else:  #发送验证码失败
            mTools.delSession(request, 'phoneSetPasswordByPhone')
            return HttpResponse("0")
    else:
        return handler404(request)
Esempio n. 24
0
def upload_pic(request):
    mTools = Tools()
    current_user_phone_number = mTools.getSession(request,'phone')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if current_user_phone_number is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    if request.method == 'POST':
          form = ImageUploadForm(request.POST, request.FILES )  # 有文件上传要传如两个字段
          if form.is_valid():
              result_code = mSet_head_icon.setHeadIcon(current_user_phone_number,form.cleaned_data['image'])
              if result_code == 666:
                 return HttpResponse('image upload success')
              else:
                  return HttpResponse('image upload fail')
    else:
         context = {"is_login": True}
         return render(request, "setHeadIcon2.html", context)
Esempio n. 25
0
def verify_code_post(request):
    mTools = Tools()
    user_id = mTools.getSession(request,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    if request.method == "POST":
        verify_code = request.POST.get("verifyCode",None)

        #验证码验证
        verifyCode = mTools.getSession(request,'changePhoneVerifyCode') #获取会话的验证码
        if verify_code != verifyCode: #验证码不对
             return HttpResponse('0')
        else:
            return HttpResponse("1")
    else:
        return handler404(request)  #404 请求错误
Esempio n. 26
0
def collection_post(req):
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':
        merchantId = req.POST.get('merchantId', None)
        detailId = req.POST.get('detailId', None)
        if merchantId is not None:
            return cancel_seller_collection(req, merchantId)
        if detailId is not None:
            return cancel_car_collection(req, detailId)
        return handler404(req)  #404 请求错误
    else:
        return handler404(req)  #404 请求错误
Esempio n. 27
0
def set_head_icon(req):
    mTools = Tools()
    user_id = mTools.getSession(req,'user_id')#调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
       return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':#确定
        try:
            head_icon_path = mTools.upload_icon(req,user_id,'file_icon') #保存头像照片
            result_code = mSet_head_icon.setHeadIcon(user_id,head_icon_path) #调用这个函数来处理用户上传头像
            if result_code == 0:
                return handler500(req) #数据库更新出错
            elif result_code == 666:
                return HttpResponse("1")
        except:
            return HttpResponse("上传头像照片出错")
    else: # get 请求
         return render(req, "setHeadIcon.html")
Esempio n. 28
0
def detail_post(req):
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'POST':
        merchant_id = req.POST.get("merchantId", None)
        detail_id = req.POST.get("infoId", None)
        #print(merchant_id)
        #print(detail_id)
        if merchant_id is not None:
            return seller_collection(user_id, merchant_id)
        if detail_id is not None:
            return car_collection(user_id, detail_id)
    else:
        return handler404(req)
Esempio n. 29
0
def list_again_publish(req, operation_id):
    #过期 --- 重新发布
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'GET':
        modify_info = mPublish_car.againPublish(
            operation_id)  #调用这个函数来获取重新发布的信息
        if modify_info == 0:
            return handler500(req)  #修改有效期的车失败
        car_info = mPublish_car.getPublishInfo(user_id,
                                               modify_info)  #存储和获取发布的车的信息
        req.session['operation_id_againPublish'] = operation_id
        context = {"is_login": True, 'car_info': car_info}
        return render(req, "publish.html", context)
    else:
        return handler404(req)  #404 请求错误
Esempio n. 30
0
def collect_seller(req):
    mTools = Tools()
    user_id = mTools.getSession(
        req,
        'user_id')  #调用account.account_manage模块的类Tools的getSession()函数来获取当前会话的id
    if user_id is None:
        return HttpResponseRedirect('/sessionExceedTime/')

    if req.method == 'GET':
        mycollect_records = mCollect_seller.searchCollectSeller(
            user_id)  #调用这个函数来查询收藏的商家
        if mycollect_records == 0:
            return handler500(req)  #查询失败
        list_content = mCollect_seller.getInFo(
            mycollect_records)  #调用这个函数来处理用户的收藏的商家的信息
        if list_content == 0:
            return handler500(req)  #查询失败

        context = {"is_login": True, 'list_content': list_content}
        return render(req, "collection.html", context)
    else:
        return handler404(req)  #404 请求错误