where = $where; $this->query = $this->buildQuery($dbQuery); $this->data = empty($data) ? $this->app->request->post() : $data; $this->pkField = empty($field) ? $this->query->getPk() : $field; $this->pkValue = $this->app->request->post($this->pkField, null); // 主键限制处理 if (!isset($this->where[$this->pkField]) && is_string($this->pkValue)) { $this->query->whereIn($this->pkField, explode(',', $this->pkValue)); if (isset($this->data)) unset($this->data[$this->pkField]); } // 前置回调处理 if (false === $this->controller->callback('_save_filter', $this->query, $this->data)) { return false; } // 执行更新操作 $result = $this->query->where($this->where)->update($this->data) !== false; // 结果回调处理 if (false === $this->controller->callback('_save_result', $result)) { return $result; } // 回复前端结果 if ($result !== false) { $this->controller->success('数据更新成功!', ''); } else { $this->controller->error('数据更新失败, 请稍候再试!'); } } }