AccountTransformer.php 1.7 KB

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