示例#1
0
 /**
  * @brief 商品上下架
  */
 function goods_stats()
 {
     //post数据
     $id = IFilter::act(IReq::get('id'), 'int');
     $type = IFilter::act(IReq::get('type'));
     //生成goods对象
     $tb_goods = new IModel('goods');
     if ($type == 'up') {
         $updateData = array('is_del' => 0, 'up_time' => ITime::getDateTime(), 'down_time' => null);
     } else {
         if ($type == 'down') {
             $updateData = array('is_del' => 2, 'up_time' => null, 'down_time' => ITime::getDateTime());
         } else {
             if ($type == 'check') {
                 $updateData = array('is_del' => 3, 'up_time' => null, 'down_time' => null);
             }
         }
     }
     $tb_goods->setData($updateData);
     if ($id) {
         $tb_goods->update(Util::joinStr($id));
     } else {
         Util::showMessage('请选择要操作的数据');
     }
     if (IClient::isAjax() == false) {
         $this->redirect("goods_list");
     }
 }