Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
b85ee67b
Commit
b85ee67b
authored
Jul 29, 2023
by
hj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
9429a375
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
server/app/Repositories/Transformers/Chemsite/CustomersTransformer.php
...positories/Transformers/Chemsite/CustomersTransformer.php
+40
-0
server/app/Services/Api/Chemsite/ChemsiteCustomerService.php
server/app/Services/Api/Chemsite/ChemsiteCustomerService.php
+2
-2
No files found.
server/app/Repositories/Transformers/Chemsite/CustomersTransformer.php
0 → 100644
View file @
b85ee67b
<?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
;
}
}
server/app/Services/Api/Chemsite/ChemsiteCustomerService.php
View file @
b85ee67b
...
...
@@ -2,7 +2,7 @@
namespace
App\Services\Api\Chemsite
;
use
App\Repositories\
BaseRepository
;
use
App\Repositories\
Transformers\Chemsite\CustomersTransformer
;
use
App\Rhawn\Repositories\Eloquent\Chemsite\ChemsiteCustomerRepositoryEloquent
;
class
ChemsiteCustomerService
...
...
@@ -18,7 +18,7 @@ class ChemsiteCustomerService
public
function
getCustomerByNumber
(
$customerNumber
)
{
$customer
=
$this
->
chemsiteCustomerService
->
getCustomerThroughCusCode
(
$customerNumber
);
return
current
(
app
(
ChemsiteCustomerRepositoryEloquent
::
class
)
->
transformData
([
$customer
]));
return
current
(
app
(
ChemsiteCustomerRepositoryEloquent
::
class
)
->
transformData
([
$customer
]
,
CustomersTransformer
::
class
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment