mirror of
https://git.oceanpay.cc/danial/kami_scripts.git
synced 2025-12-18 22:13:23 +00:00
feat: 添加
This commit is contained in:
1
order_retry/demo.html
Normal file
1
order_retry/demo.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"code":1,"message":"接收成功"}
|
||||||
147
order_retry/xiangyun.ipynb
Normal file
147
order_retry/xiangyun.ipynb
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 29,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import requests\n",
|
||||||
|
"import hashlib\n",
|
||||||
|
"import uuid"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 38,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"amount=100&cardNumber=1234567890&cardPassword=1234567890&customerId=1¬ify_url=https://www.baidu.com&orderId=46ed12dfc21949d2b158702fde69344d&productCode=20&Key=1234567812345678\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"# string\tcustomerId\t是\t商户ID\n",
|
||||||
|
"# string\torderId\t是\t商户订单编号不大于50位长度\n",
|
||||||
|
"# string\tproductCode\t是\t点卡名称代码,参照本页【充值卡支持类型】\n",
|
||||||
|
"# string\tcardNumber\t是\t充值卡卡号,需使用3des加密后参与签名\n",
|
||||||
|
"# string\tcardPassword\t是\t充值卡密码,需使用3des加密后参与签名\n",
|
||||||
|
"# Number\tamount\t是\t提交面值\n",
|
||||||
|
"# string\tnotify_url\t是\t异步回掉接口\n",
|
||||||
|
"# string\tmcode\t否\t此参数为面值代码,如提交会员卡时需填写此参数\n",
|
||||||
|
"# String\tcustom\t否\t自定义参数原因返回\n",
|
||||||
|
"# string\tsign\t是\t参照下面说明进行MD5签名\n",
|
||||||
|
"\n",
|
||||||
|
"data = {\n",
|
||||||
|
" \"customerId\": \"1\",\n",
|
||||||
|
" \"orderId\": uuid.uuid4().hex,\n",
|
||||||
|
" \"productCode\": \"20\",\n",
|
||||||
|
" \"cardNumber\": \"1234567890\",\n",
|
||||||
|
" \"cardPassword\": \"1234567890\",\n",
|
||||||
|
" \"amount\": 100,\n",
|
||||||
|
" \"notify_url\": \"https://www.baidu.com\",\n",
|
||||||
|
" # \"sign\": \"1234567890\"\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"# sign加密\n",
|
||||||
|
"keys = sorted(data.keys())\n",
|
||||||
|
"sign = \"\"\n",
|
||||||
|
"for k in keys:\n",
|
||||||
|
" sign += f\"{k}={data[k]}&\"\n",
|
||||||
|
"sign = sign[:-1]\n",
|
||||||
|
"sign += \"&Key=1234567812345678\"\n",
|
||||||
|
"print(sign)\n",
|
||||||
|
"data[\"sign\"] = hashlib.md5(sign.encode()).hexdigest()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 52,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"{\"code\":1,\"message\":\"接收成功\"}\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import requests\n",
|
||||||
|
"\n",
|
||||||
|
"with open(\"demo.html\", \"w\", encoding='utf-8') as f:\n",
|
||||||
|
" text = requests.post(\"http://127.0.0.1/api.php/tocard\", data=data).text\n",
|
||||||
|
" print(text)\n",
|
||||||
|
" f.write(text)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 22,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"{'customerId': '1',\n",
|
||||||
|
" 'orderId': '1234567890',\n",
|
||||||
|
" 'productCode': '1234567890',\n",
|
||||||
|
" 'cardNumber': '1234567890',\n",
|
||||||
|
" 'cardPassword': '1234567890',\n",
|
||||||
|
" 'amount': 100,\n",
|
||||||
|
" 'notify_url': 'https://www.baidu.com',\n",
|
||||||
|
" 'sign': 'efa4f9294db0e5af4e1b848af590ad22'}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 22,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"amount=100&cardNumber=1234567890&cardPassword=1234567890&customerId=1¬ify_url=https://www.baidu.com&orderId=1234567890&productCode=1234567890&Key=1234567812345678\n",
|
||||||
|
"amount=100&cardNumber=1234567890&cardPassword=1234567890&customerId=1¬ify_url=https://www.baidu.com&orderId=1234567890&productCode=1234567890&key=1234567812345678"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.12.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user