Commit b85ee67b authored by hj's avatar hj

更新

parent 9429a375
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Transformers\Chemsite;
use League\Fractal\TransformerAbstract;
class CustomersTransformer extends TransformerAbstract
{
public function transform($customers)
{
$customerTransReturn = [];
if($customers){
foreach($customers as $customer){
$temp = [];
$temp['cus_number'] = $customer->cus_number;
$temp['cus_email'] = $customer->cus_email;
$temp['cus_name'] = $customer->cus_name;
$temp['cus_company'] = $customer->cus_company;
$temp['cus_company_type'] = $customer->cus_company_type;
$temp['cus_company_type_text'] = $customer->cus_company_type == 1 ? '学校' : '企业';
$temp['cus_mobile'] = $customer->cus_mobile;
$temp['cus_phone'] = $customer->cus_phone;
$temp['cus_status'] = $customer->cus_status;
$temp['com_id'] = $customer->com_id;
array_push($customerTransReturn,$temp);
}
}
return $customerTransReturn;
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace App\Services\Api\Chemsite; namespace App\Services\Api\Chemsite;
use App\Repositories\BaseRepository; use App\Repositories\Transformers\Chemsite\CustomersTransformer;
use App\Rhawn\Repositories\Eloquent\Chemsite\ChemsiteCustomerRepositoryEloquent; use App\Rhawn\Repositories\Eloquent\Chemsite\ChemsiteCustomerRepositoryEloquent;
class ChemsiteCustomerService class ChemsiteCustomerService
...@@ -18,7 +18,7 @@ class ChemsiteCustomerService ...@@ -18,7 +18,7 @@ class ChemsiteCustomerService
public function getCustomerByNumber($customerNumber) public function getCustomerByNumber($customerNumber)
{ {
$customer = $this->chemsiteCustomerService->getCustomerThroughCusCode($customerNumber); $customer = $this->chemsiteCustomerService->getCustomerThroughCusCode($customerNumber);
return current(app(ChemsiteCustomerRepositoryEloquent::class)->transformData([$customer])); return current(app(ChemsiteCustomerRepositoryEloquent::class)->transformData([$customer], CustomersTransformer::class));
} }
} }
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