<%@page contentType="text/html; charset=UTF-8"%>
<%@include file="/inc/init.jsp"%>
<%@include file="/inc/checklogin.jsp"%>
<%
	String action = pu.getString("action");
	String referer=pu.referer();
	Pay_type_db ptdb = new Pay_type_db();
	int payid = pu.getInt("payid");
	String name = pu.getString("name");
	String state = pu.getString("state");
	String rebate = pu.getString("rebate", "1");
	String url = pu.getString("url");
	String content = pu.getString("content");
	String remark = pu.getString("remark");
	String alipayurl = pu.getString("alipayurl");
	String alipaypartner = pu.getString("alipaypartner");
	String alipaykey = pu.getString("alipaykey");
	String alipayuser = pu.getString("alipayuser");
	String alipaytype = pu.getString("alipaytype");
	String pcshow = pu.getString("pcshow");
	String phoneshow = pu.getString("phoneshow");
	//添加产品
	if (action.equals("edit")) {
		ptdb.update(payid, "name", name);
		ptdb.update(payid, "state", state);
		ptdb.update(payid, "rebate", rebate);
		ptdb.update(payid, "url", url);
		ptdb.update(payid, "content", content);
		ptdb.update(payid, "remark", remark);
		ptdb.update(payid, "retain1", pcshow);
		ptdb.update(payid, "retain2", phoneshow);
		if (payid == 2) {
			Config siteconfig = new Config();
			siteconfig.set("alipaypartner", alipaypartner);
			siteconfig.set("alipaykey", alipaykey);
			siteconfig.set("alipayuser", alipayuser);
			siteconfig.set("alipaytype", alipaytype);
			//重初始化
			ConfigUtil.init();
		}
		session.setAttribute("msg", "支付方式 " + name + " 更新成功！");
		response.sendRedirect(referer);
		return;
	}
%>