XcxSendOrderTransformer.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: hp
  5. * Date: 2017/11/22
  6. * Time: 14:17
  7. */
  8. namespace App\Http\Controllers\Channel\XChengXu\Transformers;
  9. use Hashids;
  10. class XcxSendOrderTransformer
  11. {
  12. public function transform($sendOrderItem)
  13. {
  14. return [
  15. 'id' => isset($sendOrderItem->id)?$sendOrderItem->id:'',
  16. 'distribution_channel_id' => isset($sendOrderItem->distribution_channel_id)?$sendOrderItem->distribution_channel_id:'',
  17. 'name' => isset($sendOrderItem->name)?$sendOrderItem->name:'',
  18. 'domain' => isset($sendOrderItem->domain)?$sendOrderItem->domain:'',
  19. 'remark' => isset($sendOrderItem->remark)?$sendOrderItem->remark:'',
  20. 'star_num' => isset($sendOrderItem->star_num)?$sendOrderItem->star_num:'',
  21. 'updated_at' => date("Y-m-d H:i:s", strtotime($sendOrderItem->updated_at)),
  22. 'created_at' => date("Y-m-d H:i:s", strtotime($sendOrderItem->created_at)),
  23. 'totalChargeAmount' => isset($sendOrderItem->totalChargeAmount)?$sendOrderItem->totalChargeAmount:'',
  24. 'cost' => isset($sendOrderItem->cost)?$sendOrderItem->cost:'',
  25. 'promotion_type_name' => isset($sendOrderItem->promotion_type_name)?$sendOrderItem->promotion_type_name:'',
  26. 'promotion_url' => isset($sendOrderItem->promotion_url)?$sendOrderItem->promotion_url:'',
  27. 'promotion_type' => isset($sendOrderItem->promotion_type)?$sendOrderItem->promotion_type:'',
  28. 'totalOrderNum' => isset($sendOrderItem->totalOrderNum)?$sendOrderItem->totalOrderNum:'',
  29. 'sucOrderNum' => isset($sendOrderItem->sucOrderNum)?$sendOrderItem->sucOrderNum:'',
  30. 'addUserNum' => isset($sendOrderItem->addUserNum)?$sendOrderItem->addUserNum:'',
  31. 'totalChargeAmount' => isset( $sendOrderItem->totalChargeAmount)? $sendOrderItem->totalChargeAmount:'',
  32. 'pre_send_date' => empty($sendOrderItem->pre_send_date) ? '' : date("Y/m/d", strtotime($sendOrderItem->pre_send_date))
  33. ];
  34. }
  35. }