zoukankan      html  css  js  c++  java
  • pay包注释(二)

    @login_required()
    def to_register(request):
        return render_to_response("pay/register_yeepay.html", context_instance=RequestContext(request))

    // 意思简单,就不说了。

    打开页面需要填写的表单如下:

    此页面使用ajax方式提交:

    以上数据被传至process_register处理

    @csrf_exempt
    @login_required()
    def process_register(request):
        # TODO 参数判断
        nick_name = request.POST['nickName']
        real_name = request.POST['realName']
        id_card_type = request.POST['idCardType']
        id_card_no = request.POST['idCardNo']
        mobile = request.POST['mobile']
        email = request.POST['email']
        platform_user_no = UserDetail.objects.get(user=request.user).platform_user_no

      /*  由此句推知,paltform_user_no是在注册时候已经生成了,我们看注册函数

       *  new_user_detail.platform_user_no = random_str(),其中random_str()

       *      

       *  其中random.randint(0,length),在0~length中随机取一个整数,包括length。

       */
        # TODO 权限判断

        yeepay_account = YeepayAccount.objects.get(platform_user_no=platform_user_no)
        yeepay_account.nickname = nick_name
        yeepay_account.real_name = real_name
        yeepay_account.idcard_type = id_card_type
        yeepay_account.idcard_no = id_card_no
        yeepay_account.save()

        # 构造返回参数
        ret_xml, sign, to_url = register(nick_name=nick_name, real_name=real_name, id_card_type=id_card_type,
                                         id_card_no=id_card_no, mobile=mobile, email=email,
                                         platform_user_number=platform_user_no)

     /*调用了register函数,该函数如下:

       

      * 其中sign是签名

      * to_url是易宝注册地址。

      */
        return json_response(True, "0", "success", {"req": ret_xml, 'sign': sign, 'to_url': to_url})

      //返回json数据

    成功后易宝回返回callback或者notify,根据返回的类型选择合适的函数。

     

    import xml.etree.ElementTree as ET

    一个完整的例子就如上。

  • 相关阅读:
    渗透测试靶场
    Ubuntu kylin优麒麟下配置Hadoop环境
    虚拟机win+IIs+asp+access搭建网站过程
    百度增强搜索
    渗透入门——术语概述
    api如何获取cookie
    还在纠结接口文档的事儿呢?
    为什么需要API管理平台
    自动生成接口文档的三种方式
    轻量化API测试工具整理
  • 原文地址:https://www.cnblogs.com/tuifeideyouran/p/3915919.html
Copyright © 2011-2022 走看看