/** * 附件存储方式设置列表页 */ public function run() { Wind::import('WINDID:service.config.storage.WindidAttacmentService'); $attService = new WindidAttacmentService('PwAttacmentService_getStorages'); $storages = $attService->getStorages(); $service = $this->_getConfigDs(); $config = $service->getValues('attachment'); $storageType = 'local'; if (isset($config['storage.type']) && isset($storages[$config['storage.type']])) { $storageType = $config['storage.type']; } $this->setOutput($config, 'config'); $this->setOutput($storages, 'storages'); $this->setOutput($storageType, 'storageType'); }
/** * 附件存储方式设置列表页 */ public function dostroageAction() { $att_storage = $this->getInput('att_storage', 'post'); $avatarurl = $this->getInput('avatarurl', 'post'); Wind::import('WINDID:service.config.storage.WindidAttacmentService'); $attService = new WindidAttacmentService('PwAttacmentService_getStorages'); $_r = $attService->setStoragesComponents($att_storage); Wind::import('WINDID:service.config.srv.WindidConfigSet'); $config = new WindidConfigSet('attachment'); $config->set('avatarurl', $this->getInput('avatarurl', 'post'))->flush(); if ($_r === true) { $this->showMessage('ADMIN:success'); } /* @var $_r PwError */ $this->showError($_r->getError()); }
/** * 附件存储方式设置列表页 */ public function dostroageAction() { $att_storage = $this->getInput('att_storage', 'post'); $avatarurl = $this->getInput('avatarurl', 'post'); /*Wind::import('WINDID:service.config.storage.WindidAttacmentService'); $attService = new WindidAttacmentService('PwAttacmentService_getStorages'); $_r = $attService->setStoragesComponents($att_storage);*/ Wind::import('WINDID:service.config.storage.WindidAttacmentService'); $attService = new WindidAttacmentService('PwAttacmentService_getStorages'); $storages = $attService->getStorages(); Wind::import('WINDID:service.config.srv.WindidConfigSet'); $config = new WindidConfigSet('attachment'); $config->set('avatarurl', $avatarurl)->set('storage.type', $att_storage)->flush(); $config = new WindidConfigSet('storage'); foreach ($storages as $key => $storage) { $config->set($key, serialize($storage))->flush(); } Wind::import('SRV:service.config.srv.PwConfigSet'); $config = new PwConfigSet('site'); $config->set('avatar.url', $avatarurl)->set('avatar.storage', $att_storage)->flush(); $this->showMessage('WINDID:success'); }