public function post($f3) { // 权限检查 $this->requirePrivilege('manage_plugin_theme_adv_configure'); // 参数验证 $validator = new Validator($f3->get('POST')); // 广告设置 json 数据,由 JavaScript 打包发送过来 $shop_index_advblock_json_data = $validator->validate('shop_index_advblock_json_data'); $jsonObject = json_decode($shop_index_advblock_json_data, true); if (empty($jsonObject)) { $shop_index_advblock_json_data = null; } ShopThemePlugin::saveOptionValue('shop_index_advblock_json_data', $shop_index_advblock_json_data); // 清除 /Shop/Index 页面 $shopClear = new ShopClear(); $shopClear->clearHomePage(); $this->addFlashMessage('保存设置成功'); RouteHelper::reRoute($this, '/Theme/Shop/AdvShopBlock'); }
public function post($f3) { // 权限检查 $this->requirePrivilege('manage_plugin_theme_adv_configure'); // 参数验证 $validator = new Validator($f3->get('POST')); // slider 广告设置 $imageArray = $validator->validate('image'); $urlArray = $validator->validate('url'); $targetArray = $validator->validate('target'); $imageSize = is_array($imageArray) ? count($imageArray) : 0; $shop_index_adv_slider = array(); // 组织数据结构 for ($index = 0; $index < $imageSize; $index++) { $shop_index_adv_slider[] = array('image' => $imageArray[$index], 'url' => $urlArray[$index], 'target' => $targetArray[$index]); } ShopThemePlugin::saveOptionValue('shop_index_adv_slider', json_encode($shop_index_adv_slider)); // 清除 /Shop/Index 页面 $shopClear = new ShopClear(); $shopClear->clearHomePage(); $this->addFlashMessage('保存设置成功'); RouteHelper::reRoute($this, '/Theme/Shop/AdvShopSlider'); }