Commit 0ba6e599 by 杨树贤

案例详情接口

parent 9f96744d
...@@ -13,7 +13,7 @@ DB_PORT=3306 ...@@ -13,7 +13,7 @@ DB_PORT=3306
DB_DATABASE=lc_news DB_DATABASE=lc_news
DB_USERNAME=root DB_USERNAME=root
DB_PASSWORD=root DB_PASSWORD=root
DB_PREFIX=lc_ DB_PREFIX=lie_
BaseUrl=http://lc_server_news.cc BaseUrl=http://lc_server_news.cc
......
...@@ -20,8 +20,8 @@ class CaseController extends Controller ...@@ -20,8 +20,8 @@ class CaseController extends Controller
public function show(Request $request, CaseService $service) public function show(Request $request, CaseService $service)
{ {
$id = $request->get('art_id'); $map = $request->only(['art_id','goods_id']);
$case = $service->getCase($id); $case = $service->getCase($map);
return $this->Export(0, 'ok', ['data' => $case]); return $this->Export(0, 'ok', ['data' => $case]);
} }
......
...@@ -69,7 +69,7 @@ class ArticleModel extends BaseModel ...@@ -69,7 +69,7 @@ class ArticleModel extends BaseModel
return compact('data','total'); return compact('data','total');
} }
public function getCase($id) public function getCase($map)
{ {
$field = [ $field = [
'art_id', 'art_id',
...@@ -98,7 +98,7 @@ class ArticleModel extends BaseModel ...@@ -98,7 +98,7 @@ class ArticleModel extends BaseModel
}, },
'article_addon', 'article_addon',
]) ])
->where('art_id', $id) ->where($map)
->first(); ->first();
if (!empty($data)) { if (!empty($data)) {
$data = $data->toArray(); $data = $data->toArray();
......
...@@ -38,10 +38,10 @@ class CaseService extends BaseService ...@@ -38,10 +38,10 @@ class CaseService extends BaseService
return $data; return $data;
} }
public function getCase($id) public function getCase($map)
{ {
$model = new ArticleModel(); $model = new ArticleModel();
$case = $model->getCase($id); $case = $model->getCase($map);
$case = $this->caseTransform($case); $case = $this->caseTransform($case);
return $case; return $case;
...@@ -72,6 +72,7 @@ class CaseService extends BaseService ...@@ -72,6 +72,7 @@ class CaseService extends BaseService
$goodsInfo = $this->getGoodsInfo($item['goods_id']); $goodsInfo = $this->getGoodsInfo($item['goods_id']);
if ($goodsInfo) { if ($goodsInfo) {
$item['goods_info'] = [ $item['goods_info'] = [
'goods_id' => $goodsInfo['goods_id'],
'goods_name' => $goodsInfo['goods_name'], 'goods_name' => $goodsInfo['goods_name'],
'goods_image' => is_array($goodsInfo['goods_images']) ? $goodsInfo['goods_images'][0] : $goodsInfo['goods_images'], 'goods_image' => is_array($goodsInfo['goods_images']) ? $goodsInfo['goods_images'][0] : $goodsInfo['goods_images'],
'ladder_price'=>$goodsInfo['ladder_price'], 'ladder_price'=>$goodsInfo['ladder_price'],
......
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 sign in to comment