<?php namespace Phpcmf\Controllers;

class Goods extends \Phpcmf\Home\Module
{

    public function index() {

        define('MALL_SHOW_SEO', 1);

        $this->_module_init();
        $data = $this->_Show(
            (int)\Phpcmf\Service::L('input')->get('id'),
            [
                'field' => dr_safe_replace(\Phpcmf\Service::L('input')->get('field')),
                'value' => dr_safe_replace(\Phpcmf\Service::L('input')->get('value')),
            ],
            1,
            1
        );


        $params = isset($_GET['rewrite']) ? dr_rewrite_decode($_GET['rewrite'], '-') : [];

        \Phpcmf\Service::V()->assign([
            'urlrule' => \Phpcmf\Service::L('router')->mall_url('goods', $data, [
                'page' => '[page]'
            ]),
            'params' => $params,
        ]);

        \Phpcmf\Service::V()->assign(\Phpcmf\Service::L('seo')->mall('goods', $data));
        \Phpcmf\Service::V()->display('goods.html');
    }

    protected function _call_show($data) {
        $data['comment'] = $this->content_model->get_comment_index( $data['id'], $data['catid']);
        $data['mall_page'] = \Phpcmf\Service::M('mall', 'mall')->get_mall_page($data);
        return $data;
    }


}
