function pageaddgoods($inPath) { $url = $this->getUrlParams($inPath); $goods_id = (int) $url['gid'] > 0 ? (int) $url['gid'] : (int) $_POST['goods_id']; $goodsObj = new m_goods($goods_id); if ($_POST) { $post = base_Utils::shtmlspecialchars($_POST); if ($goodsObj->create($post)) { base_Utils::ssetcookie(array('cat_id' => $post['cat_id'])); $this->ShowMsg("操作成功!", $this->createUrl("/goods/addgoods"), 2, 1); } $this->ShowMsg("操作失败" . $goodsObj->getError()); } $categoryObj = new m_category(); $this->params['cat_id'] = (int) $_COOKIE['cat_id']; $this->params['catelist'] = $categoryObj->getOrderCate(' '); $this->params['goods'] = $goodsObj->selectOne("goods_id={$goods_id}"); return $this->render('goods/addgoods.html', $this->params); }