/**
  * 评论
  */
 public function add()
 {
     $data['object_id'] = (int) Request::input('objectid');
     $data['object_type'] = (int) Request::input('object_type');
     $data['nickname'] = strip_tags(Request::input('nickname'));
     $data['content'] = strip_tags(Request::input('comment'));
     $data['replyid'] = (int) Request::input('replyid');
     $commentProcess = new CommentProcess();
     if ($commentProcess->addComment($data) !== false) {
         return response(Js::execute('window.parent.reloadComment();'));
     }
     return response(Js::error($commentProcess->getErrorMessage()));
 }
Esempio n. 2
0
 /**
  * 编辑入库
  *
  * @access private
  */
 private function editShopCategory()
 {
     $params = new CategorySave();
     $manager = new ProductCategoryProcess();
     $httpReferer = Session::getOldInput('http_referer');
     $data = (array) Request::input('data');
     $data['update_time'] = time();
     $params->setAttributes($data);
     if ($manager->editShopCategory($params) !== false) {
         $backUrl = !empty($httpReferer) ? $httpReferer : route('shop.category.index');
         return Js::locate($backUrl, 'parent');
     }
     return Js::error($manager->getErrorMessage());
 }
Esempio n. 3
0
 /**
  * 对用户组进行权限设置
  * 
  * @access public
  */
 public function group(GroupModel $groupModel, Acl $acl, AclProcess $process)
 {
     if (Request::method() == 'POST') {
         return $this->saveGroupPermission();
     }
     $id = url_param_decode(Request::input('id'));
     if (!$id or !is_numeric($id)) {
         return Js::error(Lang::get('common.illegal_operation'), true);
     }
     $info = $groupModel->getOneGroupById(intval($id));
     if (empty($info)) {
         return Js::error(Lang::get('common.illegal_operation'), true);
     }
     if (!$acl->checkGroupLevelPermission($id, Acl::GROUP_LEVEL_TYPE_GROUP)) {
         return Js::error(Lang::get('common.account_level_deny'), true);
     }
     $zTree = $process->prepareDataForZtree($process->getGroupAccessPermissionIds($id));
     $all = $process->prepareUserPermissionIds();
     $router = 'group';
     return view('admin.acl.setpermission', compact('zTree', 'id', 'info', 'router', 'all'));
 }
Esempio n. 4
0
 /**
  * 更新用户信息到数据库
  *
  * @access private
  */
 private function updateUserInfoToDatabase()
 {
     $httpReferer = Session::getOldInput('http_referer');
     $data = Request::input('data');
     if (!$data or !is_array($data)) {
         return Js::error(Lang::get('common.info_incomplete'));
     }
     $param = new \App\Services\Admin\User\Param\UserSave();
     $param->setAttributes($data);
     $manager = new UserActionProcess();
     if ($manager->editUser($param)) {
         $this->setActionLog();
         $backUrl = !empty($httpReferer) ? $httpReferer : R('common', 'foundation.user.index');
         return Js::locate($backUrl, 'parent');
     }
     return Js::error($manager->getErrorMessage());
 }
 /**
  * 编辑用户组入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $httpReferer = Session::getOldInput('http_referer');
     $data = (array) Request::input('data');
     app('param.admin.groupsave')->setAttributes($data);
     if (app('process.admin.group')->editGroup(app('param.admin.groupsave'))) {
         $this->setActionLog();
         $backUrl = !empty($httpReferer) ? $httpReferer : R('common', 'foundation.group.index');
         return Js::locate($backUrl, 'parent');
     }
     return Js::error(app('process.admin.group')->getErrorMessage());
 }
 /**
  * 编辑文章入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $httpReferer = Session::getOldInput('http_referer');
     $data = (array) Request::input('data');
     $data['tags'] = explode(';', $data['tags']);
     $this->contentSave->setAttributes($data);
     $id = intval(Request::input('id'));
     if ($this->contentProcess->editContent($this->contentSave, $id) !== false) {
         $this->setActionLog(['param' => $this->contentSave]);
         $backUrl = !empty($httpReferer) ? $httpReferer : R('common', 'blog.content.index');
         return Js::locate($backUrl, 'parent');
     }
     return Js::error($this->contentProcess->getErrorMessage());
 }
Esempio n. 7
0
 /**
  * 编辑文章入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $data = (array) Request::input('data');
     $id = intval(Request::input('id'));
     $data['tags'] = explode(';', $data['tags']);
     $param = new \App\Services\Admin\Content\Param\ContentSave();
     $param->setAttributes($data);
     $manager = new ContentActionProcess();
     if ($manager->editContent($param, $id) !== false) {
         return Js::locate(R('common', 'blog.content.index'), 'parent');
     }
     return Js::error($manager->getErrorMessage());
 }
 /**
  * 编辑推荐位入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $httpReferer = Session::getOldInput('http_referer');
     $data = Request::input('data');
     if (!$data or !is_array($data)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     $this->pSave->setAttributes($data);
     if ($this->pProcess->editPosition($this->pSave)) {
         $this->setActionLog(['param' => $this->pSave]);
         $backUrl = !empty($httpReferer) ? $httpReferer : R('common', 'blog.position.index');
         return Js::locate($backUrl, 'parent');
     }
     return Js::error($this->pProcess->getErrorMessage());
 }
 /**
  * 编辑工作流入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $data = Request::input('data');
     if (!$data or !is_array($data)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     $this->workflowSaveParam->setAttributes($data);
     if ($this->workflowProcess->editWorkflow($this->workflowSaveParam)) {
         $this->setActionLog();
         return Js::locate(R('common', 'workflow.index.index'), 'parent');
     }
     return Js::error($this->workflowProcess->getErrorMessage());
 }
Esempio n. 10
0
 /**
  * 编辑文章分类入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $data = Request::input('data');
     if (!$data or !is_array($data)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     $param = new \App\Services\Admin\Category\Param\CategorySave();
     $param->setAttributes($data);
     $manager = new CategoryActionProcess();
     if ($manager->editCategory($param)) {
         return Js::locate(R('common', 'blog.category.index'), 'parent');
     }
     return Js::error($manager->getErrorMessage());
 }
Esempio n. 11
0
 /**
  * 编辑用户组入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $httpReferer = Session::getOldInput('http_referer');
     $data = Request::input('data');
     if (!$data or !is_array($data)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     $params = new \App\Services\Admin\Group\Param\GroupSave();
     $params->setAttributes($data);
     $manager = new GroupActionProcess();
     if ($manager->editGroup($params)) {
         $this->setActionLog();
         $backUrl = !empty($httpReferer) ? $httpReferer : R('common', 'foundation.group.index');
         return Js::locate($backUrl, 'parent');
     }
     return Js::error($manager->getErrorMessage());
 }
Esempio n. 12
0
 /**
  * 编辑用户组
  *
  * @access private
  */
 private function updateGroup()
 {
     $params = new GroupSave();
     $manager = new GroupProcess();
     $httpReferer = Session::getOldInput('http_referer');
     $params->setAttributes((array) Request::input('data'));
     if (!$manager->editGroup($params)) {
         return Js::error($manager->getErrorMessage());
     }
     $this->setActionLog();
     return Js::locate(!empty($httpReferer) ? $httpReferer : route('foundation.group.index'), 'parent');
 }
Esempio n. 13
0
 /**
  * 对用户组进行权限设置
  * 
  * @access public
  */
 public function group()
 {
     if (Request::method() == 'POST') {
         return $this->saveGroupPermissionToDatabase();
     }
     $id = url_param_decode(Request::input('id'));
     if (!$id or !is_numeric($id)) {
         return Js::error(Lang::get('common.illegal_operation'), true);
     }
     $info = (new GroupModel())->getOneGroupById(intval($id));
     if (empty($info)) {
         return Js::error(Lang::get('common.illegal_operation'), true);
     }
     if (!(new Acl())->checkGroupLevelPermission($id, Acl::GROUP_LEVEL_TYPE_GROUP)) {
         return Js::error(Lang::get('common.account_level_deny'), true);
     }
     //取回用户组所拥有的权限列表
     $list = (array) SC::getUserPermissionSession();
     //当前所要编辑的用户组的权限,用于标识是否已经勾选
     $groupAcl = (new AccessModel())->getGroupAccessPermission(intval($id));
     $hasPermissions = array();
     foreach ($groupAcl as $key => $value) {
         $hasPermissions[] = $value['permission_id'];
     }
     //为ztree做数据准备
     $zTree = [];
     $all = [];
     foreach ($list as $key => $value) {
         $arr = ['id' => $value['id'], 'pId' => $value['pid'], 'name' => $value['name'], 'open' => true];
         if (in_array($value['id'], $hasPermissions)) {
             $arr['checked'] = true;
         }
         $zTree[] = $arr;
         $all[] = $value['id'];
     }
     $router = 'group';
     return view('admin.acl.setpermission', compact('zTree', 'id', 'info', 'router', 'all'));
 }
Esempio n. 14
0
 /**
  * 编辑工作流入库处理
  *
  * @access private
  */
 private function updateWorkflow()
 {
     $params = new WorkflowSave();
     $manager = new Process();
     $params->setAttributes((array) Request::input('data'));
     if (!$manager->editWorkflow($params)) {
         return Js::error($manager->getErrorMessage());
     }
     $this->setActionLog();
     return Js::locate(route('workflow.index.index'), 'parent');
 }
 /**
  * 回复评论
  */
 private function commentReply()
 {
     $data['object_id'] = (int) Request::input('objectid');
     $data['object_type'] = (int) Request::input('object_type');
     $data['nickname'] = strip_tags(Request::input('nickname'));
     $data['content'] = strip_tags(Request::input('comment'));
     $data['replyid'] = (int) Request::input('replyid');
     $insertId = $this->commentProcess->addComment($data);
     if ($insertId !== false) {
         $this->setActionLog(['replyid' => $data['replyid'], 'object_id' => $data['object_id'], 'content' => $data['content']]);
         return Js::execute('window.parent.loadComment(' . $insertId . ');');
     }
     return Js::error($this->commentProcess->getErrorMessage()) . Js::execute('window.parent.reloadDialogTitle();');
 }
Esempio n. 16
0
 /**
  * 设置审核步骤与用户的关联
  *
  * @access private
  */
 private function setRelation()
 {
     $this->checkFormHash();
     $stepId = (int) Request::input('stepId');
     $workflowId = (int) Request::input('workflowId');
     $userIds = Request::input('ids');
     if (!$userIds) {
         return Js::error(Lang::get('workflow.relation_user_empty'));
     }
     if (!$stepId or !$workflowId or !is_array($userIds)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     $userIds = array_map('intval', $userIds);
     $stepInfo = $this->workflowProcess->workflowStepInfo(['id' => $stepId]);
     if (empty($stepInfo)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     if ($this->workflowProcess->setRelation($workflowId, $stepId, $userIds)) {
         $this->setActionLog(['userIds' => $userIds, 'stepInfo' => $stepInfo]);
         return Js::alert(Lang::get('common.action_success'));
     }
     return Js::error($this->workflowProcess->getErrorMessage());
 }
Esempio n. 17
0
 /**
  * 更新用户信息到数据库
  *
  * @access private
  */
 private function updateUserInfo()
 {
     $httpReferer = Session::getOldInput('http_referer');
     $data = (array) Request::input('data');
     $manager = new UserProcess();
     if (!$manager->editUser($manager->userSaveParams($data))) {
         return Js::error($manager->getErrorMessage());
     }
     $this->setActionLog();
     return Js::locate(!empty($httpReferer) ? $httpReferer : route('foundation.user.index'), 'parent');
 }
Esempio n. 18
0
 /**
  * 编辑工作流入库处理
  *
  * @access private
  */
 private function updateDatasToDatabase()
 {
     $data = Request::input('data');
     if (!$data or !is_array($data)) {
         return Js::error(Lang::get('common.illegal_operation'));
     }
     $params = new \App\Services\Admin\Workflow\Param\WorkflowSave();
     $params->setAttributes($data);
     $manager = new Process();
     if ($manager->editWorkflow($params)) {
         $this->setActionLog();
         return Js::locate(R('common', 'workflow.index.index'), 'parent');
     }
     return Js::error($manager->getErrorMessage());
 }