repository = $repository; } public function saveForm($uid) { return app('json')->success(formToData($this->repository->extendInfoForm((int)$uid))); } /** * 保存或修改 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * * @date 2023/09/26 * @author yyw */ public function save($uid) { $data = $this->request->param(); $save_data = []; // 组合数据 foreach ($data as $key => $item) { $save_data[] = [ 'field' => $key, 'value' => $item, ]; } $this->repository->save((int)$uid, $save_data); return app('json')->success('操作成功'); } }