|
曾经写过。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
<!--引入MDB加密文件,确保交易安全性-->
<!--#include file="md5.asp"-->
<%
Class ZFB_Buy
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'此方法对外。修饰为public
'方法名: GetGoodsInfos
'参数说明:
'Pro_Name: 商品名称
'Pro_Characterization: 商品描述
'Pro_Unit_Price: 商品单价
'Pro_ID: 商品的唯一编号
'Pro_number: 购买商品数量
'ordinary_fee: 平邮运费
'express_fee: 快递运费
'buyer_msg: 买家给卖家的留言
'buyer_Email: 买家Email
'buyer_name: 买家姓名
'buyer_address 买家地址
'buyer_zipcode: 买家邮编
'buyer_tell: 买家电话号码
'buyer_mobile: 买家手机号码
public Function GetGoodsInfos(Pro_Name,Pro_Characterization,Pro_Unit_Price,Pro_ID,Pro_number,ordinary_fee,express_fee,buyer_msg,buyer_Email,buyer_name,buyer_address,buyer_zipcode,buyer_tell,buyer_mobile)
t1 = ZFB_Interface_URL '支付接口
t2 = ZFB_Accounts '商户支付宝账户
t3 = ZFB_Check_Code '安全校验码
't4 = "" '支付宝按钮图片
't5 = "用支付宝支付,放心" '按钮悬停说明
s1 = ZFB_CMD_Command_Code 'cmd 命令码
s2 = DelStr(trim(Pro_Name)) 'subject 商品名称
s3 = Pro_Characterization 'body 商品描述
s4 = DelStr(trim(GetOrderNumber())) 'order_no 商户订单号
s5 = DelStr(trim(Pro_Unit_Price)) 'price 商品单价 0.01~50000.00
s6 = WebURL&"/pro_viewpro.asp?nid="&Pro_ID 'url 商品展示网址
s7 = "1" 'type 支付类型 1:商品购买2:服务购买3:网络拍卖4:捐赠
s8 = DelStr(trim(Pro_number)) 'number 购买数量
s9 = "" 'transport 发货方式 1:平邮2:快递3:虚拟物品
s10 = ordinary_fee 'ordinary_fee 平邮运费
s11 = express_fee 'express_fee 快递运费
s12 = "true" 'readonly 交易信息是否只读
s13 = DelStr(trim(buyer_msg)) 'buyer_msg 买家给卖家的留言
s14 = DelStr(trim(buyer_Email)) 'buyer_Email 买家Email
s15 = DelStr(trim(buyer_name)) 'buyer_name 买家姓名
s16 = DelStr(trim(buyer_address)) 'buyer_address 买家地址
s17 = DelStr(trim(buyer_zipcode)) 'buyer_zipcode 买家邮编
s18 = DelStr(trim(buyer_tell)) 'buyer_tell 买家电话号码
s19 = DelStr(trim(buyer_mobile)) 'buyer_mobile 买家手机号码
s20 = "2088002065360282" '友情ID,用来统计交易总金额,请误修改
'初始化各必要变量
INTERFACE_URL = t1+t2 '支付接口
sellerEmail = t2 '商户支付宝账户
keyCode = t3 '安全校验码
'imgsrc = t4 '支付宝按钮图片
'imgtitle = t5 '按钮悬停说明
str2CreateAc = "cmd" & s1 & "subject" & s2
str2CreateAc = str2CreateAc & "body" & s3
str2CreateAc = str2CreateAc & "order_no" & s4
str2CreateAc = str2CreateAc & "price" & s5
str2CreateAc = str2CreateAc & "url" & s6
str2CreateAc = str2CreateAc & "type" & s7
str2CreateAc = str2CreateAc & "number" & s8
str2CreateAc = str2CreateAc & "transport" & s9
str2CreateAc = str2CreateAc & "ordinary_fee" & s10
str2CreateAc = str2CreateAc & "express_fee" & s11
str2CreateAc = str2CreateAc & "readonly" & s12
str2CreateAc = str2CreateAc & "buyer_msg" & s13
str2CreateAc = str2CreateAc & "seller" & sellerEmail
str2CreateAc = str2CreateAc & "buyer" & s14
str2CreateAc = str2CreateAc & "buyer_name" & s15
str2CreateAc = str2CreateAc & "buyer_address" & s16
str2CreateAc = str2CreateAc & "buyer_zipcode" & s17
str2CreateAc = str2CreateAc & "buyer_tel" & s18
str2CreateAc = str2CreateAc & "buyer_mobile" & s19
str2CreateAc = str2CreateAc & "partner" & s20
str2CreateAc = str2CreateAc & keyCode
acCode = MD5(str2CreateAc)
itemURL = INTERFACE_URL & "?cmd=" & s1
itemURL = itemURL & "&subject=" & Server.HTMLEncode(s2)
itemURL = itemURL & "&body=" & Server.HTMLEncode(s3)
itemURL = itemURL & "&order_no=" & s4
itemURL = itemURL & "&price=" & s5
itemURL = itemURL & "&url=" & s6
itemURL = itemURL & "&type=" & s7
itemURL = itemURL & "&number=" & s8
itemURL = itemURL & "&transport=" & s9
itemURL = itemURL & "&ordinary_fee=" & s10
itemURL = itemURL & "&express_fee=" & s11
itemURL = itemURL & "&readonly=" & s12
itemURL = itemURL & "&buyer_msg=" & Server.HTMLEncode(s13)
itemURL = itemURL & "&buyer=" & Server.HTMLEncode(s14)
itemURL = itemURL & "&buyer_name=" & Server.HTMLEncode(s15)
itemURL = itemURL & "&buyer_address=" & Server.HTMLEncode(s16)
itemURL = itemURL & "&buyer_zipcode=" & s17
itemURL = itemURL & "&buyer_tel=" & s18
itemURL = itemURL & "&buyer_mobile=" & s19
itemURL = itemURL & "&partner=" & s20
itemURL = itemURL & "&ac=" & acCode
'返回值
GetGoodsInfos = itemURL
End Function
''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''
'私有方法DelStr
'调用方法 DelStr(值),防止SQL注入攻击
private Function DelStr(Str)
If IsNull(Str) Or IsEmpty(Str) Then
Str = ""
End If
DelStr = Replace(Str,";","")
DelStr = Replace(DelStr,"'","")
DelStr = Replace(DelStr,"&","")
DelStr = Replace(DelStr," ","")
DelStr = Replace(DelStr,"%20","")
DelStr = Replace(DelStr,"--","")
DelStr = Replace(DelStr,"==","")
DelStr = Replace(DelStr,"<","")
DelStr = Replace(DelStr,">","")
DelStr = Replace(DelStr,"%","")
DelStr = Replace(DelStr,"+","")
DelStr = Replace(DelStr,"顶级","DingJi")
End Function
''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''
'产生唯一的编号的私有方法GetOrderNumber
'返回一个唯一的编号
private function GetOrderNumber()
Randomize
RanNum=int(90000*rnd)+10000 '产生随即数
DIM N:N=right(year(now),len(year(now))-2)'取得年的后两为数
DIM Y:Y=month(now) '取得当前月
DIM R:R=day(now) '取得当天
Dim H:H=hour(now) '取得时钟
DIM M:M=minute(now) '取得分钟
DIM S:S=second(now) '取得秒中
IF LEN(Y)<2 THEN Y="0"&Y
IF LEN(R)<2 THEN R="0"&R
IF LEN(H)<2 THEN H="0"&H
IF LEN(M)<2 THEN M="0"&M
IF LEN(S)<2 THEN S="0"&S
GetOrderNumber=N&Y&R&H&M&S&RanNum '返回一个唯一的订单号
end function
End Class
%> |
|