AccountTransformer.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Transformer\Account;
  3. class AccountTransformer
  4. {
  5. // 用户列表
  6. public function newBuildSupplierList($data): array
  7. {
  8. return [
  9. 'meta' => getMeta($data),
  10. 'list' => $this->newEachSupplierList($data),
  11. ];
  12. }
  13. private function newEachSupplierList($list): array
  14. {
  15. $result = [];
  16. if (empty($list)) return $result;
  17. foreach ($list as $item) {
  18. $result[] = [
  19. 'id' => getProp($item, 'id'),
  20. 'company' => getProp($item, 'company'),
  21. 'business_license' => getProp($item, 'business_license'),
  22. 'legal_person' => getProp($item, 'legal_person'),
  23. 'company_address' => getProp($item, 'company_address'),
  24. 'bank_card' => getProp($item, 'bank_card'),
  25. 'bank_name' => getProp($item, 'bank_name'),
  26. 'mobile' => getProp($item, 'mobile'),
  27. 'USCC' => getProp($item, 'USCC'),
  28. 'status' => getProp($item, 'status'),
  29. 'remark' => getProp($item, 'remark'),
  30. 'created_at' => transDate(getProp($item, 'created_at')),
  31. 'enable_editable' => getProp($item, 'status') == '待审核' ? 1 : 0,
  32. ];
  33. }
  34. return $result;
  35. }
  36. }