public function updatePush(PwDesignPushDm $dm) { $resource = $dm->beforeUpdate(); if ($resource instanceof PwError) { return $resource; } return $this->_getDao()->updatePush($dm->pushid, $dm->getData()); }
/** * 添加推送数据到推送表 */ public function addPushData(PwDesignPushDm $dm) { $data = $dm->getData(); Wind::import('SRV:design.srv.data.PwModuleData'); $srv = new PwModuleData($data['module_id']); $_data = $srv->buildDataByIds($data['push_from_id']); $_data = array_shift($_data); if (!$_data) { return new PwError('DESIGN:push.data.error'); } $dm->setFormModel($_data['standard_fromapp'])->setStandard($_data['standard'])->setExtend($_data['extend']); return Wekit::load('design.PwDesignPush')->addPush($dm); }
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 batchEditDataAction() { $dataid = $this->getInput('dataid', 'post'); $order_tmp = $vieworder = $this->getInput('vieworder', 'post'); $vieworder_tmp = $this->getInput('vieworder_tmp', 'post'); $vieworder_reserv = $this->getInput('vieworder_reserv', 'post'); $isfixed = $this->getInput('isfixed', 'post'); Wind::import('SRV:design.dm.PwDesignDataDm'); Wind::import('SRV:design.dm.PwDesignPushDm'); $ds = $this->_getDataDs(); //转换排序数字 asort($vieworder); $i = 1; foreach ($vieworder as &$order) { $order = $i; $i++; } foreach ($dataid as $id) { $data = $ds->getData($id); if ($data['is_reservation']) { continue; } $dm = new PwDesignDataDm($id); $orderid = (int) $vieworder[$id]; if ($isfixed[$id]) { $dm->setDatatype(PwDesignData::ISFIXED); if ($data['from_type'] == PwDesignData::FROM_PUSH) { $this->_getPushDs()->updateAutoByModuleAndOrder($data['module_id'], $orderid); $pushDm = new PwDesignPushDm($data['from_id']); $pushDm->setOrderid($orderid); $this->_getPushDs()->updatePush($pushDm); } } else { $dm->setDatatype(PwDesignData::AUTO); if ($data['from_type'] == PwDesignData::FROM_PUSH) { $pushDm = new PwDesignPushDm($data['from_id']); $pushDm->setOrderid(0); $this->_getPushDs()->updatePush($pushDm); } } $dm->setVieworder($orderid); //产品要求,没显性改过排序的不作编辑处理...... if ($order_tmp[$id] != $vieworder_tmp[$id]) { $dm->setEdited(1); } $ds->updateData($dm); } //预订 foreach ($dataid as $id) { $data = $ds->getData($id); if (!$data['is_reservation']) { continue; } $dm = new PwDesignDataDm($id); $orderid = (int) $vieworder_reserv[$id]; if ($isfixed[$id]) { $dm->setDatatype(PwDesignData::ISFIXED); $dm->setVieworder($orderid); if ($data['from_type'] == PwDesignData::FROM_PUSH) { $this->_getPushDs()->updateAutoByModuleAndOrder($data['module_id'], $orderid); $ds->updateFixedToAuto($data['module_id'], $orderid); $pushDm = new PwDesignPushDm($data['from_id']); $pushDm->setOrderid($orderid); $this->_getPushDs()->updatePush($pushDm); } } else { $dm->setDatatype(PwDesignData::AUTO); if ($data['from_type'] == PwDesignData::FROM_PUSH) { $pushDm = new PwDesignPushDm($data['from_id']); $pushDm->setOrderid(0); $this->_getPushDs()->updatePush($pushDm); } } $ds->updateData($dm); } $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"); }