예제 #1
0
 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()) {
         }
     }
 }
예제 #2
0
 /**
  * 功能:
  * 增加一个Yd_Products
  * 
  * 输入:
  * 
  * 输出:
  * 
  * $products
  * 
  * @author 
  */
 function addAction()
 {
     $products = new Yd_Products();
     //此处输出
     //自动获得对应名称的输入字段
     //注意删掉不应该接受用户输入的字段
     $products->autoGetRequestVar("p_id,k_id,p_name,p_price,p_info,p_img_link,p_unit,created_at,updated_at,is_del");
     if ($op = $this->in("op")) {
         //此处设置一些其他的值如
         //$products->products_reg_time = time();
         $nextUrl = Pft_Session::getSession()->getLastRefererPage() ? Pft_Session::getSession()->getLastRefererPage() : '?do=adm_ec_product_list';
         if ($products->save()) {
             $this->addTip(Pft_I18n::trans('OPRATE_SUCCESS'), $nextUrl);
             //$this->redirectToSelfAction( "list" );
         } else {
             $this->addTip(Pft_I18n::trans('OPRATE_FAIL'));
             //保存失败,做其它处理
         }
     }
     Pft_Session::getSession()->recordRefererPage();
     $this->products = $products->toArray();
 }