Files
ClassContent/历届学生/fontendsix/项目练习/上课项目/shop-fontend/笔记.txt
2024-09-27 02:06:13 +08:00

142 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

json web token
jwt
ajax 请求是无状态的
RSA 非对称加密
公钥
私钥
token: WEWE.WF.REG.45.Y.4.6.7.U.T.JTYJ.TYJTYJTYJTYJYTJTYJYT.J.TJ.TYJ.TY.JTY
{
id: 1,
page: 2
}
KFEJWEHFBERUHGERGHETHRTHRTHR.HJR.H.RYJ.TY.JTU.KJT.UJ.TY.JTY.
{
status: 200,
data: [],
message: "1111"
}
WHDVQWDVUQWVDQWBFJQEBIFEFWGFR/GERGTEHRTHRYHRDHREHREHERHETH.EHRTHRTRH/HRHRTHRTHRT
http://127.0.0.1/api/index?id=1&page=3&time=16633444&sign=4bf8eb636c8981b361bcc03394f6ef06
time: 时间戳
sign:加密参数 规则
1 先排序
2 格式化字符串,做成get请求参数的格式
3 MD5加密 (对用户注册的密码进行加密,加密不可解密的)
{
id: 1,
time: 16633444,
page: 3,
}
id=1&time=16633444&page=3
4bf8eb636c8981b361bcc03394f6ef06
支付(假的)
后面和你们说
vue vue-router vuex
vuex: 存放全局变量(响应式的)和方法的
State:用来存数据的
Getter:用来读取 State 中的变量
Mutation:用来写 State 中的变量
Action:用来提交 Mutation,它可以完成异步操作
支付:
支付宝支付
1: PC端支付
1:
vue:
<div v-show="false" v-html="result"></div>
data: {
result: ''
}
<form action="https://alipay?sing=eqe2e1212124141">
<input type="text">
<input type="submit">
</form>
2: https://alipay?sing=eqe2e1212124141
location.href = https://alipay?sing=eqe2e1212124141
查看订单支付状态的页面地址(线上可以访问的地址)
http://bmy.com/order/checkOrder?nums=1231243243rewtet34t34543
2: 小程序支付 my.tradePay(订单号)
3: H5支付 和 PC端支付 流程一样
微信支付
1: PC端支付
1: 是一个图片(二维码)地址, 订单号
2: 通过定时器 setInterval 每隔一秒去查询订单是否支付成功
2: 小程序支付 wx.requestParm()
3: H5支付 WeixinJSBridge.invoke
支付方式接口:
[
{ title: '支付宝支付', type: 1 },
{ title: '微信支付', type: 2 },
]
支付流程:
1:下单接口
接口:/buyOrder
参数:[商品id]
返回数值:订单号 BDUDBHBHBU20211203879876867576576
2: 支付接口
接口:/pay
参数:
订单号 BDUDBHBHBU20211203879876867576576
支付方式(微信,支付宝) 1
返回数值:
{
"timeStamp":"",
"nonceStr": "",
"package": "",
"signType": "MD5",
"paySign": "",
}
3: 调用官方给的方法,传入参数即可唤醒官方的支付界面进行支付,在回调函数中拿到用户是否支付的结果
success (res) { }, 提示用户支付成功,自动跳转进入订单状态页面
fail (res) { } 提示用户支付失败,是否重新支付,如果点击确定,重新走 2 接口
4: 查询订单是否支付成功的接口 (H5支付)
接口:/checkPay
参数:
订单号 BDUDBHBHBU20211203879876867576576
返回数值:0 未支付,1支付成功