IndexController.php 1.2 KB
<?php
namespace app\index\controller;
use app\goods\model\GoodsModel;
use cmf\controller\HomeBaseController;
use think\Db;

class IndexController extends HomeBaseController
{

    function _initialize()
    {
        parent::_initialize(); // TODO: Change the autogenerated stub
        session('user.id', 8);
    }

    public function index()
    {
        $goods = new GoodsModel;
        $goodsList = $goods->getGoods(2);
        $return = [
            'banner' => getBanner(),
            'goodsList' => $goodsList
        ];
        return $this->fetch('', [
            'data' => $return
        ]);
    }

    /**
     * 易连云打印机demo
     */
    public function demo()
    {
        //调用打印机
        //1.配置信息
        $config = [
            'partner' => '27606',
            'machine_code' => '4004564414',
            'apiKey' => '1580c3fc2adca994e18b0982b42af850518011d0',
            'msign' => '6kdjyzsr4sf3'
        ];
        //2.打印内容(以一行三列的表格为例,内容不允许出现回车换行,切记!)
        $content = '<table><tr><td>银河百荣科技</td><td>demo</td><td>By Soul of Cinder</td></tr></table>';
        printer($config, $content);
    }

}