public function doeditAction() { $tpl = $this->getInput('tpl', 'post'); $compid = (int) $this->getInput('compid', 'post'); $tpl = $this->_getDesignService()->filterTemplate($tpl); if (!$this->_getDesignService()->checkTemplate($tpl)) { $this->showError("DESIGN:template.error"); } $property = $this->bo->getProperty(); $limit = $this->compileFor($tpl); $property['limit'] = $limit ? $limit : $property['limit']; Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($this->bo->moduleid); $dm->setModuleTpl($tpl)->setCompid($compid)->setProperty($property); $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } $module = $this->bo->getModule(); Wekit::load('design.srv.PwSegmentService')->updateSegmentByPageId($module['page_id']); Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($this->bo->moduleid); $srv->addAutoData(); $this->_getDesignService()->clearCompile(); if ($module['module_type'] == PwDesignModule::TYPE_SCRIPT) { $this->showMessage("operate.success", "design/module/run?type=api", true); } else { $this->showMessage("operate.success"); } }
public function run($cronId) { Wind::import('SRV:design.srv.data.PwAutoData'); $ds = Wekit::load('design.PwDesignCron'); $list = $ds->getAllCron(); foreach ($list as $v) { $srv = new PwAutoData($v['module_id']); $srv->addAutoData(); $ds->deleteCron($v['module_id']); sleep(2); } }
protected function docachePage($pageid) { $pageInfo = $this->_getPageDs()->getPage($pageid); $ids = explode(',', $pageInfo['module_ids']); Wind::import('SRV:design.srv.data.PwAutoData'); foreach ($ids as $id) { $id = (int) $id; if ($id < 1) { continue; } $srv = new PwAutoData($id); $srv->addAutoData(); } }
public function batchCheckPushAction() { $pushid = $this->getInput('pushid', 'post'); if (!$pushid) { $this->showError("operate.fail"); } $ds = $this->_getPushDs(); foreach ($pushid as $id) { $ds->updateStatus($id, PwDesignPush::ISSHOW); } Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($this->bo->moduleid); $srv->addAutoData(); $this->showMessage("operate.success"); }
public function doeditAction() { $other = array('html', 'searchbar', 'image'); $model = $this->getInput('model', 'post'); $moduleid = $this->getInput('moduleid', 'post'); if (!$moduleid) { $this->showError('operate.fail'); } Wind::import('SRV:design.bo.PwDesignModuleBo'); $moduleBo = new PwDesignModuleBo($moduleid); $_model = $moduleBo->getModel(); if ($model != $_model) { $this->_getDataDs()->deleteByModuleId($moduleid); $this->_getPushDs()->deleteByModuleId($moduleid); } !$model && ($model = $_model); $module = $moduleBo->getModule(); if (!$module || $module['page_id'] < 1) { $this->showError('operate.fail'); } Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($module['page_id']); if ($pageBo->getLock()) { $this->showError('DESIGN:page.edit.other.user'); } Wekit::load('design.PwDesignPermissions'); $permissions = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $module['page_id']); if ($permissions < PwDesignPermissions::IS_ADMIN && !in_array($module['model_flag'], $other)) { $this->showError("DESIGN:permissions.fail"); } if ($permissions < PwDesignPermissions::IS_PUSH) { $this->showError("DESIGN:permissions.fail"); } $name = trim($this->getInput('module_name', 'post')); if (empty($name)) { $this->showError('DESIGN:module.name.empty'); } $cache = $this->getInput('cache', 'post'); $property = $this->getInput('property', 'post'); if ($property['limit'] > 200) { $this->showError('DESIGN:maxlimit.error'); } $cls = sprintf('PwDesign%sDataService', ucwords($model)); Wind::import('SRV:design.srv.model.' . $model . '.' . $cls); $service = new $cls(); if (method_exists($service, 'decorateSaveProperty')) { $property = $service->decorateSaveProperty($property); if ($property instanceof PwError) { $this->showError($property->getError()); } } Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($moduleid); $dm->setFlag($model)->setName($name)->setProperty($property)->setCache($cache); if (isset($property['html_tpl'])) { $dm->setModuleTpl($property['html_tpl']); } $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($moduleid); $srv->addAutoData(); $this->showMessage("operate.success"); }
public function batchcheckAction() { $moduleids = array(); $pushids = $this->getInput('pushids', 'post'); $pushDs = $this->_getPushDs(); $srv = $this->_getPushService(); foreach ($pushids as $pushid) { $pushInfo = $pushDs->getPush($pushid); $pushDs->updateStatus($pushid, PwDesignPush::ISSHOW); $moduleids[] = $pushInfo['module_id']; } $moduleids = array_unique($moduleids); Wind::import('SRV:design.srv.data.PwAutoData'); foreach ($moduleids as $moduleid) { $srv = new PwAutoData($moduleid); $srv->addAutoData(); } //多模块不允许更新 $this->showMessage("operate.success"); }
public function doeditAction() { $tpl = $this->getInput('tpl', 'post'); $compid = (int) $this->getInput('compid', 'post'); $tpl = $this->_getDesignService()->filterTemplate($tpl); if (!$this->_getDesignService()->checkTemplate($tpl)) { $this->showError("DESIGN:template.error"); } $property = $this->bo->getProperty(); $limit = $this->compileFor($tpl); $property['limit'] = $limit ? $limit : $property['limit']; Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($this->bo->moduleid); $dm->setModuleTpl($tpl)->setCompid($compid)->setProperty($property); $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } //更新模版 $module = $this->bo->getModule(); if ($module['module_type'] == PwDesignModule::TYPE_IMPORT) { Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($this->pageid); $pageInfo = $pageBo->getPage(); Wind::import('SRV:design.srv.PwPortalCompile'); $compile = new PwPortalCompile($pageBo); if ($pageInfo['page_type'] == PwDesignPage::PORTAL) { $compile->replaceList($this->bo->moduleid, $tpl); } elseif ($pageInfo['page_type'] == PwDesignPage::SYSTEM) { !$module['segment'] && ($module['segment'] = ''); $compile->replaceList($this->bo->moduleid, $tpl, $module['segment']); } } //更机数据 Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($this->bo->moduleid); $srv->addAutoData(); $this->showMessage("operate.success"); }
/** * 刷新当前页面数据 */ public function refreshPage() { $list = Wekit::load('design.PwDesignModule')->getByPageid($this->pageid); Wind::import('SRV:design.srv.data.PwAutoData'); foreach ($list as $id => $v) { if ($id < 1) { continue; } $srv = new PwAutoData($id); $srv->addAutoData(); } //Wekit::load('design.srv.PwDesignService')->clearCompile(); return true; }
/** * 更新当前页数据 * Enter description here ... */ public function docacheAction() { $pageid = (int) $this->getInput('pageid', 'post'); $pageInfo = $this->_getPageDs()->getPage($pageid); if (!$pageInfo) { $this->showError("operate.fail"); } $permissions = $this->_getPermissionsService()->getPermissionsForPage($this->loginUser->uid, $pageid); if ($permissions < PwDesignPermissions::IS_PUSH) { $this->showError("DESIGN:permissions.fail"); } Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($pageid); if ($pageBo->getLock()) { $this->showError('DESIGN:page.edit.other.user'); } $list = $this->_getModuleDs()->getByPageid($pageid); Wind::import('SRV:design.srv.data.PwAutoData'); foreach ($list as $id => $v) { $id = (int) $id; if ($id < 1) { continue; } $srv = new PwAutoData($id); $srv->addAutoData(); } $this->_getDesignService()->clearCompile(); $this->showMessage("operate.success"); }
public function doeditAction() { $model = $this->getInput('model', 'post'); $moduleid = $this->getInput('moduleid', 'post'); if (!$moduleid) { $this->showError('operate.fail'); } Wind::import('SRV:design.bo.PwDesignModuleBo'); $moduleBo = new PwDesignModuleBo($moduleid); $_model = $moduleBo->getModel(); if ($model != $_model) { $this->_getDataDs()->deleteByModuleId($moduleid); $this->_getPushDs()->deleteByModuleId($moduleid); } !$model && ($model = $_model); $module = $moduleBo->getModule(); if (!$module) { $this->showError('operate.fail'); } $name = trim($this->getInput('module_name', 'post')); if (empty($name)) { $this->showError('DESIGN:module.name.empty'); } $cache = $this->getInput('cache', 'post'); $property = $this->getInput('property', 'post'); if ($property['limit'] > 200) { $this->showError('DESIGN:maxlimit.error'); } $cls = sprintf('PwDesign%sDataService', ucwords($model)); Wind::import('SRV:design.srv.model.' . $model . '.' . $cls); $service = new $cls(); if (method_exists($service, 'decorateSaveProperty')) { $property = $service->decorateSaveProperty($property); if ($property instanceof PwError) { $this->showError($property->getError()); } } Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($moduleid); $dm->setFlag($model)->setName($name)->setProperty($property)->setCache($cache); if ($property['html_tpl']) { $dm->setModuleTpl($property['html_tpl']); } $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } Wekit::load('design.srv.PwSegmentService')->updateSegmentByPageId($module['page_id']); $this->_getDesignService()->clearCompile(); Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($moduleid); $srv->addAutoData(); $this->showMessage("operate.success"); }
public function tagModule() { $ds = $this->_getPageDs(); Wind::import('SRV:design.dm.PwDesignPageDm'); $dm = new PwDesignPageDm(); $dm->setType(PwDesignPage::SYSTEM)->setName('话题')->setRouter('tag/index/run')->setSegments(array('huatidemo')); $pageid = $ds->addPage($dm); if ($pageid instanceof PwError) { return false; } Wind::import('SRV:design.srv.vo.PwDesignComponentSo'); $vo = new PwDesignComponentSo(); $vo->setCompname('话题封面 [ 间隔 ]'); $comp = Wekit::load('design.PwDesignComponent')->searchComponent($vo); if (!$comp) { return false; } $comp = array_shift($comp); $tpl = $comp['comp_tpl']; $property = array("islogo" => 1, "order" => 5, "limit" => 18, "timefmt" => "m-d"); $cache = array('expired' => 15, 'start_hour' => 0, 'start_minute' => 0, 'end_hour' => 0, 'end_minute' => 0); Wind::import('SRV:design.dm.PwDesignModuleDm'); $moduleDm = new PwDesignModuleDm(); $moduleDm->setFlag('tag')->setPageId($pageid)->setName('演示:热门话题')->setModuleTpl($tpl)->setProperty($property)->setCache($cache)->setCompid($comp['comp_id'])->setIsused(1); $moduleid = Wekit::load('design.PwDesignModule')->addModule($moduleDm); if ($moduleid instanceof PwError) { return false; } $dm = new PwDesignPageDm($pageid); $dm->setModuleIds(array($moduleid)); $ds->updatePage($dm); $rand = WindUtility::generateRandStr(8); $tpl = <<<TPL <div id="{$rand}" class="design_layout_style J_mod_layout box_no" role="structure_{$rand}" data-lcm="100">\t\t\t <h2 class="design_layout_hd cc J_layout_hd" role="titlebar"></h2>\t\t\t <div id="J_mod_{$moduleid}" class="design_layout_ct mod_box J_mod_box" data-id="{$moduleid}"> <design id="D_mod_{$moduleid}" role="module"> </design> </div> </div> TPL; Wekit::load('design.PwDesignSegment')->replaceSegment('huatidemo', $pageid, $tpl); Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($moduleid); $srv->addAutoData(); return true; }
protected function doTxt($pageInfo) { $srv = Wekit::load('design.srv.PwDesignImportTxt'); $file = $this->_uploadFile(); if (!$file || $file['type'] != 'txt') { $this->showMessage("DESIGN:upload.fail"); } $srv = new PwDesignImportTxt(); $srv->setPageInfo($pageInfo); $filename = Wind::getRealDir('PUBLIC:attachment.' . $file['path']) . $file['filename']; $resource = $srv->checkTxt($filename); if ($resource instanceof PwError) { $this->showError($resource->getError()); } $resource = $srv->importTxt(); if ($resource instanceof PwError) { $srv->rollback(); $this->showError($resource->getError()); } //更新数据 Wind::import('SRV:design.srv.data.PwAutoData'); foreach ($srv->newIds as $id) { if (!$id) { continue; } $autoSrv = new PwAutoData($id); $autoSrv->addAutoData(); } return true; }
/** * 把一条推送数据写入展示数据 */ public function pushToData($pushid) { /*Wind::import('SRV:design.bo.PwDesignModuleBo'); Wind::import('SRV:design.dm.PwDesignDataDm'); $pushDs = Wekit::load('design.PwDesignPush'); $ds = Wekit::load('design.PwDesignData'); $push = $pushDs->getPush($pushid); if (!$push) return false; $time = Pw::getTime(); if ($push['end_time'] > 0 && $push['end_time'] < $time) return false; if (!$push['start_time']) $push['start_time'] = $time; $bo = new PwDesignModuleBo($push['module_id']); //list($start, $end, $refresh) = $bo->refreshTime($push['start_time']); $view = $bo->getView(); $dm = new PwDesignDataDm(); list($bold, $underline, $italic, $color) = explode('|', $push['push_style']); $extend = unserialize($push['push_extend']); $dm->setDatatype(PwDesignData::AUTO) ->setFromType(PwDesignData::FROM_PUSH) ->setFromApp($push['push_from_model']) ->setModuleid($push['module_id']) ->setFromid($pushid) ->setStandard(unserialize($push['push_standard'])) ->setStyle($bold, $underline, $italic, $color) ->setExtend(unserialize($push['push_extend'])) ->setStarttime($push['start_time']) ->setEndtime($push['end_time']) ->setVieworder($push['push_orderid']); if($push['push_orderid'] > 0) $dm->setDatatype(PwDesignData::ISFIXED); if($push['start_time'] > $time) $dm->setReservation(1); $resource = $ds->addData($dm); if ($resource instanceof PwError) return false; $this->afterPush($pushid); $countVo = Wekit::load('design.srv.vo.PwDesignDataSo'); $countVo->setModuleid($push['module_id']); $countVo->setReservation(0); $count = $ds->countData($countVo); $limit = $view['limit'] ? $view['limit'] : 10; if ($push['start_time'] <= $time && $count >= $limit) { if ($push['push_orderid'] > 0) { //指定排序,删除原指定序号的 $vo = Wekit::load('design.srv.vo.PwDesignDataSo'); $vo->setModuleid($push['module_id']); $vo->setReservation(0); $vo->setVierOrder($push['push_orderid']); $vo->orderbyDataid(true); $data = array_shift($ds->searchData($vo, 1)); $ds->deleteData($data['data_id']); } else { //先判断自动的,如果没有自动的数据,删除固定的 $maxDataid = $ds->getMaxOrderDataId($push['module_id'], PwDesignData::AUTO); if (!$maxDataid) $maxDataid = $ds->getMaxOrderDataId($push['module_id'], PwDesignData::ISFIXED); $ds->deleteData($maxDataid); } } Wind::import('SRV:design.srv.data.PwModuleData'); $srv = new PwModuleData($push['module_id']); $srv->reviseOrder(); */ $pushDs = Wekit::load('design.PwDesignPush'); $push = $pushDs->getPush($pushid); Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($push['module_id']); $srv->addAutoData(); return true; }