From 831beb8ef69d952d41636566355d2bd994ea9b79 Mon Sep 17 00:00:00 2001
From: heshupeng <hsp@bronet.cn>
Date: Sat, 6 Feb 2021 17:09:20 +0800
Subject: [PATCH] 轮播图商品

---
 application/api/controller/Index.php |  9 ++++++++-
 public/api.html                      |  5 +++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php
index b864de0..5b53c9b 100644
--- a/application/api/controller/Index.php
+++ b/application/api/controller/Index.php
@@ -39,8 +39,9 @@ class Index extends Base
             "banner_list": [{ //轮播图
                 "id": 3, //轮播图ID
                 "image": "http://www.ant.top/uploads/20201214/b655ea4dc4779222ab7a4e2b95feb3a4.png" //图片地址
-                "type" : '1', //跳转类型:1=无跳转,2=商品,3=开通会员
+                "type" : 1, //跳转类型:1=无跳转,2=商品,3=开通会员
                 "goods_id" : 1, //商品ID
+                "goods" : //见商品详情数据
             }],
             "category_list": [{ //一级分类
                 "id": 1, //分类ID
@@ -219,6 +220,12 @@ class Index extends Base
     public function index()
     {
         $banner_list = Banner::field('id,image,type,goods_id')->select();
+        foreach ($banner_list as $k => $v){
+            // 查询商品
+            if($v['type'] == '2'){
+                $banner_list[$k]['goods'] = \addons\shopro\model\Goods::getGoodsDetail($v['goods_id']);
+            }
+        }
         $category_list = Category::where('pid',1)->field('id,name,image')->limit(9)->select();
         $seckill_list = \addons\shopro\model\Goods::indexActivityGoodsList('seckill');
         $groupon_list = \addons\shopro\model\Goods::indexActivityGoodsList('groupon');
diff --git a/public/api.html b/public/api.html
index 0d535f3..8715363 100755
--- a/public/api.html
+++ b/public/api.html
@@ -7447,8 +7447,9 @@
             "banner_list": [{ //轮播图
                 "id": 3, //轮播图ID
                 "image": "http://www.ant.top/uploads/20201214/b655ea4dc4779222ab7a4e2b95feb3a4.png" //图片地址
-                "type" : '1', //跳转类型:1=无跳转,2=商品,3=开通会员
+                "type" : 1, //跳转类型:1=无跳转,2=商品,3=开通会员
                 "goods_id" : 1, //商品ID
+                "goods" : //见商品详情数据
             }],
             "category_list": [{ //一级分类
                 "id": 1, //分类ID
@@ -11110,7 +11111,7 @@
 
             <div class="row mt0 footer">
                 <div class="col-md-6" align="left">
-                    Generated on 2021-02-06 16:39:45                </div>
+                    Generated on 2021-02-06 17:08:56                </div>
                 <div class="col-md-6" align="right">
                     <a href="./" target="_blank">My Website</a>
                 </div>
--
libgit2 0.24.0