public function getGoodsById($id) { $sql = sprintf("select * from t_goods where id=%d", $id); $goods = $this->g_db->getOne($sql); $goods_category_service = new GoodsCategoryService(); $goods_category_id = $goods->goods_category_id; $goods_category = $goods_category_service->getGoodsCategoryById($goods_category_id); $goods_category_name = $goods_category->goods_category_name; $goods->goods_category_name = $goods_category_name; return $goods; }
$goods_category = new GoodsCategory(null, $goods_category_name); $goods_category_service = new GoodsCategoryService(); $id = $goods_category_service->addGoodsCategory($goods_category); $_SESSION['operation'] = true; $_SESSION['operation_msg'] = "添加产品类别:" . $goods_category_name . "成功"; $log_service->addLog("insert", "产品类别", $id); header("Location: ./index.php?mod=goods_category&action=ls"); break; case 'edit_get': if (isset($_GET['eid'])) { $id = $_GET['eid']; if (is_numeric($id)) { require_once './class/goods_category_service.class.php'; require_once 'class/goods_category.class.php'; $goods_category_service = new GoodsCategoryService(); $goods_category = $goods_category_service->getGoodsCategoryById($id); $goods_category = serialize($goods_category); $_SESSION['goods_category'] = $goods_category; require_once './goods_category_view_edit_form.php'; } else { header("Location: ./index.php?mod=goods_category&action=ls"); } } else { header("Location: ./index.php?mod=goods_category&action=ls"); } break; case 'edit_post': if (isset($_SESSION["id"])) { require_once './class/goods_category_service.class.php'; require_once 'class/goods_category.class.php'; $id = $_SESSION["id"];