<!--#include file="Include/Const.asp" -->
<!--#include file="Include/NoHackSql.Asp" -->
<!--#include file="Include/ConnSiteData.asp" -->
<!--#include file="Cart.Asp" -->
<!--#include file="Include/Md5.asp"-->
<%call SiteInfo
headid=3
if ISHTML = 1 then
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
End If
dim Products
dim mMemID,mRealName,mSex,mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,mEmail
if session("MemName")<>"" and session("MemLogin")="Succeed" then
  call MemInfo()
else
  mSex="先生"
  mMemID=0
end If
Set rs = conn.Execute("select * from liangjing_Pay") 
pay= rs("pay")
xpay_tid=rs("xpay_id")
xpay_key=rs("xpay_key")
xpay_url=rs("xpay_url")
xpay_name=rs("xpay_name")
alipay_id=rs("alipay_id")
alipay_securityCode=rs("alipay_securityCode")
Partner_id=rs("Partner_id")
westid=rs("westid")
westback=rs("westback")
chinaid=rs("chinaid")
chinakey=rs("chinakey")
chinaback=rs("chinaback")
pay88id=rs("pay88id")
pay88name=rs("pay88name")
pay88back=rs("pay88back")
paypalid=rs("paypalid")
npsid=rs("npsid")
npsback=rs("npsback")
ipsid=rs("ipsid")
ipsback=rs("ipsback")
set rs=nothing
%>
<!--#include file="Head.Asp" -->
<div id='index_wrapper'>
<div id=best-r class="best" style="width:586px;float:left">
<div id=best-sc>
<div class=best-tb>
<a style="width:80px;">当前位置：</a>
<a>在线订购</a>
</div>
</div>
<div id=bests>


<!--  
 * ====================================================================
 *
 *      由网银在线技术支持提供
 *
 *     本页面为支付完成后获取返回的参数及处理......
 *
 *
 * ====================================================================
-->
<%   
'****************************************	' MD5密钥要跟订单提交页相同，如Send.asp里的 key = "test" ,修改""号内 test 为您的密钥
											' 如果您还没有设置MD5密钥请登陆我们为您提供商户后台，地址：https://merchant3.chinabank.com.cn/
	key = ""&chinakey&""							' 登陆后在上面的导航栏里可能找到“B2C”，在二级导航栏里有“MD5密钥设置”
											' 建议您设置一个16位以上的密钥或更高，密钥最多64位，但设置16位已经足够了
'****************************************

' 取得返回参数值
	v_oid=request("v_oid")                               ' 商户发送的v_oid定单编号
	v_pmode=request("v_pmode")                           ' 支付方式（字符串） 
	v_pstatus=request("v_pstatus")                       ' 支付状态 20（支付成功）;30（支付失败）
	v_pstring=request("v_pstring")                       ' 支付结果信息 支付完成（当v_pstatus=20时）；失败原因（当v_pstatus=30时）；
	v_amount=request("v_amount")                         ' 订单实际支付金额
	v_moneytype=request("v_moneytype")                   ' 订单实际支付币种
	remark1=request("remark1")                           ' 备注字段1
	remark2=request("remark2")                           ' 备注字段2
	v_md5str=request("v_md5str")  ' 网银在线拼凑的Md5校验串

if request("v_md5str")="" then
	response.Write("v_md5str：空值")

end if


'md5校验

	text = v_oid&v_pstatus&v_amount&v_moneytype&key

	md5text =Ucase(trim(md5(text)))    '商户拼凑的Md5校验串

	if md5text<>v_md5str then		' 网银在线拼凑的Md5校验串 与 商户拼凑的Md5校验串 进行对比
	'对比失败表示信息非网银在线返回的信息

	  response.write("校验失败,数据可疑")
  
      
	else
	'对比成功表示信息是网银在线返回的信息

	  if v_pstatus=20 Then
     Dim ProductNos,ProNumabers
 	set rs = server.createobject("adodb.recordset")
    sql="select * from LiangJing_Order where OrderNo='"&v_oid&"'"
    rs.open sql,conn,1,3
    rs("IsokMoney")=true 
	Call ShopOrderSendEmail(rs("Email"),ComName,"你的团购凭证码为:"&v_oid)
    ProductNos=split(rs("ProductNo"),"┎╂┚")
	ProNumabers=split(rs("ProNumaber"),"┎╂┚")
    Dim ii
    for ii = 0 to ubound(ProductNos)
	Call MoteProductNumber(ProductNos(ii),ProNumabers(ii))
    next
    rs.update
    rs.close
    set rs=Nothing
	response.write "<script language='javascript'>alert('恭喜你订单成功支付！');location.replace('index.asp');</script>"
		'支付成功
		'此处加入商户系统的逻辑处理（例如判断金额，判断支付状态，更新订单状态等等）......

	  end if

	end If




%>
<!--
以下是打印出所有接收数据的结果，供编程人员参考
-->
<TABLE width=500 border=0 align="center" cellPadding=0 cellSpacing=0>
		  <TBODY>
			<TR> 
			  <TD vAlign=top align=middle> <div align="left"><B><FONT style="FONT-SIZE:14px">MD5校验码:<%=v_md5str%></FONT></B></div></TD>
			</TR>
			<TR> 
			  <TD vAlign=top align=middle> <div align="left"><B><FONT style="FONT-SIZE: 14px">订单号:<%=v_oid%></FONT></B></div></TD>
			</TR>
			<TR> 
			  <TD vAlign=top align=middle> <div align="left"><B><FONT style="FONT-SIZE: 14px">支付卡种:<%=v_pmode%></FONT></B></div></TD>
			</TR>
			<TR> 
			  <TD vAlign=top align=middle> <div align="left"><B><FONT style="FONT-SIZE: 14px">支付结果:<%=v_pstring%></FONT></B></div></TD>
			</TR>
			<TR> 
			  <TD vAlign=top align=middle> <div align="left"><B><FONT style="FONT-SIZE: 14px">支付金额:<%=v_amount%></FONT></B></div></TD>
			</TR>
			<TR> 
			  <TD vAlign=top align=middle> <div align="left"><B><FONT style="FONT-SIZE: 14px">支付币种:<%=v_moneytype%></FONT></B></div></TD>
			</TR>
		  </TBODY>
		</TABLE>


</div>

</div>
<div id=best-r class="best" style="width:200px; float:right;">
<div id=best-sc>
<div class=best-tb>
<a style="width:80px;font-size:14px;font-weight:bold;">团购资讯</a>  
<span id="sishowsitep" onclick="stepcoclose1()" style="display:none;padding-top:7px;padding-left:6px;"><font style="color:red;">查看步骤</font></span>
</div>
</div>
<div id=bests>
<table cellpadding="0" cellspacing="0" width="100%px">
<tr><td>
<%Call News("0,1,",6)%>
</td></tr>
</table>
</div>
</div>


<div id=best-r class="best" style="width:200px; float:right;margin-top:10px;">
<div id=best-sc>
<div class=best-tb>
<a style="width:80px;font-size:14px;font-weight:bold;">信息订阅</a>       
</div>
</div>
<div id=bests>
<table cellpadding="0" cellspacing="0" width="100%px" style="padding:6px;">
<tr><td align="center">
<% Call LiangjingCMSEMail() %>
</td></tr>
</table>

</div>
</div>
</div>
<div style="clear:both;;*display:inline;overflow:;hidden;">
</div>
<div style="float:none;height:10px;"></div>
</div></div>
</div></div>
<!--#include file="Foot.Asp"-->
<%
'最新产品展示

function News(SortPath,number)
  dim rs,sql,NewsName,NewFlag
  set rs = server.createobject("adodb.recordset")
  sql="select top "&number&" * from LiangJing_News where ViewFlag"&" and Instr(SortPath,'"&SortPath&"')>0 order by id desc"
  rs.open sql,conn,1,1
  if rs.eof then
 Response.Write"<li class=""newslist"">暂无相关信息</li>"
  Else
Dim i
i=1
Response.Write "<ul style=""width:180px;"">"
 do while not rs.eof
	  if now()-rs("AddTime")<=2 then 
	    NewsName=StrLeft(rs("NewsName"),20)
	    NewFlag=" <img src=""Images/new.gif"" align=""absmiddle"">"
	  else
	    NewsName=StrLeft(rs("NewsName"),20)
	    NewFlag=""
	  end If
		If ISHTML = 1 Then
			AutoLink = ""&NewName&""&Separated&""&rs("ID")&"."&HTMLName&""
		Else
			AutoLink = "NewsView.asp?ID="&rs("id")&""
		End If
  Response.Write"<li style=""font-size:14px;text-align:left;width:160px;height:18px""><img src='images/"&i&".jpg'/><a href="""&AutoLink&""" target=""_self"" style=""font-size:13px"">"&NewsName&"</a></li>"
      rs.movenext
	  i=i+1
    loop 
  end If
  Response.Write "</ul>"
  rs.close
  set rs=nothing
end Function

'修改团购数量
Function MoteProductNumber(ProductNo,Number)
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select * from liangjing_Products where ProductNo='"&ProductNo&"'"
  rs.open sql,conn,1,3
      rs("Stock")=rs("Stock")-Number
	  rs.update
	  rs.close
	  set rs=Nothing
End Function 

sub MemInfo()
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select * from LiangJing_Members where MemName='"&session("MemName")&"'"
  rs.open sql,conn,1,1
  if rs.bof and rs.eof then
    response.write "<center>暂无相关信息</center>"
  else
    mMemID=rs("ID")
	if not rs("RealName")="" then
	  mRealName=rs("RealName")
	else
	  mRealName=rs("MemName")
	end if
	mSex=rs("Sex")
	mCompany=rs("Company")
	mAddress=rs("Address")
	mZipCode=rs("ZipCode")
	mTelephone=rs("Telephone")
	mFax=rs("Fax")
	mMobile=rs("Mobile")
	mEmail=rs("Email")
  end if
  rs.close
  set rs=nothing
end sub
%>




