コード例 #1
0
ファイル: Handler.php プロジェクト: pfdtk/bmsys
 /**
  * 自定义错误页
  */
 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);
     }
 }
コード例 #2
0
 /**
  * 删除用户组
  *
  * @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());
 }
コード例 #3
0
 /**
  * 删除文章评论
  *
  * @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());
 }
コード例 #4
0
 /**
  * 删除文章
  *
  * @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());
 }
コード例 #5
0
 /**
  * 删除文章分类
  *
  * @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());
 }
コード例 #6
0
ファイル: GroupController.php プロジェクト: jjzhai/mylaravel
 /**
  * 删除用户组
  *
  * @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());
 }
コード例 #7
0
ファイル: UserController.php プロジェクト: jjzhai/mylaravel
 /**
  * 修改自己的密码
  */
 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());
 }
コード例 #8
0
 /**
  * 把文章关联到推荐位
  */
 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'));
 }
コード例 #9
0
 /**
  * 删除工作流步骤
  *
  * @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());
 }
コード例 #10
0
 /**
  * 用户组权限入库
  * 
  * @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'));
 }
コード例 #11
0
ファイル: contact-api.php プロジェクト: Waldz/AddressBookApp
            $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();
コード例 #12
0
ファイル: GroupController.php プロジェクト: pfdtk/bmsys
 /**
  * 删除用户组
  *
  * @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);
 }
コード例 #13
0
ファイル: AclController.php プロジェクト: jjzhai/mylaravel
 /**
  * 用户组权限入库
  * 
  * @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());
 }
コード例 #14
0
ファイル: IndexController.php プロジェクト: pfdtk/bmsys
 /**
  * 删除工作流
  *
  * @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);
 }
コード例 #15
0
ファイル: AclController.php プロジェクト: pfdtk/bmsys
 /**
  * 用户组权限入库
  * 
  * @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'));
 }
コード例 #16
0
ファイル: CategoryController.php プロジェクト: pfdtk/bmsys
 /**
  * 删除分类
  *
  * @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());
 }
コード例 #17
0
 /**
  * 修改自己的密码
  */
 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());
 }
コード例 #18
0
ファイル: UserController.php プロジェクト: pfdtk/bmsys
 /**
  * 修改自己的密码
  */
 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);
 }
コード例 #19
0
 /**
  * 排序关联的文章
  */
 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);
 }