/** * 自定义错误页 */ protected function renderHttpException(HttpException $e) { if (Request::ajax() and !config('app.debug')) { return responseJson($e->getStatusCode(), false); } elseif (view()->exists('error.common') and !config('app.debug')) { return response()->view('error.common', ['errorCode' => $e->getStatusCode()], $e->getStatusCode()); } else { return (new SymfonyDisplayer(config('app.debug')))->createResponse($e); } }
/** * 删除用户组 * * @access public */ public function delete() { $id = with(new GroupValidate())->deleteIds((array) Request::input('id')); if (!$id or !is_array($id)) { return responseJson(Lang::get('common.action_error')); } $groupInfos = app('model.admin.group')->getGroupInIds($id); if (app('process.admin.group')->detele($id)) { $this->setActionLog(['groupInfos' => $groupInfos]); return responseJson(Lang::get('common.action_success'), true); } return responseJson(app('process.admin.group')->getErrorMessage()); }
/** * 删除文章评论 * * @access public */ public function delete() { if (!($id = Request::input('id'))) { return responseJson(Lang::get('common.action_error')); } $id = array_map('intval', (array) $id); $comment = $this->commentModel->getCommentInIds($id); if ($this->commentProcess->delete($id)) { $this->setActionLog(['comment' => $comment]); return responseJson(Lang::get('common.action_success'), true); } return responseJson($this->commentProcess->getErrorMessage()); }
/** * 删除文章 * * @access public */ public function delete() { if (!($id = Request::input('id'))) { return responseJson(Lang::get('common.action_error')); } if (!is_array($id)) { $id = array($id); } $manager = new ContentActionProcess(); if ($manager->detele($id)) { return responseJson(Lang::get('common.action_success'), true); } return responseJson($manager->getErrorMessage()); }
/** * 删除文章分类 * * @access public */ public function delete() { if (!($id = Request::input('id'))) { return responseJson(Lang::get('common.action_error')); } if (!is_array($id)) { $id = array($id); } $id = array_map('intval', $id); if ($this->tagProcess->delete($id)) { $this->setActionLog(['id' => $id]); return responseJson(Lang::get('common.action_success'), true); } return responseJson($this->tagProcess->getErrorMessage()); }
/** * 删除用户组 * * @access public */ public function delete() { $id = Request::input('id'); if (!is_array($id)) { if (!($id = url_param_decode($id))) { return responseJson(Lang::get('common.action_error')); } $id = array($id); } $id = array_map('intval', $id); $groupModel = new GroupModel(); $groupInfos = $groupModel->getGroupInIds($id); $manager = new GroupActionProcess(); if ($manager->detele($id)) { $this->setActionLog(['groupInfos' => $groupInfos]); return responseJson(Lang::get('common.action_success'), true); } return responseJson($manager->getErrorMessage()); }
/** * 修改自己的密码 */ public function mpassword() { $params = new \App\Services\Admin\User\Param\UserModifyPassword(); $params->setOldPassword(Request::input('old_password'))->setNewPassword(Request::input('new_password'))->setNewPasswordRepeat(Request::input('new_password_repeat')); $manager = new UserActionProcess(); if ($manager->modifyPassword($params)) { (new \App\Services\Admin\Login\Process())->getProcess()->logout(); return responseJson(Lang::get('common.action_success'), true); } return responseJson($manager->getErrorMessage()); }
/** * 把文章关联到推荐位 */ public function position() { $ids = array_map('intval', (array) Request::input('ids')); $pids = array_map('intval', (array) Request::input('pids')); if ($this->contentProcess->articlePositionRelation($ids, $pids) !== false) { $info = $this->contentModel->getArticleInIds($ids); $position = $this->positionModel->getPositionInIds($pids); $this->setActionLog(['info' => $info, 'position' => $position]); return responseJson(Lang::get('common.action_success'), true); } return responseJson(Lang::get('common.action_error')); }
/** * 删除工作流步骤 * * @access public */ public function delete() { $id = Request::input('id'); if (!$id) { return responseJson(Lang::get('common.action_error')); } $id = array_map('intval', (array) $id); $info = $this->workflowProcess->workflowStepInfos(['ids' => $id]); if ($this->workflowProcess->deleteWorkflowStep(['ids' => $id])) { $this->setActionLog(['workflowStepInfo' => $info]); return responseJson(Lang::get('common.action_success'), true); } return responseJson($this->workflowProcess->getErrorMessage()); }
/** * 用户组权限入库 * * @return boolean true|false */ private function saveGroupPermissionToDatabase() { $this->checkFormHash(); $id = Request::input('id'); $all = Request::input('all'); if (!$id or !is_numeric($id) or !$all) { return responseJson(Lang::get('common.illegal_operation')); } if (!app('admin.acl')->checkGroupLevelPermission($id, Acl::GROUP_LEVEL_TYPE_GROUP)) { return responseJson(Lang::get('common.account_level_deny')); } app('param.admin.aclset')->setPermission(Request::input('permission'))->setAll($all)->setId($id); if (!app('process.admin.acl')->setGroupAcl(app('param.admin.aclset'))) { return responseJson(app('process.admin.acl')->getErrorMessage()); } $this->setActionLog(); return responseJson(Lang::get('common.action_success')); }
$contactRepository->contactSave($contact); $contactRepository->fetchSupervisors([$contact]); responseJson(200, ContactTransformer::toTransient($contact)); break; case 'put': $contact = fetchContact($contactRepository); $contact = ContactTransformer::fromRequest(requestParseJson(), $contact); $errors = ContactValidator::validate($contact); if (count($errors) > 0) { responseJson(400, $errors); } $contactRepository->contactSave($contact); $contactRepository->fetchSupervisors([$contact]); responseJson(200, ContactTransformer::toTransient($contact)); break; case 'delete': $contact = fetchContact($contactRepository); $contactRepository->contactDelete($contact); responseJson(200, []); break; case 'get': default: $contact = fetchContact($contactRepository); responseJson(200, ContactTransformer::toTransient($contact)); break; } } catch (\Exception $e) { // In case of bootstrap error do not show blank screen. responseJson(500, ['message' => $e->getMessage(), 'trace' => $e->getTraceAsString()]); } $application->shutdown();
/** * 删除用户组 * * @access public */ public function delete(GroupValidate $groupValidate, GroupModel $groupModel, GroupProcess $manager) { $id = $groupValidate->deleteIds((array) Request::input('id')); if (!$id or !is_array($id)) { return responseJson(Lang::get('common.action_error')); } $groupInfos = $groupModel->getGroupInIds($id); if (!$manager->detele($id)) { return responseJson($manager->getErrorMessage()); } $this->setActionLog(['groupInfos' => $groupInfos]); return responseJson(Lang::get('common.action_success'), true); }
/** * 用户组权限入库 * * @return boolean true|false */ private function saveGroupPermissionToDatabase() { $this->checkFormHash(); $permissions = (array) Request::input('permission'); $id = Request::input('id'); $all = Request::input('all'); if (!$id or !is_numeric($id) or !$all) { return responseJson(Lang::get('common.illegal_operation')); } if (!(new Acl())->checkGroupLevelPermission($id, Acl::GROUP_LEVEL_TYPE_GROUP)) { return responseJson(Lang::get('common.account_level_deny')); } $params = new \App\Services\Admin\Acl\Param\AclSet(); $params->setPermission($permissions)->setAll($all)->setId($id); $manager = new AclActionProcess(); $result = $manager->setGroupAcl($params); if ($result) { $this->setActionLog(); return responseJson(Lang::get('common.action_success')); } return responseJson($manager->getErrorMessage()); }
/** * 删除工作流 * * @access public */ public function delete(Process $manager) { $id = array_map('intval', (array) Request::input('id')); $info = $manager->workflowInfos(['ids' => $id]); if (!$manager->deleteWorkflow(['ids' => $id])) { return responseJson($manager->getErrorMessage()); } $this->setActionLog(['workflowInfo' => $info]); return responseJson(Lang::get('common.action_success'), true); }
/** * 用户组权限入库 * * @return boolean true|false */ private function saveGroupPermission() { $this->checkFormHash(); $permissions = (array) Request::input('permission'); $id = (int) Request::input('id'); $all = Request::input('all'); if (!(new Acl())->checkGroupLevelPermission($id, Acl::GROUP_LEVEL_TYPE_GROUP)) { return responseJson(Lang::get('common.account_level_deny')); } $params = new AclSet(); $manager = new AclProcess(); $params->setPermission($permissions)->setAll($all)->setId($id); if (!$manager->setGroupAcl($params)) { return responseJson($manager->getErrorMessage()); } $this->setActionLog(); return responseJson(Lang::get('common.action_success')); }
/** * 删除分类 * * @access public */ public function delete(ProductCategoryProcess $manager) { $shopCid = (array) Request::input('id'); if ($manager->detele($shopCid) !== false) { return responseJson(Lang::get('common.action_success'), true); } return responseJson($manager->getErrorMessage()); }
/** * 修改自己的密码 */ public function mpassword() { app('param.admin.usermp')->setOldPassword(Request::input('old_password'))->setNewPassword(Request::input('new_password'))->setNewPasswordRepeat(Request::input('new_password_repeat')); if (app('process.admin.user')->modifyPassword(app('param.admin.usermp'))) { (new LoginProcess())->getProcess()->logout(); return responseJson(Lang::get('common.action_success'), true); } return responseJson(app('process.admin.user')->getErrorMessage()); }
/** * 修改自己的密码 */ public function mpassword(UserModifyPassword $params, UserProcess $manager, LoginProcess $loginManager) { $params->setOldPassword(Request::input('old_password'))->setNewPassword(Request::input('new_password'))->setNewPasswordRepeat(Request::input('new_password_repeat')); if (!$manager->modifyPassword($params)) { return responseJson($manager->getErrorMessage()); } $loginManager->getProcess()->logout(); return responseJson(Lang::get('common.action_success'), true); }
/** * 排序关联的文章 */ public function sortrelation() { $data = (array) Request::input('data'); $prid = ''; foreach ($data as $key => $value) { $prid = $value['prid']; $update = $this->pProcess->sortRelation($value['prid'], $value['sort']); if ($update === false) { $err = true; } } if (isset($err)) { return responseJson(Lang::get('common.action_error')); } $this->setActionLog(['prid' => $prid]); return responseJson(Lang::get('common.action_success'), true); }