Kaynağa Gözat

JSON template updated

Dev Server 1 yıl önce
ebeveyn
işleme
b08f8347dd
2 değiştirilmiş dosya ile 18 ekleme ve 49 silme
  1. 18 46
      jsonAndRequest.py
  2. 0 3
      open_template_bot.py

+ 18 - 46
jsonAndRequest.py

@@ -4,19 +4,27 @@ import config
 import ast
 
 #Тестовый класс User и Address (ВАЖНО!!!) поля классов должны называться также как и поля json объекта
-
-#Full json order example
 '''
+#Full json order example
+https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
+
 {
 
 "ticket": 123,
-"state": 111,
+"status": 111,
+
+"priority": 1, 
+"title": "123",
+"note": "123",
+"due_date": 2023-05-15T17:16:22.955601Z,
+
 "id_metaservice": 1,
 "is_global": false,
 "is_visible": false,
 "service": 1,
 "service_type": 1,
 
+"status_changed_date": "2023-05-15T17:16:22.955601Z",
 "time_placed": "2023-05-15T16:40:32.179777Z",
 "time_start": "2023-05-15T16:40:32.179777Z",
 "time_start_predicted": "2023-05-15T16:40:32.179777Z",
@@ -24,12 +32,15 @@ import ast
 "time_start_real": "2023-05-15T16:40:32.179777Z",
 "time_finish_real": "2023-05-15T16:40:32.179777Z",
 
+"order_place_type": "address",
 "order_place_start": "р-н Беговой",
 "order_place_start_gps": "55.751941, 37.607513",
+"order_place_start_sector": 4,
 "order_place_start_real": "р-н Беговой",
 "order_place_start_real_gps": "55.751941, 37.607513",
 "order_place_finish_predicted": "р-н Мещанский",
 "order_place_finish_predicted_gps": "55.751941, 37.607513",
+"order_place_finish_sector": 4,
 "order_place_finish_real": "р-н Мещанский",
 "order_place_finish_real_gps": "55.751941, 37.607513",
 
@@ -43,52 +54,13 @@ import ast
 "receiver": 1,
 "receiver_screen_name": "Marfa Clientovna",
 "client_id": 1,
-"resource_id": 1
-}
-'''
-
-#minimal acceptable as order json example
-
-'''
-{
-"ticket": 123,
-"state": 111,
-"id_metaservice": 1,
-"is_global": false,
-"is_visible": false,
-"service": 1,
-"service_type": 1,
-
-"time_placed": "2023-05-15T16:40:32.179777Z",
-"time_start": null,
-"time_start_predicted": null,
-"time_finish_predicted": null,
-"time_start_real": null,
-"time_finish_real": null,
-
-"order_place_start": null,
-"order_place_start_gps": null,
-"order_place_start_real": null,
-"order_place_start_real_gps": null,
-"order_place_finish_predicted": null,
-"order_place_finish_predicted_gps": null,
-"order_place_finish_real": null,
-"order_place_finish_real_gps": null,
-
-"predicted_price": null,
-"real_price": null,
-"payment_transaction_id": null,
-"rating_id": null,
-
-"provider": null,
-"provider_screen_name": null,
-"receiver": null,
-"receiver_screen_name": null,
-"client_id": null,
-"resource_id": null
+"client_screen_name": "Fedor Client",
+"resource_id": 1,
+"attempts": null
 }
 '''
 
+#надо адаптировать класс к новому формату JSON
 class Order(object):
     def __init__(self, ticket, state, id_metaservice, is_global, is_visible, service, service_type, time_placed, time_start=None, time_start_predicted=None, time_finish_predicted=None, time_start_real=None, time_finish_real=None, order_place_start=None, order_place_start_gps=None, order_place_start_real=None, order_place_start_real_gps=None, order_place_finish_predicted=None, order_place_finish_predicted_gps=None, order_place_finish_real=None, order_place_finish_real_gps=None, predicted_price=None, real_price=None, payment_transaction_id=None, rating_id=None, provider=None, provider_screen_name=None, receiver=None, receiver_screen_name=None, client_id=None, resource_id=None):
         self.ticket = ticket

+ 0 - 3
open_template_bot.py

@@ -110,13 +110,10 @@ tasklist = []
 
 #надо инициализировать tasklist при запуске из API
 token = jsreq.requestGetToken(botname, PASSWORD, config.API_URL+"/auth/token/login/")
-#requestGetList(token, API_URL+"/tickets/api/tickets")
 
 #ВАЖНО! Надо еще фильтровать список по статусу обработки заявки
 tasklist=jsreq.requestGetList(token, config.API_URL+"/tickets/api/tickets/?list_id=10")
 #tasklist=jsreq.requestGetList(token, config.API_URL+"/tickets/api/tickets")
-#надо дописать таким образом, чтобы tasklist пополнялся тикетами определенного листа, а не всех
-#print ("TASKLIST ", tasklist)
 print (len(tasklist))