1234567891011121314151617181920 |
- //编辑
- public function edit(){
- $id = $this->request->param('id');
- $info = $this->model->find($id);
- $post = CommonFun::filterPostData($this->request->post());{%validate%}{%adminUserId%}{%uploadDomainFields%}{%unsetFields%}
- foreach ($post as $k => $v) {
- $info->$k = $v;
- }
- try {
- $updateRes = $info->save();
- if ($updateRes) {
- return $this->success('编辑成功');
- } else {
- return $this->error('操作失败');
- }
- } catch (\Exception $e) {
- return $this->exceptionError($e);
- }
- }
|