Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_api_news
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
0ba6e599
authored
Dec 16, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
案例详情接口
parent
9f96744d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
.env
app/Http/Controllers/CaseController.php
app/Model/ArticleModel.php
app/Services/CaseService.php
.env
View file @
0ba6e599
...
...
@@ -13,7 +13,7 @@ DB_PORT=3306
DB_DATABASE=lc_news
DB_USERNAME=root
DB_PASSWORD=root
DB_PREFIX=l
c
_
DB_PREFIX=l
ie
_
BaseUrl=http://lc_server_news.cc
...
...
app/Http/Controllers/CaseController.php
View file @
0ba6e599
...
...
@@ -20,8 +20,8 @@ class CaseController extends Controller
public
function
show
(
Request
$request
,
CaseService
$service
)
{
$
id
=
$request
->
get
(
'art_id'
);
$case
=
$service
->
getCase
(
$
id
);
$
map
=
$request
->
only
([
'art_id'
,
'goods_id'
]
);
$case
=
$service
->
getCase
(
$
map
);
return
$this
->
Export
(
0
,
'ok'
,
[
'data'
=>
$case
]);
}
...
...
app/Model/ArticleModel.php
View file @
0ba6e599
...
...
@@ -69,7 +69,7 @@ class ArticleModel extends BaseModel
return
compact
(
'data'
,
'total'
);
}
public
function
getCase
(
$
id
)
public
function
getCase
(
$
map
)
{
$field
=
[
'art_id'
,
...
...
@@ -98,7 +98,7 @@ class ArticleModel extends BaseModel
},
'article_addon'
,
])
->
where
(
'art_id'
,
$id
)
->
where
(
$map
)
->
first
();
if
(
!
empty
(
$data
))
{
$data
=
$data
->
toArray
();
...
...
app/Services/CaseService.php
View file @
0ba6e599
...
...
@@ -38,10 +38,10 @@ class CaseService extends BaseService
return
$data
;
}
public
function
getCase
(
$
id
)
public
function
getCase
(
$
map
)
{
$model
=
new
ArticleModel
();
$case
=
$model
->
getCase
(
$
id
);
$case
=
$model
->
getCase
(
$
map
);
$case
=
$this
->
caseTransform
(
$case
);
return
$case
;
...
...
@@ -72,6 +72,7 @@ class CaseService extends BaseService
$goodsInfo
=
$this
->
getGoodsInfo
(
$item
[
'goods_id'
]);
if
(
$goodsInfo
)
{
$item
[
'goods_info'
]
=
[
'goods_id'
=>
$goodsInfo
[
'goods_id'
],
'goods_name'
=>
$goodsInfo
[
'goods_name'
],
'goods_image'
=>
is_array
(
$goodsInfo
[
'goods_images'
])
?
$goodsInfo
[
'goods_images'
][
0
]
:
$goodsInfo
[
'goods_images'
],
'ladder_price'
=>
$goodsInfo
[
'ladder_price'
],
...
...
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