<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
<!--#include file="../../inc/payok.asp"-->
<!--#include file="../../inc/buysyspc.asp"--> 
<!--#include file="../../inc/md52.asp"--> 
<% 
key=jiyikey2

attach=Request("attach")
body=Request("body")
channel_trade_no=Request("channel_trade_no")
charset=Request("charset")
mch_id=Request("mch_id")
out_trade_no=Request("out_trade_no")
payment_code=Request("payment_code")
payment_time=Request("payment_time")
sign_type=Request("sign_type")
timestamp=Request("timestamp")
total_fee=Request("total_fee")
trade_no=Request("trade_no")
trade_status=Request("trade_status")
version=Request("version")
sign=Request("sign")


str=""
str=str&"attach="&attach&"&"
str=str&"body="&body&"&"
str=str&"channel_trade_no="&channel_trade_no&"&"
str=str&"charset="&charset&"&"
str=str&"mch_id="&mch_id&"&"
str=str&"out_trade_no="&out_trade_no&"&"
str=str&"payment_code="&payment_code&"&"
str=str&"payment_time="&payment_time&"&"
'str=str&"sign_type="&sign_type&"&"
str=str&"timestamp="&timestamp&"&"
str=str&"total_fee="&total_fee&"&"
str=str&"trade_no="&trade_no&"&"
str=str&"trade_status="&trade_status&"&"
str=str&"version="&version&"&"
str=str&"key="&key
getsign=md5(str)

response.Write "success"

trade_status=trade_status
pay_body = attach
	
If sign=getsign Then

conn.Execute("Insert Into aypayhuitiao(aypaydd,aypaytd,aypayfyu,aypayyu,aypaycon) values('"&out_trade_no&"','吉易2','"&request.ServerVariables("SERVER_NAME")&"','"&request.ServerVariables("HTTP_REFERER")&"','"&request.Form&"')")
	
			If trade_status="TRADE_FINISHED" Then
			
		
			'执行开始***************************************************************************
			if pay_body="buy" then
			call payokbuy(out_trade_no,trade_no,total_fee,"no")	
			end if
		
			if pay_body="chongzhi" then
			call payokchong(out_trade_no,trade_no,total_fee,"no")
			end if
			'执行结束***************************************************************************
		
		
				
			elseif trade_status="0" Then	
			'商户业务数据失败处理
		 
			
			
			
			
				
			End If
			'处理完后返回接收到标识为1
			'只要商户接到通知，不管订单状态如何
			'都只需要返回接收到标识为1
	
Else
	Response.Write("signerr")
End If
%>


