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
96a158b0
Commit
96a158b0
authored
Jul 30, 2023
by
hj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
8688428c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
159 additions
and
16 deletions
+159
-16
server/app/Http/Controllers/V1/Bhua/CustomerController.php
server/app/Http/Controllers/V1/Bhua/CustomerController.php
+35
-0
server/app/Http/Controllers/V1/Rhawn/CustomerController.php
server/app/Http/Controllers/V1/Rhawn/CustomerController.php
+35
-0
server/app/Repositories/Transformers/Chemsite/CustomersTransformer.php
...positories/Transformers/Chemsite/CustomersTransformer.php
+2
-11
server/app/Repositories/Transformers/Rhawn/CustomersTransformer.php
.../Repositories/Transformers/Rhawn/CustomersTransformer.php
+33
-0
server/app/Rhawn/Services/Chemsite/ChemsiteCustomerService.php
...r/app/Rhawn/Services/Chemsite/ChemsiteCustomerService.php
+0
-5
server/app/Services/Api/BhuaCustomerService.php
server/app/Services/Api/BhuaCustomerService.php
+24
-0
server/app/Services/Api/RhawnCustomerService.php
server/app/Services/Api/RhawnCustomerService.php
+24
-0
server/routes/api/rhawn.php
server/routes/api/rhawn.php
+6
-0
No files found.
server/app/Http/Controllers/V1/Bhua/CustomerController.php
0 → 100644
View file @
96a158b0
<?php
namespace
App\Http\Controllers\V1\Bhua
;
use
App\Services\Api\BhuaCustomerService
;
use
Illuminate\Http\Request
;
use
Jiannei\Response\Laravel\Support\Facades\Response
;
use
App\Http\Controllers\V1\Controller
;
use
App\Support\Traits\Helpers
;
class
CustomerController
extends
Controller
{
use
Helpers
;
public
function
__construct
(
BhuaCustomerService
$bhuaCustomerService
)
{
$this
->
bhuaCustomerService
=
$bhuaCustomerService
;
$this
->
controllerType
=
'bhua'
;
}
public
function
getCustomer
(
Request
$request
)
{
$customerCode
=
$request
->
get
(
'cusCode'
);
if
(
!
$customerCode
){
return
Response
::
ok
(
'客户编号不存在!'
);
}
try
{
$customer
=
$this
->
bhuaCustomerService
->
getCustomerByNumber
(
$customerCode
);
return
Response
::
success
(
$this
->
formatKeysfromArray
(
$customer
),
'操作成功'
);
}
catch
(
\Throwable
$exception
){
return
$this
->
returnErrorExecptionResponse
(
$exception
);
}
}
}
server/app/Http/Controllers/V1/Rhawn/CustomerController.php
0 → 100644
View file @
96a158b0
<?php
namespace
App\Http\Controllers\V1\Rhawn
;
use
App\Services\Api\RhawnCustomerService
;
use
Illuminate\Http\Request
;
use
Jiannei\Response\Laravel\Support\Facades\Response
;
use
App\Http\Controllers\V1\Controller
;
use
App\Support\Traits\Helpers
;
class
CustomerController
extends
Controller
{
use
Helpers
;
public
function
__construct
(
RhawnCustomerService
$rhawnCustomerService
)
{
$this
->
rhawnCustomerService
=
$rhawnCustomerService
;
$this
->
controllerType
=
'rhawn'
;
}
public
function
getCustomer
(
Request
$request
)
{
$customerCode
=
$request
->
get
(
'cusCode'
);
if
(
!
$customerCode
){
return
Response
::
ok
(
'客户编号不存在!'
);
}
try
{
$customer
=
$this
->
rhawnCustomerService
->
getCustomerByNumber
(
$customerCode
);
return
Response
::
success
(
$this
->
formatKeysfromArray
(
$customer
),
'操作成功'
);
}
catch
(
\Throwable
$exception
){
return
$this
->
returnErrorExecptionResponse
(
$exception
);
}
}
}
server/app/Repositories/Transformers/Chemsite/CustomersTransformer.php
View file @
96a158b0
<?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
App\Repositories\Models\Model
;
...
...
@@ -16,7 +7,7 @@ use League\Fractal\TransformerAbstract;
class
CustomersTransformer
extends
TransformerAbstract
{
public
function
transform
(
$customers
)
public
function
transform
(
$customers
)
:
array
{
$customerTransReturn
=
[];
if
(
$customers
){
...
...
@@ -36,7 +27,7 @@ class CustomersTransformer extends TransformerAbstract
$temp
[
'cus_status'
]
=
$customer
[
'cus_status'
];
$temp
[
'com_id'
]
=
$customer
[
'com_id'
];
array_push
(
$customerTransReturn
,
$temp
)
;
$customerTransReturn
[]
=
$temp
;
}
}
return
$customerTransReturn
;
...
...
server/app/Repositories/Transformers/Rhawn/CustomersTransformer.php
0 → 100644
View file @
96a158b0
<?php
namespace
App\Repositories\Transformers\Rhawn
;
use
App\Repositories\Models\Model
;
use
League\Fractal\TransformerAbstract
;
class
CustomersTransformer
extends
TransformerAbstract
{
public
function
transform
(
$customers
)
:
array
{
$customerTransReturn
=
[];
if
(
$customers
){
foreach
(
$customers
as
$customer
){
if
(
$customer
instanceof
Model
){
$customer
=
$customer
->
toArray
();
}
$temp
=
[];
$temp
[
'cus_number'
]
=
$customer
[
'cus_no'
];
$temp
[
'cus_email'
]
=
$customer
[
'cus_email'
];
$temp
[
'cus_name'
]
=
$customer
[
'cus_name'
];
$temp
[
'cus_company'
]
=
$customer
[
'cus_company'
];
$temp
[
'cus_mobile'
]
=
$customer
[
'cus_mobile'
];
$temp
[
'cus_phone'
]
=
$customer
[
'cus_phone'
];
$temp
[
'cus_status'
]
=
$customer
[
'cus_status'
];
$temp
[
'com_id'
]
=
$customer
[
'com_id'
];
$customerTransReturn
[]
=
$temp
;
}
}
return
$customerTransReturn
;
}
}
server/app/Rhawn/Services/Chemsite/ChemsiteCustomerService.php
View file @
96a158b0
...
...
@@ -18,9 +18,4 @@ class ChemsiteCustomerService
$customer
=
$this
->
customerRepository
->
getCustomerThroughCusCode
(
$cusCode
);
return
$customer
->
toArray
();
}
public
function
getCustomerListByCusCode
(
$cusNo
,
$offset
,
$limit
)
:
?
array
{
return
$this
->
customerRepository
->
getCustomerList
([
'cus_no'
=>
$cusNo
],
$offset
,
$limit
);
}
}
server/app/Services/Api/BhuaCustomerService.php
0 → 100644
View file @
96a158b0
<?php
namespace
App\Services\Api
;
use
App\Repositories\Transformers\Rhawn\CustomersTransformer
;
use
App\Rhawn\Repositories\Eloquent\BhuaCustomerRepositoryEloquent
;
class
BhuaCustomerService
{
private
$bhuaCustomerService
;
public
function
__construct
(
\App\Rhawn\Services\BhuaCustomerService
$bhuaCustomerService
)
{
$this
->
bhuaCustomerService
=
$bhuaCustomerService
;
}
public
function
getCustomerByNumber
(
$customerNumber
)
{
$customer
=
$this
->
bhuaCustomerService
->
getBhuaCustomerThroughtCusCode
(
$customerNumber
);
return
current
(
app
(
BhuaCustomerRepositoryEloquent
::
class
)
->
transformData
([
$customer
],
CustomersTransformer
::
class
));
}
}
server/app/Services/Api/RhawnCustomerService.php
0 → 100644
View file @
96a158b0
<?php
namespace
App\Services\Api
;
use
App\Repositories\Transformers\Chemsite\CustomersTransformer
;
use
App\Rhawn\Repositories\Eloquent\RhawnCustomerRepositoryEloquent
;
class
RhawnCustomerService
{
private
$rhawnCustomerService
;
public
function
__construct
(
\App\Rhawn\Services\RhawnCustomerService
$rhawnCustomerService
)
{
$this
->
rhawnCustomerService
=
$rhawnCustomerService
;
}
public
function
getCustomerByNumber
(
$customerNumber
)
{
$customer
=
$this
->
rhawnCustomerService
->
getRhawnCustomerThroughtCusCode
(
$customerNumber
);
return
current
(
app
(
RhawnCustomerRepositoryEloquent
::
class
)
->
transformData
([
$customer
],
CustomersTransformer
::
class
));
}
}
server/routes/api/rhawn.php
View file @
96a158b0
...
...
@@ -17,6 +17,9 @@ $api->version('v1', function($api) {
// 取消订单
//$api->post('/openapi/rhawn/orders/cancelRhawnOrders', ['permission' => 'orders.cancelRhawnOrders', 'uses'=>'OrdersController@cancelCustomerOrder']);
$api
->
post
(
'/openapi/rhawn/orders/getOrdersDispatch'
,
[
'permission'
=>
'orders.getOrdersDispatch'
,
'uses'
=>
'OrdersController@getOrdersDispatch'
]);
//客户信息
$api
->
post
(
'/openapi/rhawn/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Rhawn'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
...
...
@@ -34,6 +37,9 @@ $api->version('v1', function($api) {
// 新建订单
$api
->
post
(
'/openapi/bhua/orders/createBhuaOrders'
,
[
'permission'
=>
'orders.createBhuaOrders'
,
'uses'
=>
'OrdersController@createCustomerNewOrder'
]);
$api
->
post
(
'/openapi/bhua/orders/getOrdersDispatch'
,
[
'permission'
=>
'orders.getOrdersDispatch'
,
'uses'
=>
'OrdersController@getOrdersDispatch'
]);
//客户信息
$api
->
post
(
'/openapi/bhua/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Bhua'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
...
...
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