Index.php 2.5 KB
Newer Older
D
v1.2.0  
devil_gong 已提交
1 2 3 4
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
D
2.0  
Devil 已提交
5
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
D
v1.2.0  
devil_gong 已提交
6
// +----------------------------------------------------------------------
D
2.0  
Devil 已提交
7
// | Licensed ( https://opensource.org/licenses/mit-license.php )
D
v1.2.0  
devil_gong 已提交
8 9 10 11 12
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\api\controller;

D
Devil 已提交
13
use app\service\ApiService;
D
Devil 已提交
14
use app\service\SystemBaseService;
15 16
use app\service\GoodsService;
use app\service\BannerService;
D
devil_gong 已提交
17
use app\service\AppHomeNavService;
D
devil 已提交
18
use app\service\BuyService;
D
Devil 已提交
19
use app\service\LayoutService;
G
gongfuxiang 已提交
20
use app\service\ArticleService;
G
gongfuxiang 已提交
21 22
use app\service\MessageService;
use app\service\AppService;
D
v1.2.0  
devil_gong 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

/**
 * 首页
 * @author   Devil
 * @blog     http://gong.gg/
 * @version  0.0.1
 * @datetime 2016-12-01T21:51:08+0800
 */
class Index extends Common
{
	/**
	 * [__construct 构造方法]
	 * @author   Devil
	 * @blog     http://gong.gg/
	 * @version  0.0.1
	 * @datetime 2016-12-03T12:39:08+0800
	 */
	public function __construct()
    {
		// 调用父类前置方法
		parent::__construct();
	}

	/**
	 * [Index 入口]
	 * @author   Devil
	 * @blog     http://gong.gg/
	 * @version  1.0.0
	 * @datetime 2018-05-25T11:03:59+0800
	 */
	public function Index()
	{
D
Devil 已提交
55 56 57 58 59 60 61 62
		// 数据模式
        if(MyC('home_index_floor_data_type', 0, true) == 2)
        {
            $data_list = LayoutService::LayoutConfigData('home');
        } else {
        	$data_list = GoodsService::HomeFloorList();
        }

G
gongfuxiang 已提交
63 64 65 66 67 68 69
        // 购物车数量
        $common_cart_total = BuyService::UserCartTotal(['user'=>$this->user]);

        // 未读消息总数
        $params = ['user'=>$this->user, 'is_more'=>1, 'is_read'=>0];
        $common_message_total = MessageService::UserMessageTotal($params);

G
gongfuxiang 已提交
70
		// 返回数据
D
v1.2.0  
devil_gong 已提交
71
		$result = [
G
gongfuxiang 已提交
72 73 74 75 76 77 78
			'navigation'			=> AppHomeNavService::AppHomeNav(),
			'banner_list'			=> BannerService::Banner(),
			'data_list'				=> $data_list,
			'article_list'			=> ArticleService::HomeArticleList(),
			'right_icon_list'		=> AppService::HomeRightIconList(['message_total'=>$common_message_total]),
			'common_cart_total'		=> $common_cart_total,
			'common_message_total'	=> $common_message_total,
D
v1.2.0  
devil_gong 已提交
79
		];
D
Devil 已提交
80
		return ApiService::ApiDataReturn(SystemBaseService::DataReturn($result));
D
v1.2.0  
devil_gong 已提交
81 82 83
	}
}
?>