OrderRelationTest.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from airasia.OrderRelationEntity import OrderRelationEntity,PassengerEntity;
  2. import json
  3. from airasia.OrderRelation import OrderRelation;
  4. passengerEntity = PassengerEntity();
  5. passengerEntity.bigNo = "7800214292"
  6. passengerEntity.birthday = "1965-07-18";
  7. passengerEntity.firstName="WENTING";
  8. passengerEntity.lastName = "ZHANG";
  9. orderRelationEntity = OrderRelationEntity();
  10. orderRelationEntity.passengers =passengerEntity;
  11. orderRelationEntity.orderNo = "c";
  12. orderRelationEntity.singleAccount= "CNTRIPTOPK_ADMIN";
  13. orderRelationEntity.singleAccountPassWord = "Tripto123";
  14. # #将对象转换为字典
  15. # orderRelationEntityDict = orderRelationEntity.__dict__;
  16. # print(orderRelationEntityDict);
  17. # #将字段转换为json
  18. orderRelationEntityJson = json.dumps(orderRelationEntity,default=lambda o: o.__dict__, sort_keys=True, indent=4);
  19. print(orderRelationEntityJson)
  20. # orderRelation = OrderRelation(orderRelationEntityJson);
  21. # orderRelation.worker();
  22. # orderRelationEntityDict = json.loads(orderRelationEntityJson);
  23. # print(orderRelationEntityDict)
  24. #
  25. #
  26. # orderRelationEntity2 = OrderRelationEntity();
  27. # orderRelationEntity2.__dict__ = orderRelationEntityDict;
  28. # print(orderRelationEntity2.passengers)