save($data); } /** * 编辑记录 */ public function edit($data) { $data['update_time'] = time(); return $this->save($data); } /** * 删除 */ public function remove() { // 判断是否存在 $Count = (new MemberModel())->where('position_id','=' ,$this['position_id'])->where('is_delete','=', 0)->count(); if ($Count > 0) { $this->error = '该职务使用中,不允许删除'; return false; } return $this->delete(); } /** * 开启禁止 */ public function setStatus($status) { // 开启事务 $this->startTrans(); try { //更改分会状态 $this->save(['status' => $status]); $this->commit(); return true; } catch (\Exception $e) { $this->error = $e->getMessage(); $this->rollback(); return false; } } }