-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_templates.py
51 lines (46 loc) · 1.2 KB
/
message_templates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
THANKS_MSG = {
'type': 'response',
'result': 'thanks',
'msg': None
}
PLEASE_LOGIN_MSG = {
'type': 'response',
'result': 'error',
'msg': 'Please login first.'
}
def ERROR_RESPONSE(error):
return {
'type': 'response',
'result': 'error',
'msg': error
}
def REQUEST_MSG(request):
return {
'type': 'request',
'request': {
'request_id': request['request_id'],
'k_passengers': request['k_passengers'],
'expected_price': request['expected_price'],
'from_port': request['from_port'],
'to_port': request['to_port'],
}
}
def WINNING_BID_RESULT(request, bid, time_expected):
return {
'type': 'bid_result',
'result': 'win',
'request_id': request['request_id'],
'task': {
'k_passengers': request['k_passengers'],
'time_expected': time_expected,
'price': bid['price'],
'from_port': request['from_port'],
'to_port': request['to_port'],
}
}
def LOSING_BID_RESULT(request):
return {
'type': 'bid_result',
'result': 'lose',
'request_id': request['request_id']
}