You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
6.3 KiB
101 lines
6.3 KiB
# -*-coding:utf-8-*- |
|
__author__ = 'Emily' |
|
|
|
import re |
|
import random |
|
import pymysql |
|
import string |
|
from suds.client import Client |
|
|
|
# 生成webservices客户端 |
|
url = 'http://192.168.55.99/webservice/?wsdl' |
|
# 根据wsdl创建一个WebService的client |
|
myClient = Client(url) |
|
|
|
# 获取场次 |
|
dbcon = pymysql.connect(host='192.168.55.97', |
|
port=3306, user='dbadmin', |
|
passwd='fXMSR37mLP7w88ji', |
|
db='cine', charset="utf8", |
|
cursorclass=pymysql.cursors.DictCursor) |
|
# 使用cursor来获取游标 |
|
cursor = dbcon.cursor(pymysql.cursors.DictCursor) |
|
sql1 = "SELECT cinema_movie_show_start_date,cinema_movie_show_start_time,cinema_hall_id,cinema_movie_id FROM cinema_movie_show WHERE cinema_movie_show_start_date >= CURTIME() AND cinema_del_flag = 1" |
|
cursor.execute(sql1) |
|
result = cursor.fetchall() |
|
data = result[random.randint(0, len(result))] |
|
# print(data) |
|
dbcon.close() |
|
ShowDate = data['cinema_movie_show_start_date'] |
|
FilmId = data["cinema_movie_id"] |
|
StartTime = data['cinema_movie_show_start_time'] |
|
HallId = data['cinema_hall_id'] |
|
# print(ShowTime) |
|
# 将data类型转换为string类型,http://www.jb51.net/article/112913.htm |
|
# HourTime = StartTime.strftime('%Y-%m-%d %H:%M:%S') |
|
ShowTime = StartTime.strftime('%H%M') |
|
# print(ShowTime) |
|
|
|
|
|
# 获取座位 |
|
seat1 = random.choice("1234567") + ":" + random.choice("1234567") |
|
seat2 = random.choice("1234567") + ":" + random.choice("1234567") |
|
|
|
if seat1 == seat2: |
|
print("座位重复,重新选择") |
|
else: |
|
lockSeatsResult = myClient.service.lockSeats("TUOWEI", "668CBE9A6BCF4ABB", "100005", ShowDate, FilmId, ShowTime, |
|
HallId, "1", |
|
"", 2, seat1 + '|' + seat2, "|||", "QPJ", "20") |
|
print("锁座完成,得到锁座码", lockSeatsResult) |
|
print(seat1, seat2) |
|
|
|
tempBookingId = re.search(r'\<tempBookingId\>(.*)\</tempBookingId\>', lockSeatsResult, re.I | re.M | re.S).group(1) |
|
|
|
print(tempBookingId) |
|
thirdOrderNum_list = [] |
|
for x in range(10): |
|
thirdOrderNum_list.append(random.choice(string.digits)) |
|
thirdOrderNum = str(''.join(thirdOrderNum_list)) |
|
print("thirdOrderNum", thirdOrderNum) |
|
|
|
# 购票 使用一种支付方式支付影票+服务费 |
|
# TickestNum = myClient.service.setBuyingTicketsForDq("TUOWEI","668CBE9A6BCF4ABB",tempBookingId+'|||'+thirdOrderNum,"100005",ShowDate, |
|
# FilmId,ShowTime,HallId,"1","",seat1+'|'+seat2,"@@CP0000000533|CP0000000533|CP0000000533@万达-网购票|万达-网购票|万达-网购票", |
|
# '25.0+|+25.0',"0","8801031100000005","66644000279780",'TAOBAO|WDTX',"",'25+|+25',"","","0","",'1.1|1.1',"wechat-1.1-201910171758-20190129077|WDTX-1.1-201910291759-20180129881", |
|
# "1_2","","","0","E16000000040000016","0","0","0","0.0","T") |
|
# print("TickestNum",TickestNum) |
|
|
|
# TickestNum = myClient.service.setBuyingTickets("TUOWEI","668CBE9A6BCF4ABB",tempBookingId +'|||' +thirdOrderNum,"100005",ShowDate, |
|
# FilmId,ShowTime,HallId,"1","",seat1+'|'+seat2,"网购票|网购票", |
|
# "25.0|25.0","0"," |
|
# ","66644000279780","MEMBERCARD|wechat","","25|25","","","0","","1|1","MEMBERCARD:1|MEMBERCARD:1", |
|
# "1_2","","","0","E16000000040000016","0","0","0","10","T") |
|
# print("TickestNum",TickestNum) |
|
|
|
# 使用一种方式支付影票,另一种第三方支付方式支付服务费 |
|
# 使用一种方式支付影票,2种支付方式支付服务费,同时一种为第三方支付方式 |
|
|
|
# TicketsNum = myClient.service.setBuyingTicketsForDq("TUOWEI","668CBE9A6BCF4ABB",tempBookingId+'|||'+thirdOrderNum,"849",ShowDate, |
|
# FilmId,ShowTime,HallId,"1","",seat1+'|'+seat2,"@@CP0000000533|CP0000000533|CP0000000533@万达-网购票|万达-网购票|万达-网购票", |
|
# '25.0+|+25.0',"0","8801031100000005","66644000279888",'MEMBERCARD|MEMBERCARD',"",'25+|+25',"","","0","",'1.1|1.1',"wechat-1.1-201801301034-20180130001|MEMBERCARD-0.5,wechat-0.6-201801301035-20180130002", |
|
# "1_2","","","0","E16000000040000016","0","0","0","5","T") |
|
# print("TickestNum",TicketsNum) |
|
|
|
TicketNum = myClient.service.setBuyingTicketsForDq("TUOWEI", "668CBE9A6BCF4ABB", tempBookingId + '|||' + thirdOrderNum, |
|
"100005", ShowDate, FilmId, ShowTime, HallId, '', '', |
|
seat1 + '|' + seat2, "兑换券-齐志-0608|兑换券-齐志-0608", '200.0|200.0', |
|
'##', '8801031100000005', '66644000787003', |
|
'MEMBERCARD##dzm::6020200115001142$兑换券-齐志-0608$影城自发$T$2022-07-14$赵亚佩$院线$100.00@@5320200715002455$兑换券-齐志-0608$影城>自发$T$2022-07-14$赵亚佩$院线$100.00|MEMBERCARD##dzm::6015528121515186142$兑换券-齐志-0608$影城自发$T$2022-07-14$赵亚佩$院线$100.00@@5363623171697640455$兑换券-齐志-0608$影城>自发$T$2022-07-14$赵亚佩$院线$100.00', |
|
'M', '0.00##100.00@@100.00|0.00##100.00@@100.00', '', '', '', '', |
|
'10.0|10.0', |
|
'MEMBERCARD-10.00|MEMBERCARD-10.00', "1_2", '', 'N', '1', |
|
'E100005000000040611500', '', '', '', '0.5|0.6', |
|
'dzm-0.30-35567344-2020-区域,dzm-0.20-35567434-2020-院线|dzm-0.30-35567344-2020-院线,bank-0.3', |
|
'', '', '0', 'M', '8801031100000005', '0|0', '0.0|0.0', '0.0|0.0', |
|
'YSF-210.5-20-0-0.3,YSF-210.6-20-0-0.3') |
|
print("TicketNum:", TicketNum) |
|
|
|
# 退票 |
|
# refundBooking = myClient.service.refundBooking("TUOWEI","668CBE9A6BCF4ABB","|||mx2020022691","100005","1_2","2:1:0.00|2:2:0.00","1000000003011279") |
|
# print("refundBooking:",refundBooking)
|
|
|