where = $where; $this->query = $this->buildQuery($dbQuery); $this->data = empty($data) ? $this->app->request->post() : $data; $this->field = empty($field) ? $this->query->getPk() : $field; $this->value = $this->app->request->post($this->field, null); // 主键限制处理 if (!isset($this->where[$this->field]) && is_string($this->value)) { $this->query->whereIn($this->field, explode(',', $this->value)); if (isset($this->data)) unset($this->data[$this->field]); } // 前置回调处理 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(lang('think_library_save_success'), ''); } else { $this->controller->error(lang('think_library_save_error')); } } }