Commit 8688428c authored by hj's avatar hj

更新

parent 50fabf6c
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
namespace App\Repositories\Transformers\Chemsite; namespace App\Repositories\Transformers\Chemsite;
use App\Repositories\Models\Model;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
class CustomersTransformer extends TransformerAbstract class CustomersTransformer extends TransformerAbstract
...@@ -20,17 +21,20 @@ class CustomersTransformer extends TransformerAbstract ...@@ -20,17 +21,20 @@ class CustomersTransformer extends TransformerAbstract
$customerTransReturn = []; $customerTransReturn = [];
if($customers){ if($customers){
foreach($customers as $customer){ foreach($customers as $customer){
if($customer instanceof Model){
$customer = $customer->toArray();
}
$temp = []; $temp = [];
$temp['cus_number'] = $customer->cus_no; $temp['cus_number'] = $customer['cus_no'];
$temp['cus_email'] = $customer->cus_email; $temp['cus_email'] = $customer['cus_email'];
$temp['cus_name'] = $customer->cus_name; $temp['cus_name'] = $customer['cus_name'];
$temp['cus_company'] = $customer->cus_company; $temp['cus_company'] = $customer['cus_company'];
$temp['cus_company_type'] = $customer->cus_company_type; $temp['cus_company_type'] = $customer['cus_company_type'];
$temp['cus_company_type_text'] = $customer->cus_company_type == 1 ? '学校' : '企业'; $temp['cus_company_type_text'] = $customer['cus_company_type'] == 1 ? '学校' : '企业';
$temp['cus_mobile'] = $customer->cus_mobile; $temp['cus_mobile'] = $customer['cus_mobile'];
$temp['cus_phone'] = $customer->cus_phone; $temp['cus_phone'] = $customer['cus_phone'];
$temp['cus_status'] = $customer->cus_status; $temp['cus_status'] = $customer['cus_status'];
$temp['com_id'] = $customer->com_id; $temp['com_id'] = $customer['com_id'];
array_push($customerTransReturn,$temp); array_push($customerTransReturn,$temp);
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace App\Rhawn\Services\Chemsite; namespace App\Rhawn\Services\Chemsite;
use App\Exceptions\ServerRunTimeException;
use App\Rhawn\Repositories\Contracts\Chemsite\ChemsiteCustomerRepository; use App\Rhawn\Repositories\Contracts\Chemsite\ChemsiteCustomerRepository;
class ChemsiteCustomerService class ChemsiteCustomerService
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment