public function actionAdd() { if (empty($_POST)) { $viewData = array(); $this->render('add', $viewData); exit; } $res = array('statusCode' => 200, 'message' => '添加成功!'); try { $m = new ShopConfig(); $m->attribute_name = $_POST['attribute_name']; $m->attribute = $_POST['attribute']; $m->value = $_POST['value']; $m->add_time = time(); $flag = $m->save(); if (!$flag) { throw new exception('添加失败'); } } catch (Exception $e) { $res['statusCode'] = 300; $res['message'] = '失败【' . $e->getMessage() . '】'; } $res['navTabId'] = 'shopConfigList'; $res['callbackType'] = 'closeCurrent'; $res['forwardUrl'] = '/manage/shopConfig/index'; $this->ajaxDwzReturn($res); }
function actSaveConfig() { global $ST, $post; $config = new ShopConfig(); $config->save($post->get()); echo printJSON(array('msg' => 'Сохранено')); exit; }