postData(); $list = $model->getList($postData); return $this->renderSuccess('', compact('list')); } /** * 新增股东 */ public function add() { if ($this->request->isGet()) { $positionList = PositionModel::getList(); return $this->renderSuccess('', compact('positionList')); } $user_id = $this->postData('user_id'); if (MemberModel::detail($user_id)) { return $this->renderError('该用户已经是连盟成员,不能重复添加'); } $model = new MemberModel; // 新增记录 if ($model->add($this->postData())) { return $this->renderSuccess('添加成功'); } return $this->renderError('添加失败'); } /** * 编辑成员 */ public function edit() { if ($this->request->isGet()) { $positionList = PositionModel::getList(); return $this->renderSuccess('', compact('positionList')); } $user_id = $this->postData('user_id'); $model = MemberModel::detail($user_id); if ($model->edit($this->postData())) { return $this->renderSuccess('更新成功'); } return $this->renderError($model->getError() ?: '更新失败'); } /** * 软删除成员 */ public function delete($user_id) { $model = MemberModel::detail($user_id); if (!$model->setDelete()) { return $this->renderError('删除失败'); } return $this->renderSuccess('删除成功'); } }