|
@@ -80,11 +80,11 @@ def open_servicerequest_booked_process(localtask):
|
|
|
else:
|
|
|
# Проверка срочности заказа
|
|
|
if True:
|
|
|
-
|
|
|
- #Назначение исполнителя системой
|
|
|
-
|
|
|
- bot.proceed_status(proceed_to[0], localtask)
|
|
|
- pass
|
|
|
+ #Заглушка назначение исполнителя системой
|
|
|
+ if set_provider(order.client_id, order.provider) == "success":
|
|
|
+ bot.proceed_status(proceed_to[0], localtask)
|
|
|
+ else:
|
|
|
+ bot.bot_log(botname+" "+str(datetime.now())+" "+"Ошибка назначения исполнителя\n")
|
|
|
else:
|
|
|
bot.proceed_status(proceed_to[1], localtask)
|
|
|
|
|
@@ -96,7 +96,7 @@ def open_servicerequest_booked_process(localtask):
|
|
|
def get_balance(client):
|
|
|
headers = {'Authorization': f'Token {token}'}
|
|
|
# Передаем id пользователя и получаем его баланс
|
|
|
- response = requests.get(config.API_URL+f"/api/exaple/{client}", headers=headers)
|
|
|
+ response = requests.get(config.API_URL+f"/api/example/{client}", headers=headers)
|
|
|
print(response.json())
|
|
|
ordertext=response.json()
|
|
|
|
|
@@ -110,6 +110,23 @@ def get_balance(client):
|
|
|
except Exception as ex:
|
|
|
print(ex)
|
|
|
|
|
|
+def set_provider(client, provider):
|
|
|
+ headers = {'Authorization': f'Token {token}'}
|
|
|
+ data = {'client': client,
|
|
|
+ 'provider': provider}
|
|
|
+ response = requests.post(config.API_URL+f"/api/example/set-provider", headers=headers, data=data)
|
|
|
+ print(response.json())
|
|
|
+ ordertext=response.json()
|
|
|
+
|
|
|
+ if not ordertext:
|
|
|
+ print("Empty array")
|
|
|
+ else:
|
|
|
+ print(ordertext[0], "PROCESSING")
|
|
|
+ try:
|
|
|
+ message = ordertext[0].get('message')
|
|
|
+ return message
|
|
|
+ except Exception as ex:
|
|
|
+ print(ex)
|
|
|
def open_servicerequest_booked():
|
|
|
while (len(tasklist)):
|
|
|
localtask=tasklist.pop(0)
|