| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 |
- <?php
- /*
- * Copyright (c) 2008-2016 vip.com, All Rights Reserved.
- *
- * Powered by com.vip.osp.osp-idlc-2.5.11.
- *
- */
- namespace vipapis\delivery;
- class OrderDetail {
-
- static $_TSPEC;
- public $order_id = null;
- public $barcode = null;
- public $amount = null;
- public $price = null;
- public $brand_id = null;
- public $promotions = null;
- public $failed_promotions = null;
- public $date = null;
- public $actual_market_price = null;
-
- public function __construct($vals=null){
-
- if (!isset(self::$_TSPEC)){
-
- self::$_TSPEC = array(
- 1 => array(
- 'var' => 'order_id'
- ),
- 2 => array(
- 'var' => 'barcode'
- ),
- 3 => array(
- 'var' => 'amount'
- ),
- 4 => array(
- 'var' => 'price'
- ),
- 5 => array(
- 'var' => 'brand_id'
- ),
- 6 => array(
- 'var' => 'promotions'
- ),
- 8 => array(
- 'var' => 'failed_promotions'
- ),
- 9 => array(
- 'var' => 'date'
- ),
- 10 => array(
- 'var' => 'actual_market_price'
- ),
-
- );
-
- }
-
- if (is_array($vals)){
-
-
- if (isset($vals['order_id'])){
-
- $this->order_id = $vals['order_id'];
- }
-
-
- if (isset($vals['barcode'])){
-
- $this->barcode = $vals['barcode'];
- }
-
-
- if (isset($vals['amount'])){
-
- $this->amount = $vals['amount'];
- }
-
-
- if (isset($vals['price'])){
-
- $this->price = $vals['price'];
- }
-
-
- if (isset($vals['brand_id'])){
-
- $this->brand_id = $vals['brand_id'];
- }
-
-
- if (isset($vals['promotions'])){
-
- $this->promotions = $vals['promotions'];
- }
-
-
- if (isset($vals['failed_promotions'])){
-
- $this->failed_promotions = $vals['failed_promotions'];
- }
-
-
- if (isset($vals['date'])){
-
- $this->date = $vals['date'];
- }
-
-
- if (isset($vals['actual_market_price'])){
-
- $this->actual_market_price = $vals['actual_market_price'];
- }
-
-
- }
-
- }
-
-
- public function getName(){
-
- return 'OrderDetail';
- }
-
- public function read($input){
-
- $input->readStructBegin();
- while(true){
-
- $schemeField = $input->readFieldBegin();
- if ($schemeField == null) break;
- $needSkip = true;
-
-
- if ("order_id" == $schemeField){
-
- $needSkip = false;
- $input->readString($this->order_id);
-
- }
-
-
-
-
- if ("barcode" == $schemeField){
-
- $needSkip = false;
- $input->readString($this->barcode);
-
- }
-
-
-
-
- if ("amount" == $schemeField){
-
- $needSkip = false;
- $input->readI32($this->amount);
-
- }
-
-
-
-
- if ("price" == $schemeField){
-
- $needSkip = false;
- $input->readDouble($this->price);
-
- }
-
-
-
-
- if ("brand_id" == $schemeField){
-
- $needSkip = false;
- $input->readString($this->brand_id);
-
- }
-
-
-
-
- if ("promotions" == $schemeField){
-
- $needSkip = false;
-
- $this->promotions = array();
- $_size0 = 0;
- $input->readListBegin();
- while(true){
-
- try{
-
- $elem0 = null;
-
- $elem0 = new \vipapis\delivery\PromotionInfo();
- $elem0->read($input);
-
- $this->promotions[$_size0++] = $elem0;
- }
- catch(\Exception $e){
-
- break;
- }
- }
-
- $input->readListEnd();
-
- }
-
-
-
-
- if ("failed_promotions" == $schemeField){
-
- $needSkip = false;
-
- $this->failed_promotions = array();
- $_size1 = 0;
- $input->readListBegin();
- while(true){
-
- try{
-
- $elem1 = null;
-
- $elem1 = new \vipapis\delivery\FailedPromotionInfo();
- $elem1->read($input);
-
- $this->failed_promotions[$_size1++] = $elem1;
- }
- catch(\Exception $e){
-
- break;
- }
- }
-
- $input->readListEnd();
-
- }
-
-
-
-
- if ("date" == $schemeField){
-
- $needSkip = false;
- $input->readString($this->date);
-
- }
-
-
-
-
- if ("actual_market_price" == $schemeField){
-
- $needSkip = false;
- $input->readDouble($this->actual_market_price);
-
- }
-
-
-
- if($needSkip){
-
- \Osp\Protocol\ProtocolUtil::skip($input);
- }
-
- $input->readFieldEnd();
- }
-
- $input->readStructEnd();
-
-
-
- }
-
- public function write($output){
-
- $xfer = 0;
- $xfer += $output->writeStructBegin();
-
- if($this->order_id !== null) {
-
- $xfer += $output->writeFieldBegin('order_id');
- $xfer += $output->writeString($this->order_id);
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->barcode !== null) {
-
- $xfer += $output->writeFieldBegin('barcode');
- $xfer += $output->writeString($this->barcode);
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->amount !== null) {
-
- $xfer += $output->writeFieldBegin('amount');
- $xfer += $output->writeI32($this->amount);
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->price !== null) {
-
- $xfer += $output->writeFieldBegin('price');
- $xfer += $output->writeDouble($this->price);
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->brand_id !== null) {
-
- $xfer += $output->writeFieldBegin('brand_id');
- $xfer += $output->writeString($this->brand_id);
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->promotions !== null) {
-
- $xfer += $output->writeFieldBegin('promotions');
-
- if (!is_array($this->promotions)){
-
- throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
- }
-
- $output->writeListBegin();
- foreach ($this->promotions as $iter0){
-
-
- if (!is_object($iter0)) {
-
- throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
- }
-
- $xfer += $iter0->write($output);
-
- }
-
- $output->writeListEnd();
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->failed_promotions !== null) {
-
- $xfer += $output->writeFieldBegin('failed_promotions');
-
- if (!is_array($this->failed_promotions)){
-
- throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
- }
-
- $output->writeListBegin();
- foreach ($this->failed_promotions as $iter0){
-
-
- if (!is_object($iter0)) {
-
- throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
- }
-
- $xfer += $iter0->write($output);
-
- }
-
- $output->writeListEnd();
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->date !== null) {
-
- $xfer += $output->writeFieldBegin('date');
- $xfer += $output->writeString($this->date);
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- if($this->actual_market_price !== null) {
-
- $xfer += $output->writeFieldBegin('actual_market_price');
- $xfer += $output->writeDouble($this->actual_market_price);
-
- $xfer += $output->writeFieldEnd();
- }
-
-
- $xfer += $output->writeFieldStop();
- $xfer += $output->writeStructEnd();
- return $xfer;
- }
-
- }
- ?>
|