public function edit($model = null, $id = 0) { is_array($model) || ($model = $this->getModel($model)); $id || ($id = I('id')); if (IS_POST) { $Model = D(parse_name(get_table_name($model['id']), 1)); // 清空旧关键词 $keyword = $Model->where('id=' . $id)->getField('keyword'); $keyword = preg_split('/[\\s,;]+/', $keyword); // 以空格tab逗号分号分割关键词 $data['addon'] = 'Extensions'; foreach ($keyword as $key) { $data['keyword'] = trim($key); $res = M('keyword')->where($data)->delete(); } // 获取模型的字段信息 $Model = $this->checkAttr($Model, $model['id']); if ($Model->create() && $Model->save()) { $this->_saveKeyword($model, $id); $this->success('保存' . $model['title'] . '成功!', U('lists?model=' . $model['name'])); } else { $this->error($Model->getError()); } } else { parent::edit($model, $id); } }
function edit() { if (IS_POST) { $this->checkPostData(); $id = I('id'); $targetId = I('target_id'); $prizeDao = D('Addons://Scratch/Prize'); $prizeDao->getPrizes($targetId, 'Scratch', true); $prizeDao->getPrizeInfo($id, true); } $model = $this->getModel($this->table); parent::edit($model); }
function edit() { $this->_tip(); parent::edit(); }
function edit() { $model = $this->getModel($this->table); parent::edit($model); }