HomeAction::doaddFeedbackType PHP Method

doaddFeedbackType() public method

添加分类
public doaddFeedbackType ( )
    public function doaddFeedbackType()
    {
        if (!empty($_POST['type_id'])) {
            //save $res
            $add['type_name'] = t($_POST['type_name']);
            if ($add['type_name'] == '') {
                $this->error(L('PUBLIC_ADMIN_OPRETING_ERROR'));
            } else {
                $res = D('')->table(C('DB_PREFIX') . 'feedback_type')->where('type_id = ' . $_POST['type_id'])->save($add);
            }
        } else {
            //add $res
            $add['type_name'] = t($_POST['type_name']);
            if ($add['type_name'] == '') {
                $this->error(L('PUBLIC_ADMIN_OPRETING_ERROR'));
            } else {
                $res = D('')->table(C('DB_PREFIX') . 'feedback_type')->add($add);
            }
        }
        if ($res) {
            $this->assign('jumpUrl', U('admin/Home/feedbackType', array('tabHash' => 'type')));
            $this->success(L('PUBLIC_ADMIN_OPRETING_SUCCESS'));
        } else {
            $this->error(L('PUBLIC_DATA_UPGRADE_FAIL'));
        }
    }