_model = new UserModel(); } public function index() { return __METHOD__; } public function update() { try { $id = $this->request->getPost('id'); $point = $this->request->getPost('point'); $sign = $this->request->getPost('point') ?: "+"; $entity = is_numeric($id) ? $this->_model->getEntityByPK(intval($id)) : $this->_model->getEntityByID($id); if (!$entity) { throw new \Exception(sprintf("해당 회원[%s:%s]이 없습니다.", gettype($id), $id)); } if (!is_numeric($point)) { throw new \Exception("포인트 값에 {$point}를 사용할 수 없습니다."); } $entity = $this->setUserPointByMangboardTrait($entity, intval($point), $sign); return "완료되었습니다."; } catch (\Exception $e) { log_message("error", $e->getMessage()); return $e->getMessage(); } } }