public function update()
 {
     $where = array("id='{$this->R['id']}'");
     $updateData = $this->getRequest()->filter($this->fields);
     if ($this->R['is_record'] == 0 && $this->R['order_delivery'] == '已发货') {
         $this->tables = array(DB_FREFIX . 'record');
         foreach ($_POST['goods_id'] as $key => $value) {
             $recordDate['goods_id'] = $value;
             $recordDate['user'] = $_POST['user'];
             $recordDate['name'] = $_POST['goods_name'][$value];
             $recordDate['num'] = $_POST['goods_num'][$value];
             $recordDate['attr'] = $_POST['goods_attr'][$value];
             $recordDate['price'] = $_POST['goods_price_sale'][$value];
             $recordDate['date'] = tool::getDate();
             parent::add($recordDate);
         }
     }
     if ($this->R['order_state'] == '已取消' || $this->R['refund'] == 2) {
         $order_goods = parent::select(array('id', 'goods'), array('where' => $where));
         $goods = unserialize(htmlspecialchars_decode($order_goods[0]->goods));
         $this->tables = array(DB_FREFIX . 'goods');
         foreach ($goods as $key => $value) {
             $value = unserialize($value);
             parent::update(array("id='{$key}'"), array('inventory' => array('inventory+' . $value[num]), 'sale_count' => array('sale_count-' . $value[num])));
         }
     }
     $this->tables = array(DB_FREFIX . 'order');
     $updateData['is_record'] = 1;
     return parent::update($where, $updateData);
 }