public function doaddAction() { $pageid = (int)$this->getInput('pageid', 'post'); $moduleid = (int)$this->getInput('moduleid', 'post'); $isnotice = (int)$this->getInput('isnotice', 'post'); $fromid = (int)$this->getInput('fromid', 'post'); $fromtype = $this->getInput('fromtype', 'post'); $start = $this->getInput('start_time', 'post'); $end = $this->getInput('end_time', 'post'); if ($moduleid < 1) $this->showError("operate.fail"); $permiss = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $pageid); $pushService = $this->_getPushService(); $data = $pushService->getDataByFromid($fromtype, $fromid); Wind::import('SRV:design.bo.PwDesignModuleBo'); $bo = new PwDesignModuleBo($moduleid); $time = Pw::getTime(); $startTime = $start ? Pw::str2time($start) : $time; $endTime = $end ? Pw::str2time($end) : $end; if ($end && $endTime < $time) $this->showError("DESIGN:endtimd.error"); $pushDs = $this->_getPushDs(); Wind::import('SRV:design.dm.PwDesignPushDm'); $dm = new PwDesignPushDm(); $dm->setFromid($fromid) ->setModuleId($moduleid) ->setCreatedUserid($this->loginUser->uid) ->setCreatedTime($time) ->setStartTime($startTime) ->setEndTime($endTime) ->setAuthorUid($data['uid']); if ($isnotice) $dm->setNeedNotice(1); if ($permiss <= PwDesignPermissions::NEED_CHECK) { $dm->setStatus(PwDesignPush::NEEDCHECK); $isdata = false; } else { $isdata = true; } $resource = $pushService->addPushData($dm); if ($resource instanceof PwError) $this->showError($resource->getError()); if ($isdata) { $pushService->pushToData((int)$resource); $pushService->afterPush((int)$resource); } $this->showMessage("operate.success"); }
public function doaddAction() { $orderid = (int) $this->getInput('vieworder', 'post'); $start = $this->getInput('start_time', 'post'); $end = $this->getInput('end_time', 'post'); $data = $this->getInput('data', 'post'); $images = $this->getInput('images', 'post'); $bold = $this->getInput('bold', 'post'); $italic = $this->getInput('italic', 'post'); $underline = $this->getInput('underline', 'post'); $color = $this->getInput('color', 'post'); $standard = $this->_getDesignService()->getStandardSignkey($this->bo->getModel()); if (!$data[$standard['sTitle']]) { $this->showError("operate.fail"); } foreach ((array) $images as $k => $v) { if ($_FILES[$k]['name'] && ($image = $this->_uploadFile($k, $this->bo->moduleid))) { $data[$k] = $image; } else { $data[$k] = ''; } } $time = Pw::getTime(); $startTime = $start ? Pw::str2time($start) : $time; $endTime = $end ? Pw::str2time($end) : $end; if ($end && $endTime < $time) { $this->showError("DESIGN:endtimd.error"); } $ds = $this->_getPushDs(); if ($orderid) { $ds->updateAutoByModuleAndOrder($this->bo->moduleid, $orderid); $this->_getDataDs()->updateFixedToAuto($this->bo->moduleid, $orderid); } Wind::import('SRV:design.dm.PwDesignPushDm'); $pushDm = new PwDesignPushDm(); $pushDm->setAuthorUid($this->loginUser->uid)->setCreatedUserid($this->loginUser->uid)->setExtend($data)->setFormModel('design')->setModuleId($this->bo->moduleid)->setOrderid($orderid)->setStandard($standard)->setStyle($bold, $underline, $italic, $color)->setCreatedTime($time)->setStartTime($startTime)->setEndTime($endTime); $pushid = $ds->addPush($pushDm); if ($pushid instanceof PwError) { $this->showError($resource->getError()); } $pushDm = new PwDesignPushDm($pushid); $pushDm->setFromid($pushid)->setModuleId($this->bo->moduleid); $ds->updatePush($pushDm); $pushService = $this->_getPushService(); $pushService->pushToData($pushid); $this->showMessage("operate.success"); }
public function doaddAction() { $pageid = (int) $this->getInput('pageid', 'post'); $moduleid = (int) $this->getInput('moduleid', 'post'); $isnotice = (int) $this->getInput('isnotice', 'post'); $fromid = (int) $this->getInput('fromid', 'post'); $fromtype = $this->getInput('fromtype', 'post'); $start = $this->getInput('start_time', 'post'); $end = $this->getInput('end_time', 'post'); /* 增加推送帖子到移动版start */ if ($pageid === 0 && $moduleid === 0) { //推送移动端热帖 $tid = (int) $this->getInput('tid'); $tid || $this->showError("operate.fail"); // $this->forwardRedirect(WindUrlHelper::createUrl('native/dynamic/sethot')); $threadsWeightDao = Wekit::loadDao('native.dao.PwThreadsWeightDao'); //获取帖子最高权重,将其作为管理员推送帖子的初始权重置顶 $weightData = $threadsWeightDao->getMaxWeight(); isset($weightData['weight']) ? $max_weight = intval($weightData['weight']) + 1 : 1; // $data = array('create_time' => time(), 'weight' => $max_weight, 'create_userid' => $this->loginUser->uid, 'create_username' => $this->loginUser->username, 'tid' => $tid); $threadWeight = $threadsWeightDao->getByTid($tid); if ($threadWeight) { //更新数据 $res = $threadsWeightDao->updateValue($data); } else { //新增数据 $res = $threadsWeightDao->insertValue($data); } if ($res) { $thread = Wekit::load('forum.PwThread')->getThread($tid); $push_msg = '《' . $thread['subject'] . '》已被推荐热贴'; Wekit::load("APPS:native.service.PwLaiWangSerivce"); PwLaiWangSerivce::pushMessage($thread['created_userid'], $push_msg, $push_msg); // $this->showMessage('NATIVE:sethot.success'); } else { $this->showMessage('NATIVE:sethot.failed'); } } /* 增加推送帖子到移动版end */ if ($moduleid < 1) { $this->showError("operate.fail"); } $permiss = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $pageid); $pushService = $this->_getPushService(); $data = $pushService->getDataByFromid($fromtype, $fromid); Wind::import('SRV:design.bo.PwDesignModuleBo'); $bo = new PwDesignModuleBo($moduleid); $time = Pw::getTime(); $startTime = $start ? Pw::str2time($start) : $time; $endTime = $end ? Pw::str2time($end) : $end; if ($end && $endTime < $time) { $this->showError("DESIGN:endtimd.error"); } $pushDs = $this->_getPushDs(); Wind::import('SRV:design.dm.PwDesignPushDm'); $dm = new PwDesignPushDm(); $dm->setFromid($fromid)->setModuleId($moduleid)->setCreatedUserid($this->loginUser->uid)->setCreatedTime($time)->setStartTime($startTime)->setEndTime($endTime)->setAuthorUid($data['uid']); if ($isnotice) { $dm->setNeedNotice(1); } if ($permiss <= PwDesignPermissions::NEED_CHECK) { $dm->setStatus(PwDesignPush::NEEDCHECK); $isdata = false; } else { $isdata = true; } $resource = $pushService->addPushData($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } if ($isdata) { $pushService->pushToData((int) $resource); $pushService->afterPush((int) $resource); } $this->showMessage("operate.success"); }