python django 簡單介面測試平台

2022-08-21 10:15:09 字數 4764 閱讀 4266

專案建立訂單只能是介面建立的,之前都是用jar包放到jmeter裡呼叫下單,給產品、運維、運營用不太方便,就想用django寫乙個帶前端介面的下單web程式

專案結構

**,比較渣

#

coding=utf-8

from django.shortcuts import

render

from config import

read_yaml

from functions.ams_create_order import

amsfrom functions.jz_create_order import

jzfrom functions.sg_create_order import

sgfrom functions.tog_create_order import

togfrom functions.xy_create_order import

xyfrom functions.yzf_create_order import

yzffrom functions.zb_create_order import

zb

if request.method == '

post':

#獲取平台型別

platform_type = request.post.get('

platform')

#獲取支付方式型別

payway = request.post.get('

pay'

) amount = request.post.get('

money')

thread = int(request.post.get('

thread'))

try:

if platform_type == 'jz'

:

for i in

range(thread):

req_str =jz(jz_id, payway, amount,jz_secret, jz_url)

if platform_type == '

yzf'

:

for i in

range(thread):

req_str =yzf(yzf_id, payway, amount,yzf_secret, yzf_url)

if platform_type == 'xy'

:

for i in

range(thread):

req_str =xy(xy_id, payway, amount,xy_secret, xy_url)

if platform_type == 'zb'

:

for i in

range(thread):

req_str =zb(zb_id, payway, amount,zb_secret, zb_url)

if platform_type == '

ams'

:

for i in

range(thread):

req_str =ams(ams_id, payway, amount, ams_secret, ams_url)

if platform_type == '

tog'

:

for i in

range(thread):

req_str =tog(tog_id, payway, amount, tog_secret, tog_url)

if platform_type == 'sg'

:

for i in

range(thread):

req_str =sg(sg_id, payway, amount, sg_secret, sg_url)

except

baseexception as msg:

pass

return render(request, '

index.html

', locals())

前端**

doctype html

>

<

html

lang

="en"

>

<

head

>

<

meta

charset

="utf-8"

>

<

title

>下單

title

>

head

>

<

body

style

="background-image: url();background-size:100% 133.5%;"

>

<

h1>

000玩家充值下單:

h1>

<

form

method

="post"

>

下單平台:

<

select

style

="height: 30px; width: 70px;"

name

="platform"

>

000<

option

value

="jz"

>測試

option

>

<

option

value

="zb"

>測試

option

>

<

option

value

="ams"

>測試

option

>

<

option

value

="xy"

>測試

option

>

<

option

value

="yzf"

>測試

option

>

<

option

value

="tog"

>測試

option

>

<

option

value

="sg"

>測試

option

>

select

>

下單支付型別:

<

select

style

="width: 150px; height: 30px;"

name

="pay"

>

000<

option

value

="alipay"

>支付寶

option

>

<

option

value

="wechatpay"

option

>

select

>

下單金額:

<

input

type

="text"

value

="200"

style

="width: 50px; height: 25px;"

name

="money"

/>

下單個數:

<

input

type

="text"

value

="1"

style

="width: 50px; height: 25px;"

name

="thread"

/>

<

input

type

="submit"

style

="width: 90px; height: 30px"

value

="提交下單"

/>

form

>

<

h1>下單返回結果:

h1>

<

textarea

readonly

="value"

type

="text"

style

="width: 940px; height: 100px; font-size:16px; color: blueviolet;"

id=""

>}

textarea

>

body

>

html

>

介面

python Django的簡單應用

建立django工程 django admin.py startproject yourprojectname 關係 工程下有多個應用。django的工作模式mtv模式 m 模型 model 負責業務物件和資料庫的關係對映 orm t 模板 template 負責如何把頁面展示給使用者 html v...

winform webform 簡單高效的介面框架

2019年01月07日 10 40 18 james lx 閱讀數 4961 一 winform的介面框架設計 james lx 一直以來,我都在尋找winform程式,簡單高效的介面框架,終於,我有了乙個。在此分享給和我一樣使用c 而苦於介面設計的人。我的發現中,並沒有加入什麼框架和 只是使用原生...

python Django安裝教程

2.解壓到桌面 3 開啟cmd cd到這個目錄執行 python setup.py install命令即可安裝,安裝成功提示 installed d python27 lib site packages pytz 2018.5 py2.7.egg finished processing depend...