<?php
function add_or_edit_shipping()
{
	global $smarty;
	$shi_id = post('shi_id');
	$shi_name = post('shi_name');
	$shi_price = post('shi_price');
	$shi_text = post('shi_text');
	
	$obj = new shipping();
	$obj->set_value('shi_name',$shi_name);
	$obj->set_value('shi_price',$shi_price);
	$obj->set_value('shi_text',$shi_text);
	if($shi_id != '')
	{
		$obj->set_where("shi_id = $shi_id");
		$obj->edit();
		$info_text = '修改配送方式成功';
	}else{
		$obj->set_value('shi_lang',S_LANG);
		$obj->add();
		$info_text = '添加配送方式成功';
	}
	$smarty->assign('info_text',$info_text);
	$smarty->assign('link_text','返回列表页');
	$smarty->assign('link_href',url(array('channel'=>'basic','mod'=>'shipping_list')));
}
function add_or_edit_region()
{
	global $smarty;
	$reg_id = post('reg_id');
	$reg_parent_id = post('reg_parent_id');
	$reg_name = post('reg_name');
	$obj = new region();
	$obj->set_value('reg_parent_id',$reg_parent_id);
	$obj->set_value('reg_name',$reg_name);
	if($reg_id != '')
	{
		$obj->set_where("reg_id = $reg_id");
		$obj->edit();
		$info_text = '修改配送范围成功';
	}else{
		$obj->set_value('reg_lang',S_LANG);
		$obj->add();
		$info_text = '修改配送范围成功';
	}
	$smarty->assign('info_text',$info_text);
	$smarty->assign('link_text','返回列表页');
	$smarty->assign('link_href',url(array('channel'=>'basic','mod'=>'region_list')));
}
function add_or_edit_payment()
{
	global $smarty;
	$pay_id = post('pay_id');
	$pay_name = post('pay_name');
	$pay_price = post('pay_price');
	$pay_text = post('pay_text');
	$pay_config = post('pay_config');
	
	$obj = new payment();
	$obj->set_value('pay_name',$pay_name);
	$obj->set_value('pay_price',$pay_price);
	$obj->set_value('pay_text',$pay_text);
	$obj->set_value('pay_config',$pay_config);
	if($pay_id != '')
	{
		$obj->set_where("pay_id = $pay_id");
		$obj->edit();
		$info_text = '修改支付方式成功';
	}else{
		$obj->set_value('pay_lang',S_LANG);
		$obj->add();
		$info_text = '添加支付方式成功';
	}
	$smarty->assign('info_text',$info_text);
	$smarty->assign('link_text','返回列表页');
	$smarty->assign('link_href',url(array('channel'=>'basic','mod'=>'payment_list')));
}
//红头船
?>