示例#1
0
 protected function importTxt($content)
 {
     $srv = Wekit::load('design.srv.PwDesignImportTxt');
     $pageInfo = $this->_getPageDs()->getPage($this->pageid);
     $srv = new PwDesignImportTxt();
     $srv->setPageInfo($pageInfo);
     $resource = $srv->checkTxt('', $content);
     if ($resource instanceof PwError) {
         return false;
     }
     $resource = $srv->importTxt();
     $this->newIds = $srv->newIds;
 }
示例#2
0
 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;
 }