OxoOrderSource.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. /*
  3. * Copyright (c) 2008-2016 vip.com, All Rights Reserved.
  4. *
  5. * Powered by com.vip.osp.osp-idlc-2.5.11.
  6. *
  7. */
  8. namespace vipapis\order;
  9. class OxoOrderSource {
  10. static $_TSPEC;
  11. public $province = null;
  12. public $province_code = null;
  13. public function __construct($vals=null){
  14. if (!isset(self::$_TSPEC)){
  15. self::$_TSPEC = array(
  16. 1 => array(
  17. 'var' => 'province'
  18. ),
  19. 2 => array(
  20. 'var' => 'province_code'
  21. ),
  22. );
  23. }
  24. if (is_array($vals)){
  25. if (isset($vals['province'])){
  26. $this->province = $vals['province'];
  27. }
  28. if (isset($vals['province_code'])){
  29. $this->province_code = $vals['province_code'];
  30. }
  31. }
  32. }
  33. public function getName(){
  34. return 'OxoOrderSource';
  35. }
  36. public function read($input){
  37. $input->readStructBegin();
  38. while(true){
  39. $schemeField = $input->readFieldBegin();
  40. if ($schemeField == null) break;
  41. $needSkip = true;
  42. if ("province" == $schemeField){
  43. $needSkip = false;
  44. $input->readString($this->province);
  45. }
  46. if ("province_code" == $schemeField){
  47. $needSkip = false;
  48. $input->readString($this->province_code);
  49. }
  50. if($needSkip){
  51. \Osp\Protocol\ProtocolUtil::skip($input);
  52. }
  53. $input->readFieldEnd();
  54. }
  55. $input->readStructEnd();
  56. }
  57. public function write($output){
  58. $xfer = 0;
  59. $xfer += $output->writeStructBegin();
  60. if($this->province !== null) {
  61. $xfer += $output->writeFieldBegin('province');
  62. $xfer += $output->writeString($this->province);
  63. $xfer += $output->writeFieldEnd();
  64. }
  65. if($this->province_code !== null) {
  66. $xfer += $output->writeFieldBegin('province_code');
  67. $xfer += $output->writeString($this->province_code);
  68. $xfer += $output->writeFieldEnd();
  69. }
  70. $xfer += $output->writeFieldStop();
  71. $xfer += $output->writeStructEnd();
  72. return $xfer;
  73. }
  74. }
  75. ?>