/** * 显示 商品列表 */ public function index() { $goodsTable = M('Goods'); $goodsList = $goodsTable->order('id asc')->select(); foreach ($goodsList as $key => $value) { $goodsList[$key]['is_on_sale'] = $value['is_on_sale'] == 1 ? '是' : '否'; $goodsList[$key]['add_time'] = date("Y-m-d H:i", $value['add_time']); $goodsList[$key]['cate_name'] = getPnameByCateId($value['cate_id']); } $this->assign('goods_list', $goodsList); $this->assign('tab', 'kysc'); $this->assign('subtab', 'splb'); $this->display('goods'); }
/** * 显示修改栏目页面 */ public function showEdit() { // 获取所有栏目 $cateTable = M('Category'); $cateTree = $cateTable->select(); $cateList = getChildTree($cateTree, 0); foreach ($cateList as $key => $value) { $cateList[$key]['cate_name'] = str_repeat(' ', $value['level'] * 2) . $value['cate_name']; } $this->assign('cate_list', $cateList); // 获取传递过来的栏目信息 $oneCate = $cateTable->where('id=' . $_REQUEST['cate_id'])->find(); $oneCate['create_time'] = date("Y-m-d H:i", $oneCate['create_time']); $oneCate['parent_name'] = getPnameByCateId($oneCate['parent_id']); $oneCate['goods_quantity'] = getGoodsNumByCateId($oneCate['id']); $this->assign('one_cate', $oneCate); $this->assign('tab', 'kysc'); $this->assign('subtab', 'spfl'); $this->display('edit'); }