<!--#include file="base.asp"-->
<%
''' EYCMS 微信设置
''' ==================================================================

	sub weixindb()
		dim t0,t1,t2,t3,t4,t5,t6,t7
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.enhtml(eycms.fpost("t3",0))
		t4=eycms.enhtml(eycms.fpost("t4",0))
		t5=eycms.getint(eycms.fpost("t5",0),0)
		t6=eycms.enhtml(eycms.fpost("t6",0))
		t7=eycms.enhtml(eycms.fpost("t7",0))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_appid'",array(array("setvalue",t0,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_key'",array(array("setvalue",t1,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_token'",array(array("setvalue",t2,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_id'",array(array("setvalue",t3,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_qrcode'",array(array("setvalue",t4,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_follow'",array(array("setvalue",t5,1,1))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_pclogo'",array(array("setvalue",t6,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.weixin' and setkey='wx_logo'",array(array("setvalue",t7,50,1))
		delall t4&","&t6&","&t7,9998,0
		eycms.clearcache
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub replydb()
		dim t0,t1,t2
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=(eycms.fpost("t1",0))
		t2=eycms.getint(eycms.fpost("t2",0),0)
		if t0<>"master" then t2=0
		
		if t0="master" then
			if t2=0 then
				eycms.ajaxjson "请选择素材",0	
				exit sub
			end if
			dim data:data=eycms.db.dbload(1,"id","wx_master_class","id="&t2&"","")
			if ubound(data)<0 then
				eycms.ajaxjson "素材选择错误",0	
				exit sub
			end if
		end if
		
		eycms.db.dbupdate "ey_config","setname='eycms.reply' and setkey='reply_type'",array(array("setvalue",t0,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.reply' and setkey='reply_content'",array(array("setvalue",t1,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.reply' and setkey='reply_id'",array(array("setvalue",t2,0,1))
		eycms.clearcache
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub autodb()
		dim t0,t1,t2,t3,t4
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=(eycms.fpost("t1",0))
		t2=eycms.getint(eycms.fpost("t2",0),0)
		t3=eycms.enhtml(eycms.fpost("t3",0))
		t4=eycms.enhtml(eycms.fpost("t4",0))
		if t0<>"master" then t2=0
		eycms.db.dbupdate "ey_config","setname='eycms.auto' and setkey='auto_type'",array(array("setvalue",t0,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.auto' and setkey='auto_content'",array(array("setvalue",t1,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.auto' and setkey='auto_id'",array(array("setvalue",t2,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.auto' and setkey='auto_key'",array(array("setvalue",t3,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.auto' and setkey='auto_name'",array(array("setvalue",t4,10,1))
		eycms.clearcache
		eycms.ajaxjson "保存成功",1
	end sub
	
	islogin
	dim sitedata,ei
	dim act:act=lcase(eycms.fget("act",0))
	dim sconfig:set sconfig=server.createobject("scripting.dictionary")
	select case act
		case "weixin"
			checkpagelever 66
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "reply","auto"
			checkpagelever 68
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "weixindb":weixindb
		case "replydb":replydb
		case "autodb":autodb
	end select
	set sconfig=nothing
	eycms.db.dbclose
%>