Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c71eac70
authored
Nov 11, 2021
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
搜索供应商接口完善
parent
12a34922
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
19 deletions
app/Http/Controllers/Api/ExternalApiController.php
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/Controller.php
app/Http/Kernel.php
app/Http/Services/SupplierService.php
app/Http/routes.php
app/Http/Controllers/Api/ExternalApiController.php
0 → 100644
View file @
c71eac70
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\SupplierService
;
use
Illuminate\Http\Request
;
//提供外部系统的接口
class
ExternalApiController
extends
Controller
{
public
function
searchSupplier
(
Request
$request
)
{
$map
=
$request
->
only
([
'supplier_name'
,
'channel_uid'
]);
if
(
empty
(
$map
[
'supplier_name'
]))
{
$this
->
response
(
-
1
,
'搜索的供应商名称不能为空'
);
}
$suppliers
=
SupplierService
::
searchSupplier
(
$map
);
$this
->
externalResponse
(
0
,
'ok'
,
$suppliers
[
'data'
],
$suppliers
[
'total'
]);
}
}
app/Http/Controllers/Api/SupplierApiController.php
View file @
c71eac70
...
...
@@ -498,14 +498,4 @@ class SupplierApiController extends Controller
$this
->
response
(
0
,
'申请审核成功'
);
}
//搜索供应商
public
function
searchSupplier
(
$request
)
{
$map
=
$request
->
only
([
'supplier_name'
]);
if
(
empty
(
$map
[
'supplier_name'
]))
{
$this
->
response
(
-
1
,
'搜索的供应商名称不能为空'
);
}
$suppliers
=
SupplierService
::
searchSupplier
(
$map
);
$this
->
response
(
0
,
'ok'
,
$suppliers
[
'data'
],
$suppliers
[
'total'
]);
}
}
app/Http/Controllers/Controller.php
View file @
c71eac70
...
...
@@ -54,4 +54,26 @@ class Controller extends BaseController
exit
();
}
}
//提供给第三方接口json返回方法
public
function
externalResponse
(
$errCode
=
0
,
$errMsg
=
'成功'
,
$data
=
''
,
$count
=
0
)
{
if
(
is_array
(
$errCode
))
{
echo
json_encode
([
'code'
=>
$errCode
[
0
],
'msg'
=>
$errCode
[
1
],
'data'
=>
!
empty
(
$errCode
[
2
])
?
$errCode
[
2
]
:
''
,
'count'
=>
$count
,
]);
exit
();
}
else
{
echo
json_encode
([
'code'
=>
$errCode
,
'msg'
=>
$errMsg
,
'data'
=>
$data
,
'count'
=>
$count
,
]);
exit
();
}
}
}
app/Http/Kernel.php
View file @
c71eac70
...
...
@@ -24,7 +24,7 @@ class Kernel extends HttpKernel
*/
protected
$middlewareGroups
=
[
'web'
=>
[
\App\Http\Middleware\CheckLogin
::
class
,
//
\App\Http\Middleware\CheckLogin::class,
// \App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse
::
class
,
// \Illuminate\Session\Middleware\StartSession::class,
...
...
@@ -38,6 +38,7 @@ class Kernel extends HttpKernel
],
'api'
=>
[
\App\Http\Middleware\CheckLogin
::
class
,
'throttle:60,1'
,
],
];
...
...
app/Http/Services/SupplierService.php
View file @
c71eac70
...
...
@@ -460,7 +460,8 @@ class SupplierService
'supplier_id'
,
'supplier_code'
,
'supplier_name'
,
'pay_type'
'pay_type'
,
'channel_uid'
]);
$query
=
$filter
->
listFilter
(
$params
,
$query
);
$suppliers
=
$query
->
paginate
(
$limit
);
...
...
app/Http/routes.php
View file @
c71eac70
...
...
@@ -42,13 +42,12 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_tag/{key}'
,
'SupplierTagApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_share_apply/{key}'
,
'SupplierShareApplyApiController@Entrance'
);
});
//提供给其它系统使用的接口
Route
::
group
([
'middleware'
=>
[],
'namespace'
=>
'Api'
],
function
()
{
Route
::
get
(
'/api/external/searchSupplier'
,
'ExternalApiController@searchSupplier'
);
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$service
=
new
\App\Http\Services\DataService
();
// $service->pushSupplierSKu();
// $service->makeSupplierSystemTag();
// $service->importSupplier();
// $service->transferFileData();
$service
->
TransferPayTypeDataToNewTable
();
// $service->changeSupplierIsTypeByCheckChannelUidOrPurchaseUid();
// $service->replaceStandardBrandId();
});
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