<!-- #include file="include/skin.asp" -->
<!-- #include file="include/jk_md5.asp" -->
<!-- #include file="include/joekoe_pay.asp" -->
<%
tit="在线购买"&web_dim(9)&"反馈"

call web_head(0,0,0,0,0)
'----------------------------左边 开始----------------------------

'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------

call pay_true()

response.write vbcrlf&ukong
'----------------------------中间 结束----------------------------
call web_end(0,0)

sub pay_true_err(emsg)
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td align=center><b><%response.write tit%>　　错误信息</b></td></tr>
<tr class=bg_td><td align=center height=200 class=htd>
<font class=red><%response.write emsg%></font><br><br><br>
<input type=button value='点击返回用户中心' onClick="javascript:window.location.href='user_main.asp';">　　<input type=button value='虚拟货币' onClick="javascript:window.location.href='user_emoney.asp';">
</td></tr>
</table>
<%
end sub

sub pay_true()
  dim obj_pay,e_id,e_username,e_amount,e_emoney,e_ispay
  set obj_pay=new joekoe_pay
  call obj_pay.pay_return()
  select case cint(obj_pay.val_num)	'0为验证通过
  case 1
    set obj_pay=nothing
    call pay_true_err("错误的支付反馈表单（反馈信息不完整）！")
    exit sub
  case 2
    set obj_pay=nothing
    call pay_true_err("错误的验证签名（非法提交或参数错误）！")
    exit sub
  end select
  
  sql="select top 1 e_id,e_username,e_amount,e_emoney,e_ispay from notes_emoney where e_ordernum='"&obj_pay.pay_ordernum&"'"
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    call pay_true_err("错误的支付反馈表单（"&obj_pay.pay_sort&":<font class=blue>"&obj_pay.pay_ordernum&"</font>）！<br>如有问题请与网站管理员联系处理。")
    set obj_pay=nothing
    exit sub
  end if
  e_id=rs("e_id")
  e_username=rs("e_username")
  e_amount=rs("e_amount")
  e_emoney=rs("e_emoney")
  e_ispay=rs("e_ispay")
  rs.close
  if e_ispay=true then
    call pay_true_err("在线购买"&joekoe_cms.web_unit&"订单（"&obj_pay.pay_sort&":"&obj_pay.pay_ordernum&"）已更新！请与网站管理员联系处理。")
    set obj_pay=nothing
    exit sub
  end if
  if cstr(fm_price(obj_pay.pay_amount,1))<>cstr(fm_price(e_amount,1)) then
    call pay_true_err("在线支付订单（"&obj_pay.pay_sort&":"&obj_pay.pay_ordernum&"）的应支付金额（"&e_amount&val_unit&"）与实支付金额（"&obj_pay.pay_amount&val_unit&"）不等！请与网站管理员联系处理。")
    set obj_pay=nothing
    exit sub
  end if
  set obj_pay=nothing
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td align=center><b><%response.write tit%>　　在线购买成功</b></td></tr>
<tr class=bg_td><td align=center height=200>
您（<%response.write e_username%>）已成功支付人民币&nbsp;<font class=red><b><%response.write fm_price(e_amount,1)%></b></font>&nbsp;元购买了&nbsp;<font class=red><b><%response.write e_emoney%></b></font>&nbsp;乔币！
<br><br><br>
<input type=button value='点击返回用户中心' onClick="javascript:window.location.href='user_main.asp';">　　<input type=button value='虚拟货币' onClick="javascript:window.location.href='user_emoney.asp';">
</td></tr>
</table>
<%
  call joekoe_cms.exec("update user_data set emoney=emoney+"&e_emoney&" where username='"&e_username&"'",0)
  call joekoe_cms.exec("update notes_emoney set e_ispay=1,e_ptim='"&joekoe_cms.now_time&"' where e_id="&e_id,0)
end sub
%>