vr-shopxo-source/service/Application/Home/Controller/GoodsController.class.php

79 lines
2.0 KiB
PHP
Raw Normal View History

2018-08-21 08:47:02 +00:00
<?php
namespace Home\Controller;
2018-08-29 10:12:20 +00:00
use Service\GoodsService;
2018-08-21 08:47:02 +00:00
/**
* 商品详情
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
2018-08-29 03:21:00 +00:00
class GoodsController extends CommonController
2018-08-21 08:47:02 +00:00
{
/**
* [_initialize 前置操作-继承公共前置方法]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public function _initialize()
{
// 调用父类前置方法
parent::_initialize();
}
/**
* [Index 首页]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-02-22T16:50:32+0800
*/
public function Index()
{
2018-08-29 03:21:00 +00:00
$id = I('id');
2018-08-23 09:42:07 +00:00
$params = [
'where' => [
2018-08-29 03:21:00 +00:00
'g.id' => $id,
2018-08-23 09:42:07 +00:00
'g.is_delete_time' => 0,
],
'is_photo' => true,
'is_attribute' => true,
];
2018-08-29 10:12:20 +00:00
$goods = GoodsService::GoodsList($params);
2018-08-23 09:42:07 +00:00
$this->assign('goods', $goods[0]);
$this->assign('home_seo_site_title', $goods[0]['title']);
2018-08-28 07:58:11 +00:00
// 左侧商品 看了又看
2018-08-23 09:42:07 +00:00
$params = [
'where' => [
'g.is_delete_time'=>0,
'g.is_shelves'=>1
],
'order_by' => 'access_count desc',
'field' => 'g.id,g.title,g.title_color,g.price,g.images',
'n' => 10,
];
2018-08-29 10:12:20 +00:00
$this->assign('left_goods', GoodsService::GoodsList($params));
2018-08-21 08:47:02 +00:00
2018-08-28 07:58:11 +00:00
// 详情tab商品 猜你喜欢
$params = [
'where' => [
'g.is_delete_time'=>0,
'g.is_shelves'=>1,
'is_home_recommended'=>1,
],
'order_by' => 'sales_count desc',
'field' => 'g.id,g.title,g.title_color,g.price,g.images,g.home_recommended_images',
'n' => 16,
];
2018-08-29 10:12:20 +00:00
$this->assign('detail_like_goods', GoodsService::GoodsList($params));
2018-08-28 07:58:11 +00:00
2018-08-21 08:47:02 +00:00
$this->display('Index');
}
}
?>