function addProductAction() { $products = new Yd_Products(); $products->autoGetRequestVar('k_id', 'p_name', 'p_price', 'p_info', 'p_img_link', 'p_unit'); if ($this->getInputParameter("op")) { if ($products->save()) { } } }
/** * 输入: * p_id * * 输出: * * 如成功,转到 $products_list */ function deleteAction() { $products = Yd_Products::getPeer()->retrieveByPK($this->in("p_id")); if (!$products) { $this->redirectTo404(); } Pft_Session::getSession()->recordRefererPage(); $nextUrl = Pft_Session::getSession()->getLastRefererPage() ? Pft_Session::getSession()->getLastRefererPage() : '?do=adm_ec_product_list'; try { $products->delete(); $this->addTip(Pft_I18n::trans('OPRATE_SUCCESS'), $nextUrl); //$this->redirectToSelfAction( "list" ); } catch (Exception $e) { $this->addTip(Pft_I18n::trans('OPRATE_FAIL'), $nextUrl); //保存失败,做其它处理 } }