parent
8a442be939
commit
e327669ade
7 changed files with 75 additions and 7 deletions
@ -0,0 +1,18 @@ |
|||||||
|
# Generated by Django 4.2.7 on 2024-01-02 01:16 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('mock', '0003_rename_auditsessioncode_zzmockmodel_auditshowid'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AddField( |
||||||
|
model_name='zzmockmodel', |
||||||
|
name='errorCode', |
||||||
|
field=models.CharField(help_text='清洗错误接口返回的错误状态', max_length=5, null=True, verbose_name='清洗错误接口返回的错误状态'), |
||||||
|
), |
||||||
|
] |
@ -1,3 +1,31 @@ |
|||||||
def get(): |
import json |
||||||
|
import datetime |
||||||
|
from mock.models import ZZMockModel |
||||||
|
|
||||||
|
|
||||||
|
def get_json(): |
||||||
|
return {'message': '操作成功', 'data': [], 'code': '200', 'status': 'success'} |
||||||
|
|
||||||
|
|
||||||
|
def get(cinema_data, request): |
||||||
|
error_code_config = ZZMockModel.objects.filter(ip=cinema_data.ip).first() |
||||||
|
error_code = error_code_config.errorCode |
||||||
|
print(request.POST) |
||||||
|
data = json.loads(request.POST['queries']) |
||||||
|
if error_code == '0': |
||||||
mock_data = {'message': '操作成功', 'data': [], 'code': '200', 'status': 'success'} |
mock_data = {'message': '操作成功', 'data': [], 'code': '200', 'status': 'success'} |
||||||
|
else: |
||||||
|
data_list = [] |
||||||
|
for ticket in data: |
||||||
|
date_time = datetime.datetime.strptime(ticket['sessionDatetime'], '%Y-%m-%d %H:%M:%S') |
||||||
|
date = datetime.datetime.strftime(date_time, '%Y-%m-%d') |
||||||
|
data_list.append( |
||||||
|
{ |
||||||
|
'businessDate': date, |
||||||
|
'sendChannelCode': '96201703', |
||||||
|
'ticketNo': ticket['ticketNo'], |
||||||
|
'errorType': error_code |
||||||
|
} |
||||||
|
) |
||||||
|
mock_data = {'message': '操作成功', 'data': data_list, 'code': '200', 'status': 'success'} |
||||||
return mock_data |
return mock_data |
||||||
|
Loading…
Reference in new issue